<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/evolution-of-ice-hockey-players-height-iihf-world-championships-2001-2016/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://ikashnitsky.github.io/2017/ice-hockey-players-height/"> Ilya Kashnitsky</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>The 2017 Ice Hockey World Championship has started. Thus I want to share a small research on the height of ice hockey players that I did almost a year ago and <a target="_blank" rel="nofollow" href="https://habrahabr.ru/post/301340/">published in Russian</a>.</p>
<p>When the TV camera shows the players returning to the changing rooms, it is difficult not to notice just how huge the players are compared to the surrounding people – fans, journalists, coaches, or the ice arena workers. For example, here are the rising stars of the Finnish hockey – Patrik Laine and Aleksander Barkov – with the two fans in between.</p>
<p><a target="_blank" rel="nofollow" href="https://i1.wp.com/ikashnitsky.github.io/images/170507/fig-00-laine-barkov.jpg?ssl=1"><img alt="fig0" src="https://i1.wp.com/ikashnitsky.github.io/images/170507/fig-00-laine-barkov.jpg?w=456&ssl=1" data-recalc-dims="1"></a><br>
<em><a target="_blank" rel="nofollow" href="https://www.instagram.com/p/BFjNdn7zORh">Source</a></em></p>
<p>So the questions arise. Are ice hockey players really taller than average people? How is the height of ice hockey players evolving over time? Are there any lasting differences between countries?</p>
<h1>Data</h1>
<p>IIHF, the organization that is in charge for the ice hockey world championships, publishes detailed information on the squads, including the data on player’s height and weight. The raw data files are <a target="_blank" rel="nofollow" href="http://www.iihf.com/iihf-home/history/past-tournaments/">here</a>. I gathered the data of all players that participated in the 16 world championships between 2001 and 2016. The formatting of the data files changes from year to year complicating the data processing. So I did the data cleaning manually which took a bit more than 3 hours. The unifies dataset is <a target="_blank" rel="nofollow" href="https://dx.doi.org/10.6084/m9.figshare.3394735.v2">here</a>. Let’s load the data and prepare the R session.</p>
<div>
<pre><code># load required packages
library(tidyverse) # data manipulation and viz
library(lubridate) # easy manipulations with dates
library(ggthemes) # themes for ggplot2
library(texreg) # easy export of regression tables
library(xtable) # export a data frame into an html table
library(sysfonts) # change the font in figures


# download the IIHF data set; if there are some problems, you can download manually
# using the stable URL (https://dx.doi.org/10.6084/m9.figshare.3394735.v2)
df &lt;- read.csv(&quot;https://ndownloader.figshare.com/files/5303173&quot;)

# color palette
brbg11 &lt;- RColorBrewer::brewer.pal(11, &quot;BrBG&quot;)
</code></pre>
</div>
<h1>Do the players become taller? (a crude comparison)</h1>
<p>Let’s first have a look at the pulled average height of all the players that participated.</p>
<div>
<pre><code># mean height by championship
df_per &lt;- df %>% group_by(year) %>%
        summarise(height = mean(height))

gg_period_mean &lt;- ggplot(df_per, aes(x = year, y = height))+
        geom_point(size = 3, color = brbg11[9])+
        stat_smooth(method = &quot;lm&quot;, size = 1, color = brbg11[11])+
        ylab(&quot;height, cm&quot;)+
        xlab(&quot;year of competition&quot;)+
        scale_x_continuous(breaks = seq(2005, 2015, 5), labels = seq(2005, 2015, 5))+
        theme_few(base_size = 15, base_family = &quot;mono&quot;)+
        theme(panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))


gg_period_jitter &lt;- ggplot(df, aes(x = year, y = height))+
        geom_jitter(size = 2, color = brbg11[9], alpha = .25, width = .75)+
        stat_smooth(method = &quot;lm&quot;, size = 1, se = F, color = brbg11[11])+
        ylab(&quot;height, cm&quot;)+
        xlab(&quot;year of competition&quot;)+
        scale_x_continuous(breaks = seq(2005, 2015, 5), labels = seq(2005, 2015, 5))+
        theme_few(base_size = 15, base_family = &quot;mono&quot;)+
        theme(panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))

gg_period &lt;- cowplot::plot_grid(gg_period_mean, gg_period_jitter)
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i2.wp.com/ikashnitsky.github.io/images/170507/fig-01-period-height.png?ssl=1"><img alt="fig1" src="https://i2.wp.com/ikashnitsky.github.io/images/170507/fig-01-period-height.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 1. The dynamics of the average height of the ice hockey players at the world championships, 2001–2016</strong></p>
<p>The positive trend is evident. In the 15 years the average height of a player increased by almost 2 cm (left panel). Is that a lot? To have an idea, we will compare this growth to the dynamics in the population, later in the post.</p>
<h1>Cohort approach</h1>
<p>A more correct way to study the dynamics of players’ height is to do the comparison between birth cohorts. Here we face an interesting data preparation issue – some of the players participated in more that one championships. The question is: do we need to clean the duplicate records? If the goal is to see the average height of a player at the certain championship (as in Figure 1), it is reasonable to keep all the records. Alternatively, if the aim is to analyze the dynamics of players’ height itself, I argue, it would be wrong to assign bigger weight to those players that participated in more that one championship. Thus, for the further cohort analysis, I cleaned the dataset from the duplicates.</p>
<div>
<pre><code>dfu_h &lt;- df %>% select(year, name, country, position, birth, cohort, height) %>%
        spread(year, height)
