<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/tennis-grand-slam-tournaments-champions-basic-analysis/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://datascienceplus.com/tennis-grand-slam-tournaments-champions-basic-analysis/"> R Programming – DataScience+</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>The present tutorial analyses the Tennis Grand Slam tournaments main results from the statistical point of view. Specifically, I try to answer the following questions:</p>
<blockquote>
<p>
– How to fit the distribution of the Grand Slam tournaments number of victories across players?<br>
– How to compute the probability of having player’s victories greater than a specific number?<br>
– How the number of Grand Slam tournaments winners increases along with time?<br>
– How can we assign a metric to the tennis players based on the number of Grand Slam tournaments they won?</p>
</blockquote>
<p>Our dataset is provided within ref. [1], whose content is based on what reported by the ESP site at: <a rel="nofollow" href="http://www.espn.com/tennis/history" target="_blank">ESPN site tennis history table</a>.</p>
<h3>Packages</h3>
<pre>
suppressPackageStartupMessages(library(fitdistrplus))
suppressPackageStartupMessages(library(extremevalues))
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(knitr))
suppressPackageStartupMessages(library(ggplot2))
</pre>
<h2>Analysis</h2>
<p>The analysis within the present tutorial is organized as follows:</p>
<ul>
<li>a basic data exploration is run</li>
<li>log-normal distribution is fit against the Grand Slam tournaments victories data</li>
<li>regression analysis is presented in order to evaluate the increase of tennis Grand Slam champions along with time</li>
<li>population statistical dispersion is evaluated to determine a Tennis Quotient assigned to tournaments’ winners</li>
</ul>
<h3>Basic Data Exploration</h3>
<p>Loading the Tennis Grand Slam tournaments dataset and running a basic data exploration.</p>
<pre>
url_file &lt;- &quot;https://datascienceplus.com/wp-content/uploads/2017/12/tennis-grand-slam-winners_end2017.txt&quot;
slam_win &lt;- read.delim(url(url_file), sep=&quot;\t&quot;, stringsAsFactors = FALSE)
dim(slam_win)
<em>[1] 489 4</em>
</pre>
<pre>
kable(head(slam_win), row.names=FALSE)
<em>| YEAR|TOURNAMENT |WINNER |RUNNER.UP |
|----:|:---------------|:-------------|:--------------|
| 2017|U.S. Open |Rafael Nadal |Kevin Anderson |
| 2017|Wimbledon |Roger Federer |Marin Cilic |
| 2017|French Open |Rafael Nadal |Stan Wavrinka |
| 2017|Australian Open |Roger Federer |Rafael Nadal |
| 2016|U.S. Open |Stan Wawrinka |Novak Djokovic |
| 2016|Wimbledon |Andy Murray |Milos Raonic |
</em>
</pre>
<pre>
kable(tail(slam_win), row.names=FALSE)
<em>| YEAR|TOURNAMENT |WINNER |RUNNER.UP |
|----:|:----------|:----------------|:------------------|
| 1881|U.S. Open |Richard D. Sears |William E. Glyn |
| 1881|Wimbledon |William Renshaw |John Hartley |
| 1880|Wimbledon |John Hartley |Herbert Lawford |
| 1879|Wimbledon |John Hartley |V. St. Leger Gould |
| 1878|Wimbledon |Frank Hadow |Spencer Gore |
| 1877|Wimbledon |Spencer Gore |William Marshall |
</em>
</pre>
<pre>
nr &lt;- nrow(slam_win)
start_year &lt;- slam_win[nr, &quot;YEAR&quot;]
end_year &lt;- slam_win[1, &quot;YEAR&quot;]
(years_span &lt;- end_year - start_year + 1)
<em>[1] 141
</em>
</pre>
<pre>
(total_slam_winners &lt;- length(unique(slam_win[,&quot;WINNER&quot;])))
<em>[1] 166
</em>
</pre>
<p>So we have 166 winners spanning over 141 years of Tennis Grand Slam tournaments. We observe that during first and second World Wars, a reduced number of Grand Slam tournaments were played for obvious reasons.</p>
<pre>
slam_win_df &lt;- as.data.frame(table(slam_win[,&quot;WINNER&quot;]))
slam_win_df =  slam_win_df %>% arrange(desc(Freq))
# computing champions' leaderboard position
pos &lt;- rep(0, nrow(slam_win_df))
pos[1] &lt;- 1
for(i in 2:nrow(slam_win_df)) {
  pos[i] &lt;- ifelse(slam_win_df$Freq[i] != slam_win_df$Freq[i-1], i, pos[i-1])
}
last_win_year = sapply(slam_win_df$Var1, function(x) {slam_win %>% filter(WINNER == x) %>% dplyr::select(YEAR) %>% max()})
# creating and showing leaderboard dataframe
slam_winners &lt;- data.frame(RANK = pos,
                           PLAYER = slam_win_df$Var1,
                           WINS = slam_win_df$Freq,
                           LAST_WIN_YEAR = last_win_year)
