<p>The Simpsons needs no introduction. At 27 seasons and counting, it’s the longest-running scripted series in the history of American primetime television.</p>
<p>The show’s longevity, and the fact that it’s animated, provides a vast and relatively unchanging universe of characters to study. It’s easier for an animated show to scale to hundreds of recurring characters; without live-action actors to grow old or move on to other projects, the denizens of Springfield remain mostly unchanged from year to year.</p>
<p>As a <a href="https://frinkiac.com/img/S08E14/686368.jpg">fan of the show</a>, I present a few short analyses about Springfield, from the show’s dialogue to its TV ratings. All code used for this post is <a href="https://github.com/toddwschneider/flim-springfield">available on GitHub</a>.</p>
<h2>The Simpsons characters who have spoken the most words</h2>
<p><a href="http://www.simpsonsworld.com/">Simpsons World</a> provides a delightful trove of content for fans. In addition to streaming every episode, the site includes episode guides, scripts, and audio commentary. I wrote code to parse the available episode scripts and attribute every word of dialogue to a character, then ranked the characters by number of words spoken in the history of the show.</p>
<p>The top four are, not surprisingly, the Simpson nuclear family.</p>
<p>If you want to quiz yourself, pause here and try to name the next 5 biggest characters in order before looking at the answers…</p>
<div></div>
<p>
</p>
<p>Of course Homer ranks first: he’s the undisputed most iconic character, and he accounts for 21% of the show’s 1.3 million words spoken through season 26. Marge, Bart, and Lisa—in that order—combine for another 26%, giving the Simpson family a 47% share of the show’s dialogue.</p>
<p>If we exclude the Simpson nuclear family and focus on the top 50 supporting characters, the results become a bit less predictable, if not exactly surprising.</p>
<p>
</p>
<p>Mr. Burns speaks the most words among supporting cast members, followed by Moe, Principal Skinner, Ned Flanders, and Krusty rounding out the top 5.</p>
<h2>Gender imbalance on The Simpsons</h2>
<p>The colors of the bars in the above graphs represent gender: blue for male characters, red for female. If we look at the supporting cast, the 14 most prominent characters are all male before we get to the first woman, Mrs. Krabappel, and only 5 of the top 50 supporting cast members are women.</p>
<p>Women account for 25% of the dialogue on The Simpsons, including Marge and Lisa, two of the show’s main characters. If we remove the Simpson nuclear family, things look even more lopsided: <strong>women account for less than 10% of the supporting cast’s dialogue.</strong></p>
<p>A look at the show’s <a href="https://en.wikipedia.org/wiki/List_of_The_Simpsons_writers">list of writers</a> reveals that 9 of the top 10 writers are male. I did not collect data on which writers wrote which episodes, but it would make for an interesting follow-up to see if the episodes written by women have a more equal distribution of dialogue between male and female characters.</p>
<h2>Eye on Springfield</h2>
<p>The scripts also include each scene’s setting, which I used to compute the locations with the most dialogue.</p>
<p>
</p>
<p>The location data is a bit messy to work with—should “Simpson Living Room” really be treated differently than “Simpson Home”—but nevertheless it paints a picture of where people spend time in Springfield: at home, school, work, and the local bar.</p>
<h2>The Bart-to-Homer transition?</h2>
<p>Per <a href="https://en.wikipedia.org/wiki/The_Simpsons">Wikipedia</a>:</p>
<blockquote>
<p>While later seasons would focus on Homer, Bart was the lead character in most of the first three seasons</p>
</blockquote>
<p>I’ve heard this argument before, that the show was originally about Bart before switching its focus to Homer, but the actual scripts only seem to partially support it.</p>
<p></p>
<p>Bart accounted for a significantly larger share of the show’s dialogue in season 1 than in any future season, but <a href="http://toddwschneider.com/data/simpsons/01_homer_simpson.png">Homer’s share has always been higher</a> than Bart’s. Dialogue share might not tell the whole story about a character’s prominence, but the fact is that Homer has always been the most talkative character on the show.</p>
<h2>The Simpsons TV ratings are in decline</h2>
<p>Historical Nielsen ratings data is hard to come by, so I relied on Wikipedia for Simpsons episode-level <a href="https://en.wikipedia.org/wiki/List_of_The_Simpsons_episodes">television viewership data</a>.</p>
<p>
</p>
<p>Viewership appears to jump in 2000, between seasons 11 and 12, but closer inspection reveals that’s when the Wikipedia data switches from reporting households to individuals. I don’t know the reason for the switch—it might have something to do with Nielsen’s measurement or reporting—but without any other data sources it’s difficult to confirm.</p>
<p>Aside from that bump, which is most likely a data artifact, not a real trend, it’s clear that the show’s ratings are trending lower. The early seasons averaged over 20 million viewers per episode, including <a href="https://en.wikipedia.org/wiki/Bart_Gets_an_%22F%22">Bart Gets an “F”</a>, the first episode of season 2, which is still the most-watched episode in the show’s history with an estimated 33.6 million viewers. The more recent seasons have averaged less than 5 million viewers per episode, more than an 80% decline since the show’s beginnings. </p>
<p></p>
<p>
<a href="https://frinkiac.com/meme/S08E14/119735/m/V0hBVCBIQVBQRU5FRCBIRVJFPwpMSUdIVE5JTkcgSElUIFRIRQpUUkFOU01JVFRFUj8=">Frinkiac</a>
</p>
<h2>TV ratings have declined everywhere, not just on The Simpsons</h2>
<p>Although the ratings data looks bad for The Simpsons, it doesn’t tell the whole story: TV ratings for individual shows have been broadly declining for over 60 years.</p>
<p>When The Simpsons came out in 1989, the <a href="https://en.wikipedia.org/wiki/Top-rated_United_States_television_programs_of_1989%E2%80%9390">highest 30 rated shows</a> on TV averaged a 17.7 Nielsen rating, meaning that 17.7% of television-equipped households tuned in to the average top 30 show. In 2014–15, <a href="https://en.wikipedia.org/wiki/Top-rated_United_States_television_programs_of_2014%E2%80%9315">the highest 30 rated shows</a> managed an 8.7 average rating, a decline of 50% over that 25 year span.</p>
<p>If we go all the way back to the 1951, the top 30 shows averaged a 38.2 rating, which is more than triple the single highest-rated program of 2014–15 (NBC’s Sunday Night Football, which averaged a 12.3 rating).</p>
<p></p>
<p>Full data for the top 30 shows by season is <a href="https://github.com/toddwschneider/flim-springfield/blob/master/analysis/data/nielsen_ratings.csv">available here on GitHub</a></p>
<p>I have no proof for the cause of this decline in the average Nielsen rating of a top 30 show, but intuitively it must be related to the proliferation of channels. TV viewers in the 1950s had a small handful of channels to choose from, while modern viewers have hundreds if not thousands of choices, not to mention streaming options, which present their own <a href="http://www.nytimes.com/2016/02/03/business/media/nielsen-playing-catch-up-as-tv-viewing-habits-change-and-digital-rivals-spring-up.html?_r=0">ratings measurement challenges</a>.</p>
<p></p>
<p>
<a href="https://frinkiac.com/meme/S05E15/896127/m/CkFORCBIT1cnUyBUSEUgU1BBQ0VDUkFGVApET0lORz8KCgpJIERPTidUIEtOT1cuIEFMTCBUSElTCkVRVUlQTUVOVCBJUyBKVVNUIFVTRUQgVE8KTUVBU1VSRSBUViBSQVRJTkdTCgoKCg==">Frinkiac</a>
</p>
<p>We could normalize Simpsons episode ratings by the declining top 30 curve to adjust for the fact that it’s more difficult for any one show to capture as large a share of the TV audience over time. But as mentioned earlier, the normalization would only account for about a 50% decline in ratings since 1989, while The Simpsons ratings have declined more like 80-85% over that horizon.</p>
<p>Alas, I must confess, I stopped watching the show around season 12, and <a href="http://toddwschneider.com/data/simpsons/avg_simpsons_world_views_by_season.png">Simpsons World’s episode view counts</a> suggest that modern streaming viewers are more interested in the early seasons too, so it could just be that people are losing interest.</p>
<p>As I write this, The Simpsons is under contract to be produced for one more season, though it’s entirely possible it will be renewed. But ultimately Troy McClure said it best at the conclusion of the The Simpsons 138th Episode Spectacular, which, it’s hard to believe, now covers less than 25% of the show’s history:</p>
<p></p>
<p>
<a href="https://frinkiac.com/meme/S07E10/1303751/m/V2hvIGtub3dzIHdoYXQgYWR2ZW50dXJlcwp0aGV5J2xsIGhhdmUgYmV0d2VlbiBub3cKYW5kIHRoZSB0aW1lIHRoZSBzaG93CmJlY29tZXMgdW5wcm9maXRhYmxlPw==">Frinkiac</a>
</p>
<h2>Automated episode summaries using tf–idf</h2>
<p><a href="https://en.wikipedia.org/wiki/Tf%E2%80%93idf">Term frequency–inverse document frequency</a> is a popular technique used to determine which words are most significant to a document that is itself part of a larger corpus. In our case, the documents are individual episode scripts, and the corpus is the collection of all scripts.</p>
<p>The idea behind tf–idf is to find words or phrases that occur frequently within a single document, but rarely within the overall corpus. To use a specific example from The Simpsons, the phrase “dental plan” appears 19 times in <a href="https://en.wikipedia.org/wiki/Last_Exit_to_Springfield">Last Exit to Springfield</a>, but only once throughout the rest of the show, and sure enough the tf–idf algorithm identifies “dental plan” as the most relevant phrase from that episode.</p>
<p>I used R’s <a href="https://cran.r-project.org/web/packages/tidytext/vignettes/tidytext.html">tidytext</a> package to pull out the single word or phrase with the highest tf–idf rank for each episode; <a href="https://github.com/toddwschneider/flim-springfield/blob/master/analysis/analysis.R#L212-L243">here’s</a> the relevant section of code.</p>
<p>The results are pretty good, and should be at least slightly entertaining to fans of the show. Beyond “dental plan”, there are fan-favorites including <a href="https://en.wikipedia.org/wiki/Bart_the_Genius">“kwyjibo”</a>, <a href="https://en.wikipedia.org/wiki/Radio_Bart">“down the well”</a>, <a href="https://en.wikipedia.org/wiki/Marge_vs._the_Monorail">“monorail”</a>, <a href="https://en.wikipedia.org/wiki/Bart_Gets_Famous">“I didn’t do it”</a>, and <a href="https://en.wikipedia.org/wiki/A_Fish_Called_Selma">“Dr. Zaius”</a>, though to be fair, there are also some less iconic results.</p>
<p>You can see the full list of episodes and “most relevant phrases” <a href="https://docs.google.com/spreadsheets/d/1XETUC97k1AvVPwqGnPuSPnWVtMrk2YhO8aHbo53RcoU/pubhtml?gid=0&single=true">here</a>.</p>
<div></div>
<p>Another interesting follow-up could be to use <a href="https://research.googleblog.com/2016/08/text-summarization-with-tensorflow.html">more sophisticated techniques</a> to write more complete episode summaries based on the scripts, but I was pleasantly surprised by the relevance of the comparatively simple tf–idf approach.</p>
<p></p>
<p>
<a href="https://frinkiac.com/meme/S03E14/265282/m/IEFmdGVyIGV2YWx1YXRpbmcgbWlsbGlvbnMKIG9mIHBpZWNlcyBvZiBkYXRhIGluIHRoZQogYmxpbmsgb2YgYW4gZXllLi4u">Frinkiac</a>
</p>
<h2>Code on GitHub</h2>
<p>All code used in this post is <a href="https://github.com/toddwschneider/flim-springfield">available on GitHub</a>, and the screencaps come from the amazing <a href="https://frinkiac.com/">Frinkiac</a></p>
');
$placeholder.remove();
$(&quot;#simpsons-episodes-chart&quot;).after(&quot;<p>Hover to view individual episode data, click and drag to zoom</p>&quot;);
$.get(&quot;/data/simpsons/episodes.json&quot;, function(episodes) {
new Highcharts.Chart({
chart: {
renderTo: 'simpsons-episodes-chart',
type: 'scatter',
zoomType: 'x',
backgroundColor: '#ffd90f',
style: { fontFamily: 'Akbar, Verdana, Arial, sans-serif' }
},
series: [{data: episodes}],
title: {
text: 'The Simpsons TV ratings by episode',
style: { fontSize: '36px' }
},
subtitle: {
text: 'data via Wikipedia',
style: { fontSize: '24px' }
},
xAxis: {
type: 'datetime',
min: 567993600000,
lineWidth: 0,
gridLineWidth: 0.4,
gridLineColor: '#70d1ff',
labels: {
style: { fontSize: '20px' }
},
title: {
text: 'Original air date',
margin: 25,
style: { fontSize: '28px' }
}
},
yAxis: {
min: 0,
gridLineWidth: 0.4,
gridLineColor: '#70d1ff',
labels: {
style: { fontSize: '20px' }
},
title: {
text: 'US viewers in millions',
margin: 25,
style: { fontSize: '28px' }
}
},
legend: { enabled: false },
plotOptions: {
series: {
animation: false,
color: 'rgba(79, 118, 223, 0.6)',
stickyTracking: false
},
},
tooltip: {
enabled: true,
snap: 10,
useHTML: true,
animation: false,
borderColor: '#70d1ff',
borderWidth: 3,
style: {
padding: 0
},
formatter: function() {
return '<div>' +
'<div></div>' +
'<div>' +
'<div>' +
Highcharts.dateFormat('%b %e, %Y', this.x) +
', S' + this.point.season + ' E' + this.point.number_in_season +
'</div>' +
'<p>' + this.point.name + '</p>' +
'<div>' + this.y + ' million US viewers</div>' +
'</div>' +
'</div>';
}
},
credits: {
text: 'toddwschneider.com',
href: '#simpsons-episodes-chart',
style: { fontSize: '14px' }
}
});
});
});
<div></div>