dfu_h$av.height &lt;- apply(dfu_h[, 6:21], 1, mean, na.rm = T)
dfu_h$times_participated &lt;- apply(!is.na(dfu_h[, 6:21]), 1, sum)

dfu_w &lt;- df %>% select(year, name, country, position, birth, cohort, weight) %>%
        spread(year, weight)
dfu_w$av.weight &lt;- apply(dfu_w[, 6:21], 1, mean, na.rm = T)


dfu &lt;- left_join(dfu_h %>% select(name, country, position, birth, cohort, av.height, times_participated), 
                 dfu_w %>% select(name, country, position, birth, cohort, av.weight), 
                 by = c(&quot;name&quot;, &quot;country&quot;, &quot;position&quot;, &quot;birth&quot;, &quot;cohort&quot;)) %>%
        mutate(bmi = av.weight / (av.height / 100) ^ 2)
</code></pre>
</div>
<p>The total number of observations decreased from 6292 to 3333. For those who participated in more that one championship, I averaged the data on height and weight as they can change during the life-course. How many times, on average, are ice hockey players honored to represent their countries in the world championships? A bit less than 2.</p>
<div>
<pre><code># frequencies of participation in world championships
mean(dfu$times_participated)

df_part &lt;- as.data.frame(table(dfu$times_participated))