kable(slam_winners)
<em>| RANK|PLAYER | WINS| LAST_WIN_YEAR|
|----:|:---------------------------|----:|-------------:|
| 1|Roger Federer | 19| 2017|
| 2|Rafael Nadal | 16| 2017|
| 3|Pete Sampras | 14| 2002|
| 4|Novak Djokovic | 12| 2016|
| 4|Roy Emerson | 12| 1967|
...
</em>
</pre>
<p>The WINS and log(WINS) distribution density are shown.</p>
<pre>
par(mfrow=c(1,2))
plot(density(slam_winners$WINS), main = &quot;Wins Density&quot;)
plot(density(log(slam_winners$WINS)), main = &quot;Log Wins Density&quot;)
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/wins_density.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/wins_density.png?w=450&ssl=1" alt="" class="wp-image-9785" data-recalc-dims="1"></a></p>
<p>You may want to arrange the same dataframe ordering by the champions’ last win year.</p>
<pre>
par(mfrow=c(1,1))
slam_winners_last_win_year = slam_winners %>% arrange(LAST_WIN_YEAR)
kable(slam_winners %>% arrange(desc(LAST_WIN_YEAR)))
<em>| RANK|PLAYER | WINS| LAST_WIN_YEAR|
|----:|:---------------------------|----:|-------------:|
| 1|Roger Federer | 19| 2017|
| 2|Rafael Nadal | 16| 2017|
| 4|Novak Djokovic | 12| 2016|
| 43|Andy Murray | 3| 2016|
...
</em>
</pre>
<p>We may want to visualize the timeline of the number of Tennis Grand Slam champions.</p>
<pre>
df_nwin = data.frame()
for (year in start_year : end_year) {
  n_slam_winners = slam_win %>% filter(YEAR &lt;= year) %>% dplyr::select(WINNER) %>% unique %>% nrow
  df_nwin = rbind(df_nwin, data.frame(YEAR = year, N_WINNERS = n_slam_winners))
}
plot(x = df_nwin$YEAR, y = df_nwin$N_WINNERS, type ='s', xlab = &quot;year&quot;, ylab = &quot;no_winners&quot;)
grid()
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2017/12/no_winners_by_year.png?ssl=1" target="_blank"><img sizes="(max-width: 1295px) 100vw, 1295px" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2017/12/no_winners_by_year.png?w=450&ssl=1" alt="" class="wp-image-9748" data-recalc-dims="1"></a></p>
<p>We may want to visualize the timeline of the Grand Slam tournaments wins record.</p>
<pre>
df2_nwin = data.frame()
for (year in start_year : end_year) {
  slam_win_years = slam_win %>% filter(YEAR &lt;= year)
  slam_win_record = as.data.frame(table(slam_win_years[,&quot;WINNER&quot;]))
  df2_nwin = rbind(df2_nwin, data.frame(YEAR = year, RECORD_WINS = max(slam_win_record$Freq)))
}
plot(x = df2_nwin$YEAR, y = df2_nwin$RECORD_WINS, type ='s', xlab = &quot;year&quot;, ylab = &quot;record_wins&quot;)
grid()
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/record_wins_fix.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/record_wins_fix.png?w=450&ssl=1" alt="" class="wp-image-9844" data-recalc-dims="1"></a></p>
<p>It is interesting to have a look at the number of wins frequency.</p>
<pre>
wins_frequency &lt;- as.data.frame(table(slam_winners[,&quot;WINS&quot;]))
colnames(wins_frequency) &lt;- c(&quot;WINS&quot;, &quot;FREQUENCY&quot;)
kable(wins_frequency)
<em>|WINS | FREQUENCY|
|:----|---------:|
|1 | 80|
|2 | 25|
|3 | 19|
|4 | 12|
|5 | 5|
|6 | 3|
|7 | 6|
|8 | 8|
|10 | 1|
|11 | 2|
|12 | 2|
|14 | 1|
|16 | 1|
|19 | 1|
</em>
</pre>
<pre>
summary(slam_winners[,&quot;WINS&quot;])
<em>Min. 1st Qu. Median Mean 3rd Qu. Max. 1.000 1.000 2.000 2.946 3.750 19.000 </em>
</pre>
<h3>Probabilistic Distribution Fit</h3>
<p>We now take advantage of the <code>fitdist()</code> function within the <code>fitdistr</code> package to fit a lognormal distribution for our Grand Slam wins data.</p>
<pre>
fw &lt;- fitdist(slam_winners$WINS, &quot;lnorm&quot;)
summary(fw)
<em>Fitting of the distribution ' lnorm ' by maximum likelihood Parameters : estimate Std. Error
meanlog 0.7047927 0.06257959
sdlog 0.8062817 0.04425015
Loglikelihood: -316.7959 AIC: 637.5918 BIC: 643.8158 Correlation matrix:
meanlog sdlog
meanlog 1 0
sdlog 0 1
</em>
</pre>
<p>Then we can plot the distribution fit results.</p>
<pre>
plot(fw)
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/fitdistr.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/fitdistr.png?w=450&ssl=1" alt="" class="wp-image-9751" data-recalc-dims="1"></a></p>
<pre>
# left outliers quantile
left_thresh &lt;- 0.05 
# right outliers quantile
right_thresh &lt;- 0.95
# determining the outliers
slam_outlier &lt;- getOutliersI(as.vector(slam_winners$WINS), 
                             FLim = c(left_thresh, right_thresh), 
                             distribution = &quot;lognormal&quot;)
