<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/what-digits-should-you-bet-on-in-super-bowl-squares/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://varianceexplained.org/r/super-bowl-squares/"> Variance Explained</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>My new office introduced me to a betting game I wasn’t previously familiar with: <a rel="nofollow" href="http://www.superbowlsquares.org/how-to-play" target="_blank">Super Bowl squares</a>. It’s played with a ten-by-ten grid, like this one from <a rel="nofollow" href="https://www.printyourbrackets.com/superbowl100squares.html" target="_blank">printyourbrackets.com</a>:</p>
<p><img alt="" src="https://i2.wp.com/www.printyourbrackets.com/images/super-bowl-squares.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Each row and column gets an assortment of digits from 0-9 representing each team’s score, and each person playing the game (after putting in some money) adds their initials to one of the boxes. Then the winner is picked based on <em>the least significant digit</em> of the score. If (for example) the game ended up being Eagles 20-Patriots 24, the player who had picked the row with 0 and the column with 4 would win.</p>
<p>If your team sets the digits in advance, you can get a statistical edge. <strong>Since not every score is equally likely, the least-significant digits aren’t equally likely either.</strong> Here I’ll take a data-driven approach to find the most common digits, and pairs of digits, in NFL scores. Like in most of my posts, I’ll be using the R language and the <a rel="nofollow" href="https://www.tidyverse.org/" target="_blank">tidyverse collection of packages</a>. By the end of tonight you can see how my predictions did!</p>
<h3>Most common digits</h3>
<p>We could use just the Super Bowl scores, perhaps <a rel="nofollow" href="https://en.wikipedia.org/wiki/List_of_Super_Bowl_champions" target="_blank">scraped from Wikipedia</a>. In a perfect world we could use that data, since Super Bowl scores are likely to be subtly different than the regular season. But there’ve been only 51, so the data is rather noisy. Instead, we’ll look at all NFL games since 1978, thanks to <a rel="nofollow" href="https://github.com/devstopfix/nfl_results" target="_blank">this helpful GitHub dataset from James Every</a>.</p>
<figure>
<pre><code data-lang="r"><span>library</span><span>(</span><span>tidyverse</span><span>)</span><span><br data-jekyll-commonmark-ghpages=""></span><span>theme_set</span><span>(</span><span>theme_light</span><span>())</span><span><br data-jekyll-commonmark-ghpages=""><br data-jekyll-commonmark-ghpages=""></span><span># Git clone first from git@github.com:devstopfix/nfl_results.git</span><span><br data-jekyll-commonmark-ghpages=""></span><span>games</span><span> </span><span>&lt;-</span><span> </span><span>dir</span><span>(</span><span>&quot;nfl_results/&quot;</span><span>,</span><span> </span><span>pattern</span><span> </span><span>=</span><span> </span><span>&quot;.csv&quot;</span><span>,</span><span> </span><span>full.names</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>)</span><span> </span><span>%>%</span><span><br data-jekyll-commonmark-ghpages=""> </span><span>map_df</span><span>(</span><span>read_csv</span><span>)</span><span><br data-jekyll-commonmark-ghpages=""><br data-jekyll-commonmark-ghpages=""></span><span># Gather into one tall data frame of scores, and calculate the digit</span><span><br data-jekyll-commonmark-ghpages=""></span><span># The dataset has a couple games from before 1978, but only a few per year</span><span><br data-jekyll-commonmark-ghpages=""></span><span>scores</span><span> </span><span>&lt;-</span><span> </span><span>games</span><span> </span><span>%>%</span><span><br data-jekyll-commonmark-ghpages=""> </span><span>filter</span><span>(</span><span>season</span><span> </span><span>>=</span><span> </span><span>1978</span><span>)</span><span> </span><span>%>%</span><span><br data-jekyll-commonmark-ghpages=""> </span><span>gather</span><span>(</span><span>type</span><span>,</span><span> </span><span>score</span><span>,</span><span> </span><span>home_score</span><span>,</span><span> </span><span>visitors_score</span><span>)</span><span> </span><span>%>%</span><span><br data-jekyll-commonmark-ghpages=""> </span><span>mutate</span><span>(</span><span>digit</span><span> </span><span>=</span><span> </span><span>score</span><span> </span><span>%%</span><span> </span><span>10</span><span>)</span><span><br data-jekyll-commonmark-ghpages=""><br data-jekyll-commonmark-ghpages=""></span><span>scores</span></code></pre>
</figure>
<figure>
<pre><code data-lang="text">## # A tibble: 18,148 x 8<br data-jekyll-commonmark-ghpages="">##    season  week kickoff             home_team  visitin… type   score digit<br data-jekyll-commonmark-ghpages="">##     </code></pre></figure>