gg_times_part &lt;- ggplot(df_part, aes(y = Freq, x = Var1))+
        geom_bar(stat = &quot;identity&quot;, fill = brbg11[8])+
        ylab(&quot;# of players&quot;)+
        xlab(&quot;times participated (out of 16 possible)&quot;)+
        theme_few(base_size = 15, base_family = &quot;mono&quot;)+
        theme(panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i1.wp.com/ikashnitsky.github.io/images/170507/fig-02-times-part.png?ssl=1"><img alt="fig2" src="https://i1.wp.com/ikashnitsky.github.io/images/170507/fig-02-times-part.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 2. Histogram of the players by the number of times they participated in world championships over the period 2001-2016.</strong></p>
<p>But there are unique players that participated in a considerable number of championships. Let’s have a look at those who participated at least 10 times out of 16 possible. There were just 14 such players.</p>
<div>
<pre><code># the leaders of participation in world championships
leaders &lt;- dfu %>% filter(times_participated > 9)
View(leaders)
# save the table to html
print(xtable(leaders), type = &quot;html&quot;, file = &quot;table_leaders.html&quot;)
</code></pre>
</div>
<p><strong>Table 1. The most frequently participated players</strong></p>

<table>
<tr>
<th>name </th>
<th> country </th>
<th> position </th>
<th> birth date</th>
<th> cohort </th>
<th> av.height </th>
<th> times _participated </th>
<th> av.weight </th>
<th> bmi </th>
</tr>
<tr>
<td> ovechkin alexander </td>
<td> RUS </td>
<td> F </td>
<td> 1985-09-17 </td>
<td> 1985 </td>
<td> 188.45 </td>
<td> 11 </td>
<td> 98.36 </td>
<td> 27.70 </td>
</tr>
<tr>
<td> nielsen daniel </td>
<td> DEN </td>
<td> D </td>
<td> 1980-10-31 </td>
<td> 1980 </td>
<td> 182.27 </td>
<td> 11 </td>
<td> 79.73 </td>
<td> 24.00 </td>
</tr>
<tr>
<td> staal kim </td>
<td> DEN </td>
<td> F </td>
<td> 1978-03-10 </td>
<td> 1978 </td>
<td> 182.00 </td>
<td> 10 </td>
<td> 87.80 </td>
<td> 26.51 </td>
</tr>
<tr>
<td> green morten </td>
<td> DEN </td>
<td> F </td>
<td> 1981-03-19 </td>
<td> 1981 </td>
<td> 183.00 </td>
<td> 12 </td>
<td> 85.83 </td>
<td> 25.63 </td>
</tr>
<tr>
<td> masalskis edgars </td>
<td> LAT </td>
<td> G </td>
<td> 1980-03-31 </td>
<td> 1980 </td>
<td> 176.00 </td>
<td> 12 </td>
<td> 79.17 </td>
<td> 25.56 </td>
</tr>
<tr>
<td> ambuhl andres </td>
<td> SUI </td>
<td> F </td>
<td> 1983-09-14 </td>
<td> 1983 </td>
<td> 176.80 </td>
<td> 10 </td>
<td> 83.70 </td>
<td> 26.78 </td>
</tr>
<tr>
<td> granak dominik </td>
<td> SVK </td>
<td> D </td>
<td> 1983-06-11 </td>
<td> 1983 </td>
<td> 182.00 </td>
<td> 10 </td>
<td> 79.50 </td>
<td> 24.00 </td>
</tr>
<tr>
<td> madsen morten </td>
<td> DEN </td>
<td> F </td>
<td> 1987-01-16 </td>
<td> 1987 </td>
<td> 189.82 </td>
<td> 11 </td>
<td> 86.00 </td>
<td> 23.87 </td>
</tr>
<tr>
<td> redlihs mikelis </td>
<td> LAT </td>
<td> F </td>
<td> 1984-07-01 </td>
<td> 1984 </td>
<td> 180.00 </td>
<td> 10 </td>
<td> 80.40 </td>
<td> 24.81 </td>
</tr>
<tr>
<td> cipulis martins </td>
<td> LAT </td>
<td> F </td>
<td> 1980-11-29 </td>
<td> 1980 </td>
<td> 180.70 </td>
<td> 10 </td>
<td> 82.10 </td>
<td> 25.14 </td>
</tr>
<tr>
<td> holos jonas </td>
<td> NOR </td>
<td> D </td>
<td> 1987-08-27 </td>
<td> 1987 </td>
<td> 180.18 </td>
<td> 11 </td>
<td> 91.36 </td>
<td> 28.14 </td>
</tr>
<tr>
<td> bastiansen anders </td>
<td> NOR </td>
<td> F </td>
<td> 1980-10-31 </td>
<td> 1980 </td>
<td> 190.00 </td>
<td> 11 </td>
<td> 93.64 </td>
<td> 25.94 </td>
</tr>
<tr>
<td> ask morten </td>
<td> NOR </td>
<td> F </td>
<td> 1980-05-14 </td>
<td> 1980 </td>
<td> 185.00 </td>
<td> 10 </td>
<td> 88.30 </td>
<td> 25.80 </td>
</tr>
<tr>
<td> forsberg kristian </td>
<td> NOR </td>
<td> F </td>
<td> 1986-05-05 </td>
<td> 1986 </td>
<td> 184.50 </td>
<td> 10 </td>
<td> 87.50 </td>
<td> 25.70 </td>
</tr>
</table>
<p>Alexander Ovechkin – 11 times! But it has to be noted that not every player had a possibility to participate in all the 16 championships between 2001 and 2016. That depends on a numder of factors:</p>
<ul>
<li>the birth cohort of the player;</li>
<li>whether his national team regularly qualified for the championship (Figure 3);</li>
<li>whether the player was good enough for the national team;</li>
<li>whether he was free from the NHL play-offs that often keep the best players off the world championships.</li>
</ul>
<div>
<pre><code># countries times participated
df_cnt_part &lt;- df %>% select(year, country, no) %>%
        mutate(country = factor(paste(country))) %>%
        group_by(country, year) %>%
        summarise(value = sum(as.numeric(no))) %>%
        mutate(value = 1) %>%
        ungroup() %>%
        mutate(country = factor(country, levels = rev(levels(country))), 
               year = factor(year))

d_cnt_n &lt;- df_cnt_part %>% group_by(country) %>%
        summarise(n = sum(value))

gg_cnt_part &lt;- ggplot(data = df_cnt_part, aes(x = year, y = country))+
        geom_point(color = brbg11[11], size = 7)+
        geom_text(data = d_cnt_n, aes(y = country, x = 17.5, label = n, color = n), size = 7, fontface = 2)+
        geom_text(data = d_cnt_n, aes(y = country, x = 18.5, label = &quot; &quot;), size = 7)+
        scale_color_gradientn(colours = brbg11[7:11])+
        xlab(NULL)+
        ylab(NULL)+
        theme_bw(base_size = 25, base_family = &quot;mono&quot;)+
        theme(legend.position = &quot;none&quot;, 
              axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-03-countries-part.png?ssl=1"><img alt="fig3" src="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-03-countries-part.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 3. Stats of the national teams participation in the world championships</strong></p>
<h1>Do the ice hochey players become taller? (regression analysis)</h1>
<p>The regression analysis allows to address the research question – the association between player’s height and birth cohort – accounting for the cross-national differences and player’s position. I use OLS regressions, that are quite sensitive to outliers. I removed the birth cohorts for which there are less than 10 players – 1963, 1997, and 1998.</p>
<div>
<pre><code># remove small cohorts
table(dfu$cohort)
dfuc &lt;- dfu %>% filter(cohort &lt; 1997, cohort > 1963)
</code></pre>
</div>
<p>So, the results. I add the variables one by one.</p>
<p><strong>Dependent variable</strong>: player’s height.<br>
<strong>Explaining variables</strong>: 1) birth cohort; 2) position (compared to defenders); 3) country (compared to Russia).</p>
<div>
<pre><code># relevel counrty variable to compare with Russia
dfuc$country &lt;- relevel(dfuc$country, ref = &quot;RUS&quot;)