# outliers are plotted in red color
outlierPlot(slam_winners$WINS, slam_outlier, mode=&quot;qq&quot;)
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/outlierplot.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/outlierplot.png?w=450&ssl=1" alt="" class="wp-image-9752" data-recalc-dims="1"></a></p>
<p>The outliers are:</p>
<pre>
slam_winners[slam_outlier$iRight,]
<em> RANK PLAYER WINS LAST_WIN_YEAR
1 1 Roger Federer 19 2017
2 2 Rafael Nadal 16 2017
</em>
</pre>
<p>The mean and standard deviation associated to the log-normal fit are:</p>
<pre>
(mean_log &lt;- fw$estimate[&quot;meanlog&quot;])
<em>meanlog 0.7047927 </em>
</pre>
<pre>
(sd_log &lt;- fw$estimate[&quot;sdlog&quot;])
<em>sdlog 0.8062817
</em>
</pre>
<p>Now we compute the probability associated with 19 and 16 wins.</p>
<pre>
# clearing names
names(mean_log) &lt;- NULL
names(sd_log) &lt;- NULL
# probability associated to 19 wins performance or more
(lnorm_19 &lt;- plnorm(19, mean_log, sd_log, lower.tail=FALSE))
<em>[1] 0.002736863
</em>
</pre>
<pre>
# probability associated to 16 wins performance or more
(lnorm_16 &lt;- plnorm(16, mean_log, sd_log, lower.tail=FALSE))
<em>[1] 0.005164628
</em>
</pre>
<p>However, if a random variable follows a log-normal distribution, its logarithm follows a normal distribution. Hence we fit the logarithm of the variable under analysis using a normal distribution and compare the results with above log-normal fit.</p>
<pre>
fw_norm &lt;- fitdist(log(slam_winners$WINS), &quot;norm&quot;)
summary(fw_norm)
<em>Fitting of the distribution ' norm ' by maximum likelihood Parameters : estimate Std. Error
mean 0.7047927 0.06257959
sd 0.8062817 0.04425015
Loglikelihood: -199.8003 AIC: 403.6006 BIC: 409.8246 Correlation matrix:
mean sd
mean 1 0
sd 0 1
</em>
</pre>
<p>Similarly, we plot the fit results.</p>
<pre>
plot(fw_norm)
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/fitdistr_norm.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/fitdistr_norm.png?w=450&ssl=1" alt="" class="wp-image-9763" data-recalc-dims="1"></a></p>
<pre>
# left outliers quantile
left_thresh &lt;- 0.05 
# right outliers quantile
right_thresh &lt;- 0.95
slam_outlier &lt;- getOutliersI(log(as.vector(slam_winners$WINS)), 
                             FLim = c(left_thresh, right_thresh), 
                             distribution = &quot;normal&quot;)
