Head to head
Messi vs Ronaldo
You couldn’t avoid being asked this question if you happen to be a football fan —— “Who is better in your mind? Lionel Messi or Cristiano Ronaldo?”, even if you are one of those successful professional defenders <watch it>. However, being biased could be easy for these players if one of them used to play with Messi or Ronaldo. As a result, although I regard both those two players as the best duo in my time, I will use cold data to compare their past performance in matches.
See the dataset
#Loading the footballers dataset
footballer <- read_csv(here::here("data", "footballer.csv")) %>%
janitor::clean_names()
#Have a look of the dataset
skim(footballer)
| Name | footballer |
| Number of rows | 75 |
| Number of columns | 24 |
| _______________________ | |
| Column type frequency: | |
| character | 4 |
| numeric | 20 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| season | 0 | 1 | 9 | 9 | 0 | 19 | 0 |
| name | 0 | 1 | 5 | 7 | 0 | 2 | 0 |
| squad | 0 | 1 | 8 | 14 | 0 | 5 | 0 |
| competition | 0 | 1 | 7 | 14 | 0 | 5 | 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| age | 0 | 1.00 | 26.40 | 5.51 | 17.00 | 22.00 | 26.00 | 31.00 | 36.0 | ▇▇▇▇▆ |
| minutes | 0 | 1.00 | 1574.60 | 1073.12 | 25.00 | 719.50 | 1080.00 | 2714.50 | 3375.0 | ▆▇▁▃▇ |
| goal | 0 | 1.00 | 16.09 | 14.11 | 0.00 | 5.00 | 11.00 | 27.00 | 50.0 | ▇▂▂▂▁ |
| assist | 0 | 1.00 | 5.45 | 5.17 | 0.00 | 2.00 | 4.00 | 9.00 | 21.0 | ▇▃▂▁▁ |
| non_penalty | 0 | 1.00 | 13.55 | 11.78 | 0.00 | 4.50 | 10.00 | 22.50 | 42.0 | ▇▃▂▂▁ |
| penalty | 0 | 1.00 | 2.55 | 2.98 | 0.00 | 0.00 | 2.00 | 4.00 | 12.0 | ▇▃▂▁▁ |
| penalty_attempt | 0 | 1.00 | 2.99 | 3.43 | 0.00 | 0.00 | 2.00 | 5.00 | 13.0 | ▇▃▁▁▁ |
| shoot | 22 | 0.71 | 111.94 | 78.81 | 0.00 | 41.00 | 81.00 | 178.00 | 264.0 | ▇▆▂▇▃ |
| off_target | 22 | 0.71 | 35.87 | 27.34 | 0.00 | 12.00 | 28.00 | 53.00 | 104.0 | ▇▅▅▃▁ |
| on_target | 22 | 0.71 | 49.66 | 35.20 | 0.00 | 20.00 | 35.00 | 80.00 | 105.0 | ▇▇▁▅▇ |
| blocked | 22 | 0.71 | 26.42 | 18.75 | 0.00 | 11.00 | 24.00 | 43.00 | 66.0 | ▇▃▃▅▂ |
| rating | 22 | 0.71 | 8.16 | 0.61 | 5.98 | 7.87 | 8.34 | 8.54 | 8.9 | ▁▁▂▅▇ |
| pass | 22 | 0.71 | 895.38 | 667.52 | 13.00 | 409.00 | 732.00 | 1253.00 | 2360.0 | ▇▅▅▂▂ |
| acclb | 22 | 0.71 | 27.06 | 30.20 | 0.00 | 6.00 | 17.00 | 34.00 | 117.0 | ▇▂▁▁▁ |
| inacclb | 22 | 0.71 | 10.17 | 12.09 | 0.00 | 2.00 | 7.00 | 11.00 | 45.0 | ▇▂▁▁▁ |
| accsp | 22 | 0.71 | 715.43 | 531.21 | 8.00 | 334.00 | 584.00 | 994.00 | 1936.0 | ▇▃▃▂▂ |
| inaccsp | 22 | 0.71 | 142.72 | 106.26 | 1.00 | 59.00 | 100.00 | 220.00 | 356.0 | ▇▆▃▂▃ |
| keypass | 22 | 0.71 | 38.64 | 28.93 | 0.00 | 17.00 | 27.00 | 65.00 | 95.0 | ▇▆▂▃▃ |
| yellow | 0 | 1.00 | 2.09 | 1.96 | 0.00 | 1.00 | 2.00 | 3.00 | 9.0 | ▇▆▂▁▁ |
| red | 0 | 1.00 | 0.12 | 0.37 | 0.00 | 0.00 | 0.00 | 0.00 | 2.0 | ▇▁▁▁▁ |
As you could see, I have a dataset covering 10+ key factors for judging players’ performances. I have the data for champions league and domestic leagues they have played in. I also have data about their goals, assists, shooting and passing, even how many yellow and red cards they were given respectively. As you could see, there are 22 missing values in several variables because the website I used to download data didn’t have the data before 2009-2010 season. Besides, I would like to give you some explanations on what acclb, inacclb, accsp, and inaccsp are. The first two mean how many accurate and inaccurate long ball passes they had made and the last two mean how many accurate and inaccurate short passes they had made.
Whoscored Rating
I always trust judgement from professional institutions and that’s why I will use rating data from whoscored at first because these people definitely know how to analyze performances better than me.
These are Champions league rating results.

