Showing posts with label sports. Show all posts
Showing posts with label sports. Show all posts

Wednesday, January 19, 2022

Comparing R vs. Python graphing capabilities for time series data

 I used a simple time series data set on the number of touch downs for seven different quarterbacks achieved over the years.  The x-axes of the graphs are the quarterbacks' respective age.  The y-axes are their respective cumulative number of touch downs.  

You can see the complete presentation at the link below: 

R vs. Python comparison

And, I compare the two software using different types of graphs, including:

1) Time series graph of a single variable (the number of touch downs for one single quarterback);
2) Time series graph of multiple variables (including all 7 quarterbacks); and 
3) Facet graphs when you generate a separate graph for each of the quarterbacks. 

For the first two types of graphs, the two software were pretty competitive.  R was a bit more efficient in generating legends almost automatically.  Meanwhile, constructing a legend using Python was a lot longer and manual.  But, otherwise the respective Python graphs were pretty competitive with the R ones in terms of look and feel.  And, the coding difficulty (besides the legend bit) was fairly similar. 

When it came to Facet graphs, there was no comparison.  R was far easier and better.  Python facet graph capabilities appear more structured for scatter plots and not so much for time series plots.  Doing the latter in Python was truly a miserable experience.  And, the result was so poor relative to the R facet graphs, that I don't even dare to show them here.  I show them within the presentation link above.  With superior Python coding skills, maybe facet-time series graphs are doable.  But, be warned.  There is high hurdle rate there in terms of coding skills.  

Here is a multi variables regular Python graph that came out very well.


 

Here is the comparable R graph that came out equally well. 


 

Here is an R facet graph that came out very well. 



Thursday, December 23, 2021

Is Tom Brady the greatest quarterback?

 If you want to review the entire study, you can view it at the following links: 

Football study at Slideshare.net

Football study at SlidesFinder.com 

The above studies include extensive use of the binomial distribution that allows differentiating how much of the quarterbacks' respective records are due to randomness vs. how much is due to skills.  This statistical analysis is not included within this blog post.  (The study at SlidesFinder may not include this complete section right now, but it should within a few days). 

The quarterbacks I looked at include the following: 

 

Performance during the Regular Season.

If we look at Brady's performance during the regular season at mid career (34 years old), he actually is far behind many of his peers.  

First, let's look at cumulative yards passed by 34 years old. 


Next, let's look at number of touch downs by 34 years old. 


As shown above in both yards and touch downs, at 34 years old Brady is way behind Manning, Marino, Brees, and Favre.  

At this stage of his career and on those specific counts, Brady does not look yet earmarked to become a legendary number 1.  

However, Brady's career longevity and productivity is second to none.  And, when you compare the respective records over an entire career, the picture changes dramatically. 

 

 Brady's ability to defy traditional age sports curve is remarkable.  He just has not shown any decline in performance in age.  At 44, he is just as good as 34... unlike any of his peers who have been out of the game for years. They all retired by 41 or earlier. 
 
 
Track record during the Post-Season.  

During the Post-Season it is a very different story.  Brady has been dominant throughout and since early on in his career.  He leads in number of Play Offs. 

 







 

 

He is way ahead in number of Super Bowl games. 


And, way ahead in Super Bowl wins. 


The table below discloses the performance of the players during the Post-Season. 

Given the number of teams in the NFL (32), and number of seasons played, the above players have a random proportional probability of winning one single Super Bowl ranging from 50% (for Montana) to 66% (for Brady).  That probability based on just randomness drops rapidly to close to 0% of winning 2 Super Bowls.  Notice that Marino, Brees, and Favre actual records are in line with this random proportional probability.  This underlies how truly difficult it is to win more than one Super Bowl.  Manning and Elway do not perform much above this random probability.  Only Montana and Brady perform a heck of a lot better than random probabilities would suggest based on the number of seasons they played. And, as shown Brady with 7 is way ahead of Montana.  And, he is not done!

When looking at the Post-Season track record, there is no doubt that Brady is the greatest.  Under pressure, and when it counts he scores.  Also, interesting even when he looses in a Super Bowl game, it is a close game.  He does not get wiped out.  By contrast some of the other quarterbacks (including Marino, and Elway among others) suffered truly humiliating lopsided defeats in the Super Bowl... not Brady.


Tuesday, November 23, 2021

Is the 3-points game taking over NBA basketball

 The short answer is not yet.  The graph below shows that 2-points still make over 50% of overall points.  Granted, 3-points have steadily risen since the 1979-1980 NBA season when 3-points were first introduced in the NBA.  It took a while for the players to adapt their skills and coaches to evolve their strategies to leverage the benefits of 3-points shots. 

 