# regression models
m1 &lt;- lm(data = dfuc, av.height~cohort)
m2 &lt;- lm(data = dfuc, av.height~cohort+position)
m3 &lt;- lm(data = dfuc, av.height~cohort+position+country)

# export the models to html
htmlreg(list(m1, m2, m3), file = &quot;models_height.html&quot;, single.row = T)
</code></pre>
</div>
<p><strong>Table2. The models</strong></p>

<table>
<tr>
<th></th>
<th>Model 1</th>
<th>Model 2</th>
<th>Model 3</th>
</tr>
<tr>
<td>(Intercept)</td>
<td>-10.17 (27.67)</td>
<td>-18.64 (27.01)</td>
<td>32.59 (27.00)</td>
</tr>
<tr>
<td>cohort</td>
<td>0.10 (0.01)***</td>
<td>0.10 (0.01)***</td>
<td>0.08 (0.01)***</td>
</tr>
<tr>
<td>positionF</td>
<td></td>
<td>-2.59 (0.20)***</td>
<td>-2.59 (0.20)***</td>
</tr>
<tr>
<td>positionG</td>
<td></td>
<td>-1.96 (0.31)***</td>
<td>-1.93 (0.30)***</td>
</tr>
<tr>
<td>countryAUT</td>
<td></td>
<td></td>
<td>-0.94 (0.55)</td>
</tr>
<tr>
<td>countryBLR</td>
<td></td>
<td></td>
<td>-0.95 (0.53)</td>
</tr>
<tr>
<td>countryCAN</td>
<td></td>
<td></td>
<td>1.13 (0.46)*</td>
</tr>
<tr>
<td>countryCZE</td>
<td></td>
<td></td>
<td>0.56 (0.49)</td>
</tr>
<tr>
<td>countryDEN</td>
<td></td>
<td></td>
<td>-0.10 (0.56)</td>
</tr>
<tr>
<td>countryFIN</td>
<td></td>
<td></td>
<td>0.20 (0.50)</td>
</tr>
<tr>
<td>countryFRA</td>
<td></td>
<td></td>
<td>-2.19 (0.69)**</td>
</tr>
<tr>
<td>countryGER</td>
<td></td>
<td></td>
<td>-0.61 (0.51)</td>
</tr>
<tr>
<td>countryHUN</td>
<td></td>
<td></td>
<td>-0.61 (0.86)</td>
</tr>
<tr>
<td>countryITA</td>
<td></td>
<td></td>
<td>-3.58 (0.61)***</td>
</tr>
<tr>
<td>countryJPN</td>
<td></td>
<td></td>
<td>-5.24 (0.71)***</td>
</tr>
<tr>
<td>countryKAZ</td>
<td></td>
<td></td>
<td>-1.16 (0.57)*</td>
</tr>
<tr>
<td>countryLAT</td>
<td></td>
<td></td>
<td>-1.38 (0.55)*</td>
</tr>
<tr>
<td>countryNOR</td>
<td></td>
<td></td>
<td>-1.61 (0.62)**</td>
</tr>
<tr>
<td>countryPOL</td>
<td></td>
<td></td>
<td>0.06 (1.12)</td>
</tr>
<tr>
<td>countrySLO</td>
<td></td>
<td></td>
<td>-1.55 (0.58)**</td>
</tr>
<tr>
<td>countrySUI</td>
<td></td>
<td></td>
<td>-1.80 (0.53)***</td>
</tr>
<tr>
<td>countrySVK</td>
<td></td>
<td></td>
<td>1.44 (0.50)**</td>
</tr>
<tr>
<td>countrySWE</td>
<td></td>
<td></td>
<td>1.18 (0.48)*</td>
</tr>
<tr>
<td>countryUKR</td>
<td></td>
<td></td>
<td>-1.82 (0.59)**</td>
</tr>
<tr>
<td>countryUSA</td>
<td></td>
<td></td>
<td>0.54 (0.45)</td>
</tr>
<tr>
<td>R2</td>
<td>0.01</td>
<td>0.06</td>
<td>0.13</td>
</tr>
<tr>
<td>Adj. R2</td>
<td>0.01</td>
<td>0.06</td>
<td>0.12</td>
</tr>
<tr>
<td>Num. obs.</td>
<td>3319</td>
<td>3319</td>
<td>3319</td>
</tr>
<tr>
<td>RMSE</td>
<td>5.40</td>
<td>5.27</td>
<td>5.10</td>
</tr>
</table>
<p><strong>Model 1</strong>. One year change in the birth cohort year is associated with an increase of 0.1 cm in height. The coefficient is statistically significant, yet the variable explains only 1% of the variance. That’s not a big problem since the aim of the modeling is to document the differences, rather than predict based on the model. Nevertheless, the low coefficient of determination means that there are other variables that explain the differences in players’ height better than just the birth cohort.</p>
<p><strong>Model 2.</strong> Defenders are the tallest ice hockey players: goalkeepers are 2 cm shorter, forwards are 2.6 cm shorter. All the coefficients are significant; R squared rose to 6%. It is worth noting that the coefficient for the birth cohort did not change when we added the new variable.</p>
<p><strong>Model 3</strong>. It is interesting to control for countries for two reasons. First, some of the differences are significant themselves. For example, Swedes, Slovaks, and Canadians are higher than Russians. In contrast, Japanese are 5.2 cm shorter, Italians – 3.6 cm, French – 2.2 cm (figure 4). Second, once the country controls are introduced, the coefficient for birth cohort decreased slightly meaning that some of the differences in height are explained by persisting cross-country differences. R squared rose to 13%.</p>
<div>
<pre><code># players' height by country
gg_av.h_country &lt;- ggplot(dfuc , aes(x = factor(cohort), y = av.height))+
        geom_point(color = &quot;grey50&quot;, alpha = .25)+
        stat_summary(aes(group = country), geom = &quot;line&quot;, fun.y = mean, size = .5, color = &quot;grey50&quot;)+
        stat_smooth(aes(group = country, color = country), geom = &quot;line&quot;, size = 1)+
        facet_wrap(~country, ncol = 4)+
        coord_cartesian(ylim = c(170, 195))+
        scale_x_discrete(labels = paste(seq(1970, 1990, 10)), breaks = paste(seq(1970, 1990, 10)))+
        labs(x = &quot;birth cohort&quot;, y = &quot;height, cm&quot;)+
        theme_few(base_size = 15, base_family = &quot;mono&quot;)+
        theme(legend.position = &quot;none&quot;, 
              panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i1.wp.com/ikashnitsky.github.io/images/170507/fig-04-height-by-country.png?ssl=1"><img alt="fig4" src="https://i1.wp.com/ikashnitsky.github.io/images/170507/fig-04-height-by-country.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 4. The height of ice hockey players by nations</strong></p>
<p>The last model indicates that from one birth cohort cohort to the other the height of ice hockey players increases 0.08 cm. That means an increase of 0.8 cm in a decade or a growth of 2.56 cm in the 32 years between 1964 and 1996. It is worth mentioning that once we run the analysis in cohorts and controlling for positions and nations, the speed of the player’s height increase becomes much humbler than in the crude pulled analysis (Figure 1): 0.8 cm per decade compared to 1.2 cm per decade.</p>
<p>Before we go further and compare the growth in player’s height to that of the population, let’s do the modeling separately for defenders, goalkeepers, and forwards. The exploratory plot (Figure 5) suggests that the correlation is stronger for goalkeepers and weaker for defenders.</p>
<div>
<pre><code>dfuc_pos &lt;- dfuc
levels(dfuc_pos$position) &lt;- c(&quot;Defenders&quot;, &quot;Forwards&quot;, &quot;Goalkeeprs&quot;)

gg_pos &lt;- ggplot(dfuc_pos , aes(x = cohort, y = av.height))+
        geom_jitter(aes(color = position), alpha = .5, size = 2)+
        stat_smooth(method = &quot;lm&quot;, se = T, color = brbg11[11], size = 1)+
        scale_x_continuous(labels = seq(1970, 1990, 10), breaks = seq(1970, 1990, 10))+
        scale_color_manual(values = brbg11[c(8, 9, 10)])+
        facet_wrap(~position, ncol = 3)+
        xlab(&quot;birth cohort&quot;)+
        ylab(&quot;height, cm&quot;)+
        theme_few(base_size = 15, base_family = &quot;mono&quot;)+
        theme(legend.position = &quot;none&quot;, 
              panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-05-corr-by-pos.png?ssl=1"><img alt="fig5" src="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-05-corr-by-pos.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 5. Correlation between height and birth cohort by position</strong></p>
<div>
<pre><code># separate models for positions
m3d &lt;- lm(data = dfuc %>% filter(position == &quot;D&quot;), av.height~cohort+country)
m3f &lt;- lm(data = dfuc %>% filter(position == &quot;F&quot;), av.height~cohort+country)
m3g &lt;- lm(data = dfuc %>% filter(position == &quot;G&quot;), av.height~cohort+country)
htmlreg(list(m3d, m3f, m3g), file = &quot;models_height_pos.html&quot;, single.row = T, 
        custom.model.names = c(&quot;Model 3 D&quot;, &quot;Model 3 F&quot;, &quot;Model 3 G&quot;))
</code></pre>
</div>
<p><strong>Table 3. Model 3 – separately for defenders, forwards, and goalkeepers</strong></p>

<table>
<tr>
<th></th>
<th>Model 3 D</th>
<th>Model 3 F</th>
<th>Model 3 G</th>
</tr>
<tr>
<td>(Intercept)</td>
<td>108.45 (46.46)*</td>
<td>49.32 (36.73)</td>
<td>-295.76 (74.61)***</td>
</tr>
<tr>
<td>cohort</td>
<td>0.04 (0.02)</td>
<td>0.07 (0.02)***</td>
<td>0.24 (0.04)***</td>
</tr>
<tr>
<td>countryAUT</td>
<td>0.14 (0.96)</td>
<td>-2.01 (0.75)**</td>
<td>0.47 (1.47)</td>
</tr>
<tr>
<td>countryBLR</td>
<td>0.30 (0.87)</td>
<td>-1.53 (0.73)*</td>
<td>-2.73 (1.55)</td>
</tr>
<tr>
<td>countryCAN</td>
<td>1.55 (0.78)*</td>
<td>0.39 (0.62)</td>
<td>3.45 (1.26)**</td>
</tr>
<tr>
<td>countryCZE</td>
<td>0.87 (0.84)</td>
<td>0.30 (0.67)</td>
<td>0.63 (1.36)</td>
</tr>
<tr>
<td>countryDEN</td>
<td>-0.60 (0.95)</td>
<td>0.10 (0.75)</td>
<td>-0.19 (1.62)</td>
</tr>
<tr>
<td>countryFIN</td>
<td>-0.55 (0.89)</td>
<td>-0.04 (0.67)</td>
<td>2.40 (1.32)</td>
</tr>
<tr>
<td>countryFRA</td>
<td>-3.34 (1.15)**</td>
<td>-2.06 (0.93)*</td>
<td>1.39 (2.07)</td>
</tr>
<tr>
<td>countryGER</td>
<td>0.48 (0.85)</td>
<td>-1.40 (0.72)</td>
<td>-0.65 (1.33)</td>
</tr>
<tr>
<td>countryHUN</td>
<td>-1.32 (1.47)</td>
<td>-0.70 (1.16)</td>
<td>0.65 (2.39)</td>
</tr>
<tr>
<td>countryITA</td>
<td>-2.08 (1.08)</td>
<td>-4.78 (0.82)***</td>
<td>-2.02 (1.62)</td>
</tr>
<tr>
<td>countryJPN</td>
<td>-4.13 (1.26)**</td>
<td>-6.52 (0.94)***</td>
<td>-2.27 (1.98)</td>
</tr>
<tr>
<td>countryKAZ</td>
<td>-1.23 (0.95)</td>
<td>-1.82 (0.79)*</td>
<td>1.79 (1.58)</td>
</tr>
<tr>
<td>countryLAT</td>
<td>-0.73 (0.95)</td>
<td>-1.39 (0.75)</td>
<td>-3.42 (1.49)*</td>
</tr>
<tr>
<td>countryNOR</td>
<td>-3.25 (1.07)**</td>
<td>-1.06 (0.85)</td>
<td>-0.10 (1.66)</td>
</tr>
<tr>
<td>countryPOL</td>
<td>0.82 (1.89)</td>
<td>-0.58 (1.55)</td>
<td>0.37 (2.97)</td>
</tr>
<tr>
<td>countrySLO</td>
<td>-1.57 (0.99)</td>
<td>-1.54 (0.79)</td>
<td>-2.25 (1.66)</td>
</tr>
<tr>
<td>countrySUI</td>
<td>-1.98 (0.91)*</td>
<td>-2.36 (0.71)***</td>
<td>1.12 (1.47)</td>
</tr>
<tr>
<td>countrySVK</td>
<td>2.94 (0.87)***</td>
<td>0.81 (0.67)</td>
<td>-0.70 (1.50)</td>
</tr>
<tr>
<td>countrySWE</td>
<td>0.75 (0.81)</td>
<td>1.24 (0.65)</td>
<td>1.37 (1.33)</td>
</tr>
<tr>
<td>countryUKR</td>
<td>-1.37 (1.01)</td>
<td>-1.77 (0.80)*</td>
<td>-3.71 (1.66)*</td>
</tr>
<tr>
<td>countryUSA</td>
<td>0.76 (0.78)</td>
<td>-0.08 (0.62)</td>
<td>2.58 (1.26)*</td>
</tr>
<tr>
<td>R2</td>
<td>0.09</td>
<td>0.10</td>
<td>0.24</td>
</tr>
<tr>
<td>Adj. R2</td>
<td>0.07</td>
<td>0.09</td>
<td>0.20</td>
</tr>
<tr>
<td>Num. obs.</td>
<td>1094</td>
<td>1824</td>
<td>401</td>
</tr>
<tr>
<td>RMSE</td>
<td>5.08</td>
<td>5.08</td>
<td>4.87</td>
</tr>
</table>
<p>The separate modeling shows that the average height of ice hockey players, that were born in 1964-1996 and participated in the world championships in 2001–2016, increased with the speed of 0.4 cm per decade for defenders, 0.7 cm – for forwards, and (!) 2.4 cm – for goalies. In three decades the average height of the goalkeepers increased by 7 cm!</p>
<p>Finally, let’s compare these dynamics with those in the population.</p>
<h1>Compare to population</h1>
<p>Our previous results expose significant height differences between players of various nations. Thus, it is reasonable to compare ice hockey players’ height to the corresponding male population of their countries.</p>
<p>For the data on the height of males in population in the corresponding nations I used the <a target="_blank" rel="nofollow" href="https://dx.doi.org/10.1016/j.ehb.2010.03.001">relevant scientific paper</a>. I grabbed the data from the paper PDF using a nice little tool – <a target="_blank" rel="nofollow" href="http://tabula.technology/">tabula</a> – and also <a target="_blank" rel="nofollow" href="https://dx.doi.org/10.6084/m9.figshare.3394795.v1">deposited on figshare</a>.</p>
<div>
<pre><code># download the data from Hatton, T. J., &amp; Bray, B. E. (2010).
# Long run trends in the heights of European men, 19th–20th centuries.
# Economics &amp; Human Biology, 8(3), 405–413.
# http://doi.org/10.1016/j.ehb.2010.03.001
# stable URL, copied data (https://dx.doi.org/10.6084/m9.figshare.3394795.v1)

df_hb &lt;- read.csv(&quot;https://ndownloader.figshare.com/files/5303878&quot;) 

df_hb &lt;- df_hb %>%
        gather(&quot;country&quot;, &quot;h_pop&quot;, 2:16) %>%
        mutate(period = paste(period)) %>%
        separate(period, c(&quot;t1&quot;, &quot;t2&quot;), sep = &quot;/&quot;)%>%
        transmute(cohort = (as.numeric(t1)+as.numeric(t2))/2, country, h_pop)

# calculate hockey players' cohort height averages for each country
df_hoc &lt;- dfu %>% group_by(country, cohort) %>%
        summarise(h_hp = mean(av.height)) %>%
        ungroup()
</code></pre>
</div>
<p>Unfortunately, our dataset on ice hockey players intersects with the data on population only for 8 countries: Austria, Denmark, Finland, France, Germany, Italy, Norway, and Sweden.</p>
<div>
<pre><code># countries in both data sets
both_cnt &lt;- levels(factor(df_hb$country))[which(levels(factor(df_hb$country)) %in% levels(df_hoc$country))]
both_cnt
</code></pre>
</div>
<div>
<pre><code>gg_hoc_vs_pop &lt;- ggplot()+
        geom_path(data = df_hb %>% filter(country %in% both_cnt), 
                  aes(x = cohort, y = h_pop), 
                  color = brbg11[9], size = 1)+
        geom_point(data = df_hb %>% filter(country %in% both_cnt), 
                   aes(x = cohort, y = h_pop), 
                   color = brbg11[9], size = 2)+
        geom_point(data = df_hb %>% filter(country %in% both_cnt), 
                   aes(x = cohort, y = h_pop), 
                   color = &quot;white&quot;, size = 1.5)+
        geom_point(data = df_hoc %>% filter(country %in% both_cnt), 
                   aes(x = cohort, y = h_hp), 
                   color = brbg11[3], size = 2, pch = 18)+
        stat_smooth(data = df_hoc %>% filter(country %in% both_cnt), 
                    aes(x = cohort, y = h_hp), 
                    method = &quot;lm&quot;, se = F, color = brbg11[1], size = 1)+
        facet_wrap(~country, ncol = 2)+
        labs(y = &quot;height, cm&quot;, x = &quot;birth cohort&quot;)+
        theme_few(base_size = 20, base_family = &quot;mono&quot;)+
        theme(panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i2.wp.com/ikashnitsky.github.io/images/170507/fig-06-players-vs-population.png?ssl=1"><img alt="fig6" src="https://i2.wp.com/ikashnitsky.github.io/images/170507/fig-06-players-vs-population.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 6. The comparison of height dynamics in ice hockey players (brown) and the corresponding male populations (green)</strong></p>
<p>In all the analyzed countries, ice hockey players are 2-5 cm higher that the nation’s average. This is not very surprising since we expect some selection in sport. What is more interesting, in the developed countries the rapid increase in the height of males mostly leveled off in the birth cohorts of 1960s. Unlike the population trend, the height of ice hockey players continued to increase with roughly the same pace in all the analyzed countries except for Denmark.</p>
<p>For the cohorts of Europeans that were born in first half of 20-th century, the height of males increased by 1.18–1.74 cm per decade (Figure 7, middle panel). Starting from the birth cohorts of 1960s, the pace decreased to 0.15–0.80 per decade.</p>
<div>
<pre><code># growth in population

df_hb_w &lt;- df_hb %>% spread(cohort, h_pop) 
names(df_hb_w)[2:26] &lt;- paste(&quot;y&quot;, names(df_hb_w)[2:26])

diffs &lt;- df_hb_w[, 3:26]-df_hb_w[, 2:25]

df_hb_gr&lt;- df_hb_w %>%
        transmute(country, 
                  gr_1961_1980 = unname(apply(diffs[, 22:24], 1, mean, na.rm = T))*2, 
                  gr_1901_1960 = unname(apply(diffs[, 9:21], 1, mean, na.rm = T))*2, 
                  gr_1856_1900 = unname(apply(diffs[, 1:8], 1, mean, na.rm = T))*2) %>%
        gather(&quot;period&quot;, &quot;average_growth&quot;, 2:4) %>%
        filter(country %in% both_cnt) %>%
        mutate(country = factor(country, levels = rev(levels(factor(country)))), 
               period = factor(period, labels = c(&quot;1856-1900&quot;, &quot;1901-1960&quot;, &quot;1961-1980&quot;)))


gg_hb_growth &lt;- ggplot(df_hb_gr, aes(x = average_growth, y = country))+
        geom_point(aes(color = period), size = 3)+
        scale_color_manual(values = brbg11[c(8, 3, 10)])+
        scale_x_continuous(limits = c(0, 2.15))+
        facet_wrap(~period)+
        theme_few()+
        xlab(&quot;average growth in men's height over 10 years, cm&quot;)+
        ylab(NULL)+
        theme_few(base_size = 20, base_family = &quot;mono&quot;)+
        theme(legend.position = &quot;none&quot;, 
              panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i2.wp.com/ikashnitsky.github.io/images/170507/fig-07-av-growth-pop.png?ssl=1"><img alt="fig7" src="https://i2.wp.com/ikashnitsky.github.io/images/170507/fig-07-av-growth-pop.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 7. Average changes in male population</strong></p>
<p>The height increase for ice hockey players seems quite impressive if we compare it to the stagnating dynamics in the corresponding male populations. And the acceleration of goalkeepers’ height is outright amazing.</p>
<p>The diverging trends in the height of ice hockey players and normal population is likely to be driven by the strengthening selection in sport.</p>
<h1>Selection in ice hockey</h1>
<p>Looking through the literature on the selection in sport, I saw <a target="_blank" rel="nofollow" href="https://dx.doi.org/10.1080/02640410600908001">the finding</a> that showed a notable disproportion of professional sportsmen by the month of birth. There are much more sportsmen that were born in the first half of the year. They have a lasting advantage since the kids teams are usually formed by birth cohorts. Thus, those born earlier in the year always have a bit more time lived compared to their later born team mates, which means that they are physically more mature. It is easy to test the finding on our ice hockey players dataset.</p>
<div>
<pre><code># check if there are more players born in earlier months
df_month &lt;- df %>% mutate(month = month(birth)) %>%
        mutate(month = factor(month))

gg_month &lt;- ggplot(df_month, aes(x = factor(month)))+
        geom_bar(stat = &quot;count&quot;, fill = brbg11[8])+
        scale_x_discrete(breaks = 1:12, labels = month.abb)+
        labs(x = &quot;month of birth&quot;, y = &quot;# of players&quot;)+
        theme_few(base_size = 20, base_family = &quot;mono&quot;)+
        theme(legend.position = &quot;none&quot;, 
              panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-08-month-selectivity.png?ssl=1"><img alt="fig8" src="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-08-month-selectivity.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 8. The distribution of ice hockey players by month of birth</strong></p>
<p>True, the distribution is notably skewed – there are much more players born in earlier months. When I further split the dataset by the decades of birth, it becomes clear that the effect becomes more evident with time (Figure 9). Indirectly, that means that the selection in ice hockey becomes tougher.</p>
<div>
<pre><code># facet by decades
df_month_dec &lt;- df_month %>%
        mutate(dec = substr(paste(cohort), 3, 3) %>% 
                       factor(labels = paste(&quot;born in&quot;, c(&quot;1960s&quot;, &quot;1970s&quot;, &quot;1980s&quot;, &quot;1990s&quot;))))

gg_month_dec &lt;- ggplot(df_month_dec, aes(x = factor(month)))+
        geom_bar(stat = &quot;count&quot;, fill = brbg11[8])+
        scale_x_discrete(breaks = 1:12, labels = month.abb)+
        labs(x = &quot;month of birth&quot;, y = &quot;# of players&quot;)+
        facet_wrap(~dec, ncol = 2, scales = &quot;free&quot;)+
        theme_few(base_size = 20, base_family = &quot;mono&quot;)+
        theme(legend.position = &quot;none&quot;, 
              panel.grid = element_line(colour = &quot;grey75&quot;, size = .25))
</code></pre>
</div>
<p><a target="_blank" rel="nofollow" href="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-09-month-selectivity-decades.png?ssl=1"><img alt="fig9" src="https://i0.wp.com/ikashnitsky.github.io/images/170507/fig-09-month-selectivity-decades.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p><strong>Figure 9. The distribution of ice hockey players by month of birth – separately by decades of birth</strong></p>
<h1>Reproducibility</h1>
<p>The full R script can be downloaded <a target="_blank" rel="nofollow" href="https://dx.doi.org/10.6084/m9.figshare.3395983.v2">here</a>.</p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://ikashnitsky.github.io/2017/ice-hockey-players-height/"> Ilya Kashnitsky</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/3fLoAJi_9Q4"></a></div>