And these are Domestic league rating results.

Conclusions seem to be quite straightforward. These guys prefer Messi rather than Ronaldo. We could see the confidence intervals of their ratings.
Champions League confidence intervals and t-test results:
## # A tibble: 2 × 5
## name mean_rating median_rating CI_low CI_high
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Messi 8.45 8.40 8.22 8.68
## 2 Ronaldo 7.97 7.91 7.72 8.22
##
## Welch Two Sample t-test
##
## data: rating by name
## t = 3.15, df = 21.8, p-value = 0.0047
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## 0.16575 0.80425
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 8.4508 7.9658
Undoubtedly, Messi enjoys higher mean scores than Ronaldo and their intervals even don’t overlap. P value is less than 0.01 so Messi’s mean champions league rating is statistically significantly larger than Ronaldo’s.
Domestic League confidence intervals and t-test results:
## # A tibble: 2 × 5
## name mean_rating median_rating CI_low CI_high
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Messi 8.45 8.40 8.22 8.68
## 2 Ronaldo 7.97 7.91 7.72 8.22
##
## Welch Two Sample t-test
##
## data: rating by name
## t = 5.3, df = 16.8, p-value = 6.2e-05
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## 0.34676 0.80657
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 8.6367 8.0600
Once again, Ronaldo loses both fights and some of Ronaldo fans may say that these are unprofessional and trash ratings thus couldn’t be taken seriously. In order to test their argument, I did a correlation test between rating and players’ key stats (goals+assists) of each season.
##
## Pearson's product-moment correlation
##
## data: x and y
## t = 3.03, df = 22, p-value = 0.0061
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.17860 0.77628
## sample estimates:
## cor
## 0.54288

P value suggest that the correlation between them is significant and Messi’s slope is surprisingly lower than that of Ronaldo. In other words, Messi’s rating could be higher if given the same increase on rating of every key stats improvement. So Ronaldo fans’ claim doesn’t have its ground.
##
## Pearson's product-moment correlation
##
## data: x and y
## t = 2.56, df = 22, p-value = 0.018
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.094028 0.739650
## sample estimates:
## cor
## 0.47925
Same conclusions apply to key stats without penalty goals. So my final decision is that Messi wins the first round. Messi 1:0 Ronaldo.
Scoring Machine
Both these two players are top scorers and leave us with many good memories of their unbelievable skills. Ronaldo scored a fantastic overhead goal in match against Juventus and Messi replicated Maradona’s magic in match against Getafe when he was only 19 years old.
Therefore, we have to compare their scores data to see who is a better shooter that helps his team climb towards the glory. I compared the data by their age for fairness considerations and I also conducted a t test to analyze the difference between their means. Moreover, I focused on their goal scoring per 90 minutes data because total numbers of scores could be viewed as a nominal variable but we need a real variable when carrying out a comparison analysis.

## # A tibble: 2 × 5
## name mean_score median_score CI_low CI_high
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Messi 0.917 0.929 0.798 1.04
## 2 Ronaldo 0.813 0.884 0.688 0.938
##
## Welch Two Sample t-test
##
## data: total_scores by name
## t = 1.33, df = 21.9, p-value = 0.2
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## -0.058419 0.267382
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.91726 0.81278
As you could see from the graph, Messi scored more per 90 minutes in early years than Ronaldo but the latter one gradually caught up with Messi and surpassed him mildly after the age of 26. Meanwhile, t test results also show that there isn’t any significant difference between their mean scores. I did two more t tests on different age periods and you could see that Messi leaded first before lagged behind Ronaldo.
Early age:
##
## Welch Two Sample t-test
##
## data: total_scores by name
## t = 1.95, df = 9.84, p-value = 0.081
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## -0.035639 0.520868
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.95570 0.71309
Old age:
##
## Welch Two Sample t-test
##
## data: total_scores by name
## t = -0.401, df = 7.52, p-value = 0.7
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## -0.22943 0.16213
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.87882 0.91247
However, I realized that we could go deeper into this question because they had different numbers of shooting chances. Consequently, we could decide who is a better scorer by comparing their score-shoot rate. Some meddlesome Messi fans also called Ronaldo as Penaldo because he only scored penalties. So we are also going to analyze who keeps his composure better at 12 yards opportunities.
Shooting transferring rate t-test analysis:
##
## Welch Two Sample t-test
##
## data: shoot_transfer_rate by name
## t = 4.01, df = 16.3, p-value = 0.00097
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## 0.022064 0.071327
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.17086 0.12417
Couldn’t say who wins. Although the difference is significant, Messi only has a 5% rate advantage compared with Ronaldo. Therefore, we checked the difference between the mean of their on target rate.
Shoot on target rate t-test analysis:
##
## Welch Two Sample t-test
##
## data: target_rate by name
## t = 5.28, df = 21.7, p-value = 2.8e-05
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## 0.042103 0.096706
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.48087 0.41146
The p-value once again suggests the difference is significant and the rate advantage is a 7%. We could conclude that Messi is a better chance catcher and has higher shoot accurancy.
Finally, we want to see their penalty performance.