outlierPlot(slam_winners$WINS, slam_outlier, mode=&quot;qq&quot;)
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2017/12/outlierplot_norm.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2017/12/outlierplot_norm.png?w=450&ssl=1" alt="" class="wp-image-9764" data-recalc-dims="1"></a></p>
<p>The outliers are:</p>
<pre>
slam_winners[slam_outlier$iRight,]
<em> RANK PLAYER WINS LAST_WIN_YEAR
1 1 Roger Federer 19 2017
2 2 Rafael Nadal 16 2017
</em>
</pre>
<p>The mean and standard deviation values are:</p>
<pre>
# mean and standard deviation of the fitted lognormal distribution
(mean_norm &lt;- fw_norm$estimate[&quot;mean&quot;])
<em>mean 0.7047927
</em>
</pre>
<pre>
(sd_norm &lt;- fw_norm$estimate[&quot;sd&quot;])
<em> sd 0.8062817 </em>
</pre>
<p>As we can see above, same fitting parameters result from the two approaches, even though with different log-likelihood, AIC and BIC metrics. Now we compute the probability associated to 19 and 16 wins together with their distance from the mean in terms of multiples of the standard deviation.</p>
<pre>
# clearing names
names(mean_norm) &lt;- NULL
names(sd_norm) &lt;- NULL
# probability associated to the 19 wins performance or better
(norm_19 &lt;- pnorm(log(19), mean_norm, sd_norm, lower.tail=FALSE))
<em>[1] 0.002736863
</em>
</pre>
<pre>
# standard deviation times from the mean associated to 19 wins
(deviation_19 &lt;- (log(19) - mean_norm)/sd_norm)
<em>
[1] 2.777747
</em>
</pre>
<pre>
# probability associated to the 16 wins performance or better
(norm_16 &lt;- pnorm(log(16), mean_norm, sd_norm, lower.tail=FALSE))
<em>
[1] 0.005164628
</em>
</pre>
<pre>
# standard deviation times from the mean associated to 16 wins
(deviation_16 &lt;- (log(16) - mean_norm)/sd_norm)
<em>
[1] 2.564608
</em>
</pre>
<p>As we can see above, we also obtained the same probability value as resulting from the log-normal distribution fit. In the following, we consider the second fitting approach (the one which takes the log of the original variable) for easing the computation of the distance from the mean in terms of multiples of the standard deviation.</p>
<h2>Regression Analysis</h2>
<p>Let us see again the plot of the number of tennis Grand Slam winners against their timeline.</p>
<pre>
year &lt;- df_nwin $YEAR
winners &lt;- df_nwin$N_WINNERS
plot(x = year, y = winners, type ='l')
grid()
</pre>
<p>Gives this plot:<br>
<a rel="nofollow" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2017/12/winners_per_year.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2017/12/winners_per_year.png?w=450&ssl=1" alt="" class="wp-image-9768" data-recalc-dims="1"></a></p>
<p>It is visually evident the linear relationship between the variables. Hence, a linear regression would help in understanding how many newbie Grand Slam winners we may have each year.</p>
<pre>
year_lm &lt;- lm(winners ~ year)
summary(year_lm)
<em>Call:
lm(formula = winners ~ year)
Residuals:
Min 1Q Median 3Q Max -9.8506 -1.9810 -0.4683 2.6102 6.2866 Coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept) -2.388e+03 1.220e+01 -195.8 &lt;2e-16 ***
year 1.270e+00 6.264e-03 202.8 &lt;2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.027 on 139 degrees of freedom
Multiple R-squared: 0.9966,	Adjusted R-squared: 0.9966 F-statistic: 4.113e+04 on 1 and 139 DF, p-value: &lt; 2.2e-16
</em>
</pre>
<p>Coefficients are reported as significant and the R-squared value is very high. On average each year, 1.27 Grand Slam tournaments newbie winners show up. Residuals analysis has not been reported for brevity. Similarly, we can regress the year against the number of winners.</p>
<pre>
n_win_lm &lt;- lm(year ~ winners)
summary(n_win_lm)
<em>Call:
lm(formula = year ~ winners)
Residuals:
Min 1Q Median 3Q Max -4.8851 -1.9461 0.3268 1.4327 7.9641 Coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept) 1.880e+03 3.848e-01 4886.4 &lt;2e-16 ***
winners 7.846e-01 3.868e-03 202.8 &lt;2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.379 on 139 degrees of freedom
Multiple R-squared: 0.9966,	Adjusted R-squared: 0.9966 F-statistic: 4.113e+04 on 1 and 139 DF, p-value: &lt; 2.2e-16
</em>
</pre>
<p>Coefficients are reported as significant and the R-squared value is very high. On average, each new Grand Slam tournaments winner appears every 0.7846 fraction of year. Residuals analysis has not been reported for brevity. Such model can be used to predict the year when a given number of Grand Slam winners may show up. For example, considering Federer, Nadal and Sampras wins, we obtain:</p>
<pre>
# probability associated to the 14 wins performance or better
(norm_14 &lt;- pnorm(log(14), mean_norm, sd_norm, lower.tail=FALSE))
<em>[1] 0.008220098
</em>
</pre>
<pre>
# standard deviation times from the mean associated to 14 wins
(deviation_14 &lt;- (log(14) - mean_norm)/sd_norm)
<em>[1] 2.398994
</em>
</pre>
<pre>
# average number of Grand Slam winners to expect for a 19 Grand Slam wins champion
(x_19 &lt;- round(1/norm_19))
<em>[1] 365
</em>
</pre>
<pre>
# average number of Grand Slam winners to expect for a 16 Grand Slam wins champion
(x_16 &lt;- round(1/norm_16))
<em>[1] 194
</em>
</pre>
<pre>
# average number of Grand Slam winners to expect for a 14 Grand Slam wins champion
(x_14 &lt;- round(1/norm_14))
<em>[1] 122
</em>
</pre>
<p>The x_19, x_16 and x_14 values can be interpreted as the average size of Grand Slam tournaments winners population to therein find a 19, 16, 14 times winner respectively. As a consequence, the prediction of the calendar years to see players capable to win 19, 16, 14 times is:</p>
<pre>
predict(n_win_lm, newdata = data.frame(winners = c(x_19, x_16, x_14)), interval = &quot;p&quot;)
<em> fit lwr upr
1 2166.732 2161.549 2171.916
2 2032.573 2027.779 2037.366
3 1976.084 1971.355 1980.813
</em>
</pre>
<p>The table above shows the earliest year when, on average, to expect a Grand Slam tournament winner capable to win 19, 16, 14 times (fit column), together with lower (lwr) and upper (upr) bound predicted values. In the real world, 14 wins champion showed up a little bit later than expected by our linear regression model, whilst 16 and 19 win champions did much earlier than expected by the same model.</p>
<h3>Population Statistical Dispersion Analysis</h3>
<p>In our previous analysis, we computed the distance from the mean for 19, 16 and 14 Grand Slam tournaments win probabilities, distance expressed in terms of multiples of the standard deviation.</p>
<pre>
deviation_19
<em>[1] 2.777747
</em>
</pre>
<pre>
deviation_16
<em>[1] 2.564608
</em>
</pre>
<pre>
deviation_14
<em>[1] 2.398994
</em>
</pre>
<p>Based on above values, we can compute the probability to have a 19, 16 and 14 times winner. As we saw before, we resume up such result using the <code>pnorm()</code> function.</p>
<pre>
(prob_19 &lt;- pnorm(mean_norm+deviation_19*sd_norm, mean_norm, sd_norm, lower.tail = FALSE))
<em>[1] 0.002736863
</em>
</pre>
<pre>
(prob_16 &lt;- pnorm(mean_norm+deviation_16*sd_norm, mean_norm, sd_norm, lower.tail = FALSE))
<em>[1] 0.005164628
</em>
</pre>
<pre>
(prob_14 &lt;- pnorm(mean_norm+deviation_14*sd_norm, mean_norm, sd_norm, lower.tail = FALSE))
<em>[1] 0.008220098
</em>
</pre>
<p>Similarly to the Intellectual Quotient (IQ) assigning a value equal to 100 at the mean and +/- 15 points for each standard deviation of distance from the mean itself, we can figure out a Tennis Quotient (TQ). </p>
<p>Here in below, we show a plot to remember how the IQ is computed:<br>
<a rel="nofollow" href="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/iq-score-and-normal-distribution.png?ssl=1" target="_blank"><img sizes="(max-width: 856px) 100vw, 856px" src="https://i1.wp.com/datascienceplus.com/wp-content/uploads/2017/12/iq-score-and-normal-distribution.png?w=450&ssl=1" alt="" class="wp-image-9777" data-recalc-dims="1"></a></p>
<p>We notice that the median of our player’s population scores a TQ equal to 100.</p>
<pre>
(median_value &lt;- median(slam_winners$WINS))
<em>[1] 2
</em>
</pre>
<pre>
(deviation_median &lt;- (log(median_value) - mean_norm)/sd_norm)
<em>[1] -0.01444343
</em>
</pre>
<pre>
round(100 + 15*deviation_median)
<em>[1] 100
</em>
</pre>
<p>We now compute the Tennis Quotients (TQ) for leading champions.</p>
<pre>
(Federer_TQ &lt;- round(100 + 15*deviation_19))
<em>[1] 142
</em>
</pre>
<pre>
(Nadal_TQ &lt;- round(100 + 15*deviation_16))
<em>[1] 138
</em>
</pre>
<pre>
(Sampras_TQ &lt;- round(100 + 15*deviation_14))
<em>[1] 136
</em>
</pre>
<p>And what about for example 7 times Grand Slam tournament winner?</p>
<pre>
(deviation_7 &lt;- (log(7) - mean_norm)/sd_norm)
<em>[1] 1.53931
</em>
</pre>
<pre>
TQ_7wins &lt;- round(100 + 15*deviation_7)
<em>[1] 123
</em>
</pre>
<p>Let us then compute the Tennis Quotients (TQ) for all our tennis Grand Slam tournaments winners.</p>
<pre>
tq_compute &lt;- function(x) {
  deviation_x &lt;- (log(x) - mean_norm)/sd_norm
  round(100 + 15*deviation_x)
}
slam_winners = slam_winners %>% mutate(TQ = tq_compute(WINS))
kable(slam_winners)
<em>| RANK|PLAYER | WINS| LAST_WIN_YEAR| TQ|
|----:|:---------------------------|----:|-------------:|---:|
| 1|Roger Federer | 19| 2017| 142|
| 2|Rafael Nadal | 16| 2017| 138|
| 3|Pete Sampras | 14| 2002| 136|
| 4|Novak Djokovic | 12| 2016| 133|
....
</em>
</pre>
<p>We then visualize the top twenty Grand Slam tournaments champions.</p>
<pre>
ggplot(data=slam_winners[1:20,], aes(x=reorder(PLAYER, TQ), y=TQ, fill = TQ)) + 
  geom_bar(stat =&quot;identity&quot;) + coord_flip() + 
  scale_y_continuous(breaks = seq(0,150,10), limits = c(0,150)) +
  xlab(&quot;PLAYER&quot;)