The big difference over time is how much more aggressive players have become in attempting 3-points shots.  Until the 2011 - 2012 season, teams were attempting less than twenty 3-points shots per game.  The number has exploded to over 35 during the most recent two seasons. 
 

 Something to keep in mind is that the 3-points shooting skill of a team has only a rather moderate to weak relationship with a team's overall performance or ranking.  And, that is another way to consider that 3-points shooting is not dominant in the NBA or even determinant in NBA team's success. 


The graph above (using the NBA 2020-2021 season data) indicates that 3-points ranking of a team explains only 15% of the variance in the overall ranking of a team (R Square = 0.1485) and vice versa.  If 3-points ranking explained 100% of the overall ranking, the red regression trend line would be perfectly diagonal across the squares on the grid.  And, the regression equation would be: y = 1(x) + 0.  Or in plain English: 3-points ranking = Overall ranking.  As shown, this is far from this situation.  
 
Here are the top 5 leaders in 3-points baskets.  

Notice that two of them are still active: Stephen Curry (33 years old), and James Harden (32).  One would expect Curry to soon become the top leader; and, James Harden to move into the third spot.  By the end of their respective career, Curry and Harden may very well occupy the top 2 spots. 

A closer look at the top 5 record on a per game basis. 

What tables A and B indicate is that the contemporary players (Curry and Harden) have been far more productive in scoring 3-pts shots.  And, the main reason behind their success is that they have been far more aggressive in attempting 3-pts shots (see table B). 

In terms of accuracy (table C for 3-pts success rate), Kyle Korver, a player from another generation pretty much towers over the field.  But, his higher success rate did not matter much given that he made so fewer 3-points attempts per game than Curry and Harden (see table B). 

Curry's 3-points talent is in good part not reflected in any of the above statistics.  Curry differentiates himself from the field with his unique ability to score 3-points baskets from "way downtown", often at or even past mid-court.  Unfortunately, this superlative achievement is not rewarded with any scoring points benefits.  

Harden is a very different player.  While nearly as aggressive as Curry in attempting 3-points shots (table B).  He is not nearly as accurate (lower success rate as shown in table C).  In recent seasons, Harden has also somewhat lessened his focus on 3-points shots attempts (table B).  On the other hand, Harden is a very dynamic and diversified player.  And, his claim to fame may not be just his 3-points shooting skills, but his mesmerizing dribbling across his legs in a crouching tiger type position that has rendered him the most "unguardable" player in the NBA.  

Next question worth considering is how long can we expect Curry to perform at top level in 3-points shooting?  

Well, the short answer is for a pretty long time.  The graph below shows the record of Ray Allen, Reggie Miller, and Kyle Korver who rounded the top 5 in 3-points shooting.  We looked at their 3-points success per game (number of baskets) and their related success rate.  The graph shows their respective performance as they aged.  We used the average of their respective performance over 6 seasons when they were from 28 to 33 years old.  We used this average as a baseline index = 100.  And, next we divided each year specific performance by the 28 -33 average and multiplied it by a 100.  This allowed us to measure precisely how their respective performance declined as they aged beyond 33 years old. 




The left hand graph shows that Miller and Korver maintained their 3-points success per game very well as they aged.  At 38 years old, they were still performing at 80% of their average level at 28 to 33 years old. 

The right hand graph shows that all three players maintained their respective 3-points success rate remarkably well as they aged.  Shooting accuracy just does not seem to deteriorate with age.  
 
Curry is now 33.  In view of the above, it is rather likely that he would be very close to or at top form over the next three years (34, 35, 36).  Beyond 36, he may experience a mild decline in 3-points success per game.  But, he may still be relatively formidable in that category compared to other players. 
 
We could say the same thing for Harden (32).  However, Harden has apparently been much less focused on 3-points shooting during the most recent two seasons. 
 
I actually do not follow basketball.  Seeing everyday pictures of Curry on the cover of the sport page of my daily newspaper, I eventually caught Curry fever.  In view of that, I welcome comments, corrections.  And, I would gladly edit and improve this blog entry over time.  
 
If you want to read my complete study on the subject, check the two links below. 
 





Compact Letter Display (CLD) to improve transparency of multiple hypothesis testing

Multiple hypothesis testing is most commonly undertaken using ANOVA.  But, ANOVA is an incomplete test because it only tells you ...