## # A tibble: 2 × 3
## name mean_pen sum_pen
## <chr> <dbl> <dbl>
## 1 Messi 4.53 77
## 2 Ronaldo 6.33 114
Ronaldo do score more penalties but hey, scoring penalties needs a big heart and not everyone could make it when is forced to kick under pressure. So instead of concentrating on the numbers of penalties, I wanted to see who has a higher penalty success rate and did a t test as the supplement.
##
## Welch Two Sample t-test
##
## data: penalty_success_rate by name
## t = -0.638, df = 19.9, p-value = 0.53
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## -0.132994 0.070689
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.82616 0.85731
Two wonderful players couldn’t be differentiated by statistics but ronaldo does have a higher mean success rate. In conclusion, Messi does score more goals per 90 mins and has better shooting skills but Ronaldo also seems to have a stronger mentality when faced with difficulty. So I guess Messi 2:1 Ronaldo would be fair.
Assist master
More people tend to call Messi more of a team player and Ronaldo more of a solo player. In his time at FC Barcelona, Messi is the man who navigates the style this team plays and he made perfect connections with teammates like Xavi and Iniesta. FC Barcelona under Pep Guardiola is a formidable opponent that no team wants to face. They played more like a whole and achieved many things that no one could reach later. Ronaldo on the other hand, is always the man who stands out for his team when it needs a goal to turn the game. In champions league season 15/16, Real Madrid was beaten by Wolfsburg in the 0-2 first leg. Ronaldo scored two goals for Real Madrid in the second leg before seized the win by scoring an outrageous freekick and completed his hat trick. Real Madrid marched to the final and won the title of champions league later that season.
Like how I analyzed two players’ shooting performance, first I created a graph to see how many assists they have made at each age.

As shown in the graph, Messi dominates Ronaldo on assists performance and Ronaldo only beat Messi for one time during the golden time of their careers. I did a follow-up t-test to bolster my argument.
##
## Welch Two Sample t-test
##
## data: total_assists by name
## t = 3.11, df = 19.1, p-value = 0.0058
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## 0.038666 0.198326
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.39908 0.28059
Results support my last argument. Messi makes 0.1 more assists than Ronaldo per 90 minutes. However, one of the feasible explanations is that since Messi plays as the core of his team, he controls ball most of the time and which allows him to make more passes and finally thus transferring into more assists. Therefore, I divide their assists by their total passes each season and conduct a t-test to analyze difference between their means.
T-test on assist success rate:
##
## Welch Two Sample t-test
##
## data: assist_success_rate by name
## t = -1.57, df = 18.2, p-value = 0.13
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## -0.00334866 0.00047996
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.0063457 0.0077800

## # A tibble: 1 × 1
## p_value
## <dbl>
## 1 0.13
Unexpectedly, there is no significant difference between their assist capabilities. So instead I tried to find if there is any difference in their pass success rate and key pass success rate for using as a substitute of their capacity. Because some Ronaldo fans could argue that Messi makes more safe passes by following the method of Tiki-taka. That’s why I also analyzed the value of their mean key pass success rate.
T-test on pass success rate:
##
## Welch Two Sample t-test
##
## data: pass_success_rate by name
## t = 3.1, df = 21.9, p-value = 0.0052
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## 0.0090564 0.0456554
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.83905 0.81170
T-test on key pass success rate:
##
## Welch Two Sample t-test
##
## data: keypass_success_rate by name
## t = -2.97, df = 22, p-value = 0.007
## alternative hypothesis: true difference in means between group Messi and group Ronaldo is not equal to 0
## 95 percent confidence interval:
## -0.0151619 -0.0027057
## sample estimates:
## mean in group Messi mean in group Ronaldo
## 0.040237 0.049171
The results are once again even for those two. Messi enjoys a higher pass success rate by near 3 percent but Ronaldo has a 1 percent advantage on key pass success rate. It somewhat supports the hypothesis that Messi makes more not that important passes when organized gradual attack and Ronaldo waits his chance to pull the trigger when decisive like a sniper. Therefore, Messi 3:2 Ronaldo.
Conclusion
People are lucky to enjoy football in an era dominated by these two incredible players. They both work hard to fight for their dreams and have given us so many unforgettable moments when football hasn’t been flooded by capital. It’s hard to decide which of them is better since they are still on their journey. Hope they could bring us more in their last dance.
