Site icon R-bloggers

Is There Another Way to Do Fantasy

[This article was first published on Analysis of AFL, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Apologies for the rushed nature of post Recently I saw this post on twitter and it got me thinking is there another way?

So lets run through the rough problems as outlined in this tweet.

The general gist of the post is that Max Gawns numbers vs the bulldogs as outlined in the fantasyfreko post here are misleading because of the timeframe it looks at.

To do this using [fitzRoy] and the [tidyverse]

library(fitzRoy)
library(tidyverse)
## -- Attaching packages -------------------------------- tidyverse 1.2.1 --
## v ggplot2 2.2.1     v purrr   0.2.5
## v tibble  1.4.2     v dplyr   0.7.5
## v tidyr   0.8.1     v stringr 1.3.0
## v readr   1.1.1     v forcats 0.3.0
## -- Conflicts ----------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
df<-fitzRoy::player_stats

df1<-fitzRoy::get_footywire_stats(9514:9603)
## Getting data from footywire.com
## Finished getting data
df<-df%>%filter(Season != 2018)
df<-df%>%
  filter(Season != 2018) #filters out the 2018 data (incomeplete that was downloaded when installing fitzRoy for first time) 
df2<-rbind(df, df1) 

df2%>%filter(Player=="Max Gawn"  & Opposition=="Western Bulldogs")
##         Date Season    Round          Venue   Player      Team
## 1 2013-06-29   2013 Round 14            MCG Max Gawn Melbourne
## 2 2013-09-01   2013 Round 23 Etihad Stadium Max Gawn Melbourne
## 3 2014-06-29   2014 Round 15 Etihad Stadium Max Gawn Melbourne
## 4 2015-08-16   2015 Round 20 Etihad Stadium Max Gawn Melbourne
## 5 2016-05-15   2016  Round 8            MCG Max Gawn Melbourne
##         Opposition Status Match_id CP UP ED    DE CM GA MI5 One.Percenters
## 1 Western Bulldogs   Home     5662  4  6  6  60.0  1  0   1              4
## 2 Western Bulldogs   Away     5742  2  0  1 100.0  0  0   0              1
## 3 Western Bulldogs   Away     5880  5  4  8  88.9  4  0   1              4
## 4 Western Bulldogs   Away     6133  4  5  5  55.6  0  0   0              0
## 5 Western Bulldogs   Home     6242  6  2  3  50.0  1  0   0              3
##   BO TOG K HB  D M G B T HO GA1 I50 CL CG R50 FF FA  AF SC CCL SCL SI MG
## 1  0  84 6  4 10 5 1 0 6 33   0   2  2  3   0  2  2 100 92  NA  NA NA NA
## 2  0  56 0  1  1 0 0 0 0  7   0   0  0  0   0  0  0   9 14  NA  NA NA NA
## 3  0  86 4  5  9 5 1 1 0 23   0   1  0  1   1  0  1  64 72  NA  NA NA NA
## 4  0  92 5  4  9 2 1 0 4 32   0   1  2  1   1  1  1  81 74   0   2  6 94
## 5  0  82 3  3  6 2 0 1 1 42   0   0  2  6   1  0  3  59 49   1   1  3  7
##   TO ITC T5
## 1 NA  NA NA
## 2 NA  NA NA
## 3 NA  NA NA
## 4  0   0  1
## 5  3   2  0

From there we can see that it is a bit misleading. As we are looking at games going back to 2013 and I do believe that Max Gawn is very different to todays Max Gawn. Another thing was raised was that Max wasn’t the first ruck. We can check this by looking at the matchIds and looking at just those games statistics we would do that like this.

df2%>%filter(Match_id %in% c("5662","5742","5880","6133","6242"))%>%
  filter(Team=="Melbourne")%>%
  filter(HO>0) %>%
  arrange(desc(HO))%>%
  select(Date, Season, Round, Venue, Player, Team, HO)
##          Date Season    Round          Venue           Player      Team HO
## 1  2014-06-29   2014 Round 15 Etihad Stadium       Mark Jamar Melbourne 43
## 2  2016-05-15   2016  Round 8            MCG         Max Gawn Melbourne 42
## 3  2013-06-29   2013 Round 14            MCG         Max Gawn Melbourne 33
## 4  2015-08-16   2015 Round 20 Etihad Stadium         Max Gawn Melbourne 32
## 5  2013-09-01   2013 Round 23 Etihad Stadium     Jake Spencer Melbourne 25
## 6  2014-06-29   2014 Round 15 Etihad Stadium         Max Gawn Melbourne 23
## 7  2015-08-16   2015 Round 20 Etihad Stadium     Tom McDonald Melbourne  9
## 8  2013-09-01   2013 Round 23 Etihad Stadium         Max Gawn Melbourne  7
## 9  2015-08-16   2015 Round 20 Etihad Stadium      Chris Dawes Melbourne  7
## 10 2016-05-15   2016  Round 8            MCG Cameron Pedersen Melbourne  6
## 11 2013-06-29   2013 Round 14            MCG Jack Fitzpatrick Melbourne  3
## 12 2014-06-29   2014 Round 15 Etihad Stadium Cameron Pedersen Melbourne  3
## 13 2013-09-01   2013 Round 23 Etihad Stadium      Jeremy Howe Melbourne  2
## 14 2013-09-01   2013 Round 23 Etihad Stadium     Colin Sylvia Melbourne  2
## 15 2015-08-16   2015 Round 20 Etihad Stadium       Jack Watts Melbourne  2
## 16 2013-06-29   2013 Round 14            MCG      Jeremy Howe Melbourne  1
## 17 2013-06-29   2013 Round 14            MCG      Chris Dawes Melbourne  1
## 18 2013-09-01   2013 Round 23 Etihad Stadium    Jack Trengove Melbourne  1
## 19 2015-08-16   2015 Round 20 Etihad Stadium Heritier Lumumba Melbourne  1
## 20 2016-05-15   2016  Round 8            MCG        Dom Tyson Melbourne  1
## 21 2016-05-15   2016  Round 8            MCG     Tom McDonald Melbourne  1

Looking at that as an example we can see that in one of the games Fantasy Freako is referring to, Max was the second ruck behind Mark Jamar. So again pretty misleading.

Another idea, and this might be more topical is to look at a plot of how much fantasy points the Bulldogs give up to ruckman this year.

df1%>%
  filter(Opposition=="Western Bulldogs")%>%
  filter(HO>0)%>%
  ggplot(aes(x=Date, y=SC, label=Player))+
  geom_point()+
  geom_label(size=3)

Another way you might want to see the same graph is by putting the number of hitouts in that game next to the player name. This is handy if you want to see who the dominate ruckman was.

df1%>%filter(Opposition=="Western Bulldogs")%>%
  filter(HO>0)%>%ggplot(aes(x=Date, y=SC))+
  geom_point()+
  geom_text(aes(label=paste(Player,"" ,HO)))+
   theme(axis.text.x = element_text(angle = 90, hjust = 1))

df1%>%
  filter(HO>0)%>%
  group_by(Player)%>%
  summarise(averageSC=mean(SC))%>%
  arrange(desc(averageSC))
## # A tibble: 108 x 2
##    Player             averageSC
##    <chr>                  <dbl>
##  1 Nathan Fyfe             135.
##  2 Joel Selwood            135 
##  3 Michael Walters         132 
##  4 Max Gawn                129.
##  5 Brodie Grundy           126.
##  6 Oliver Wines            120 
##  7 Trent Cotchin           114.
##  8 Marcus Bontempelli      110.
##  9 Scott Pendlebury        109 
## 10 Justin Westhoff         107.
## # ... with 98 more rows

Looking at this table we can see that the one other full time ruckman that scored lots of SC points vs the Bulldogs was Brodie Grundy and Max Gawn actually averages more SC points over Grundy.

So the question is what teams do these two players gets lots of SC against?

Well we could look at the 2018 data like so.

df1%>%filter(Player %in% c("Brodie Grundy","Max Gawn"))%>%
  ggplot(aes(x=Opposition, y=SC,colour=Player))+
  geom_point()+
  geom_text(aes(label=paste(Player," ",HO," ",CM)),size=2)+
   theme(axis.text.x = element_text(angle = 90, hjust = 1))

What we can see is that they have played the same team 8 times and out of those 8 times Gawn has had more supercoach points in 5 of those games.

Max Gawns over/under as per tab pre game is 129.5 is there some value there?

To leave a comment for the author, please follow the link and comment on their blog: Analysis of AFL.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.