</pre>
<p>Gives this plot.<br>
<a rel="nofollow" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2017/12/barplot.png?ssl=1" target="_blank"><img sizes="(max-width: 1000px) 100vw, 1000px" src="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2017/12/barplot.png?w=450&ssl=1" alt="" class="wp-image-9802" data-recalc-dims="1"></a></p>
<h2>Conclusions</h2>
<p>The answers to our initial questions:</p>
<blockquote>
<p>
– The log-normal distribution<br>
– Based upon the fitted distribution and taking advantage of <code>plnorm()</code> or <code>pnorm()</code> stats package functions, probabilities have been computed<br>
– A linear increase is a very good fit for that, resulting in significative regression coefficients and high R-squared values<br>
– Yes, we defined the Tennis Quotient similarly to the Intellectual Quotient and show the resulting leaderboard. Federer is confirmed “genius” in that respect, however, a few other very talented players are not that far from him.</p>
</blockquote>
<p>If you have any questions, please feel free to comment below.</p>
<p><b>References</b></p>
<ul>[1] <a rel="nofollow" href="https://datascienceplus.com/wp-content/uploads/2017/12/tennis-grand-slam-winners_end2017.txt" target="_blank">tennis-grand-slam-winners_end2017</a></ul>
<ul></ul>
<p><strong>
<p>Related Post</p>
<p></p></strong>
<ol>
<li><a rel="nofollow" href="https://datascienceplus.com/oneway-anova-explanation-and-example-in-r-part-2/" title="Permanent Link toOneway ANOVA Explanation and Example in R; Part 2" target="_blank">Oneway ANOVA Explanation and Example in R; Part 2</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/oneway-anova-explanation-and-example-in-r-part-1/" title="Permanent Link toOneway ANOVA Explanation and Example in R; Part 1" target="_blank">Oneway ANOVA Explanation and Example in R; Part 1</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/one-way-anova-in-r/" title="Permanent Link toOne-way ANOVA in R" target="_blank">One-way ANOVA in R</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/cubic-and-smoothing-splines-in-r/" title="Permanent Link toCubic and Smoothing Splines in R" target="_blank">Cubic and Smoothing Splines in R</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/chi-squared-test-in-r/" title="Permanent Link toChi-Squared Test – The Purpose, The Math, When and How to Implement?" target="_blank">Chi-Squared Test – The Purpose, The Math, When and How to Implement?</a></li>
</ol>
	<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://datascienceplus.com/tennis-grand-slam-tournaments-champions-basic-analysis/"> R Programming – DataScience+</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 rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/CaS6u6kEgNI" height="1"></a></div>