Saturday, August 2, 2014

Fantasy Football - 1: Team Composition



Lab Record Type Section

Motivation
I'm bored

Introduction
This post is part 1 of a series of number crunching posts I intend on doing on some EPL Fantasy Football data I have. I picked an easy one to begin with by picking team composition but hopefully the boredom will last through to something more interesting.

Those who know what fantasy football is may skip this paragraph - Fantasy football is a way for single men to distract themselves from their singledom. Each bachelor gets to pick a football team from amongst the players participating in the league/tournament. Each player has a price and you have a fixed budget (£100m in EPL) within which to accommodate the entire team. Prices go up and down during the year based on the player's performances and the demand from the bachelor community. As the players play the actual matches, they earn points depending on their performances on the pitch. At the end of the season, the points are totaled and the bachelor with the highest points wins. After another two months, when the next season starts again, all the bachelors pick a new team for that year and the cycle continues.

This webpage lists the rules and how the points are calculated.
If you are single, then this is what you're looking for.


Data
The first 37 weeks of the 2013-14 EPL season web-scraped from fantasy.premierleague.com. 
I forgot to get the 38th week. However, only City and Liverpool had anything to play for with Liverpool needing a massive slip from City to benefit in any way so let us assume that everyone chilled out that week and the analysis is probably better off without week 38.

Assumptions:
  • I pick only 11 players and not the entire 15. I compensate for this by setting aside a budget of 18m for the 4 substitutes. 4.5m per bench-warmer seems fair enough. I work within the remaining amount to pick the 11 active players. By the way, as of right now, Erik Lamela, at 8m, has 2.2% ownership.
  • Other rules such as a minimum of 3 defenders, a maximum of 3 players from the same team, etc. are adhered to. If you do spot a violation of some rule then please let me know. That would probably be a good time to stop this series.
  • I assume the value of team goes up by 0.25m every week and therefore there is an extra 0.25m available each week. Week 1 begins at 100 - 18 = 82 as the budget, week 2 is then 100.25 - 18 = 82.25, week 3 is 100.50  - 18 = 82.50,  so on so forth until week 37 which is 109 - 18.= 91. The 18 is a permanent set aside amount for substitutes as mentioned earlier.
  • Injuries, transfers and captaincy are a pain in the ass to incorporate in the analysis. I typically ignore these aspects completely unless mentioned otherwise.
  • I will not mention £ or pounds every time I'm referring to prices. I might also miss the million sometimes when quoting that number. Nobody really uses it anyway. 

Software
R. 
  • Getting the data with the RCurl, rjson, and XML library
  • Optimisation with the lpSolve and lpSolveAPI library. 
  • Graphs with the ggplot2 library. Not googleVis
  • Color schemes with the help of colorbrewer2 
  • Tables with the xtable library.





Dream Team of the Year

If I had to pick one team at the beginning of the season and let it play through the season, then the team below would have fetched me the most points, 2110, and used up all the 82m I had to begin with.

Name Position Team Total Points Price
Wojciech Szczesny Goalkeeper ARS 157 5.50
Per Mertesacker Defender ARS 157 5.50
John Terry Defender CHE 172 6.00
Seamus Coleman Defender EVE 174 5.00
Adam Lallana Midfielder SOU 176 6.00
Steven Gerrard Midfielder LIV 194 9.00
Eden Hazard Midfielder CHE 200 9.50
Gnegneri Yaya Touré Midfielder MCI 235 8.50
Rickie Lambert Forward SOU 170 7.50
Olivier Giroud Forward ARS 182 8.50
Luis Suárez Forward LIV 293 11.00

If I kept Luis Suarez as captain through the season then my tally would have shot up to 2403. This would beat my actual score of of 2214 which I managed after assiduously watching MOTD, following transfer and injury news as if the players were my own sons, and availing the additional options of substitutions and wildcards. A score of 2403 would also beat about 92% of the playing crowd that scored less than my 2214. And this without playing the 38th gameweek.




Weekly Dream Teams

Within the limits of the adjusted amount, 100 - 18 + ( ( gameweek - 1)  * 0.25) applied on the price of the player for that gameweek, I also picked the highest scoring teams each week. The chart below tries to indicate the composition of the team.




Dream team of each week: Player, points, price in that week
You probably need to open this image by itself in a new window.


Picking Formations

The team of the year aggregated to each position presents the following numbers -

Position Total Points Total Price Count Avg Points Points Per Pound
Goalkeeper 157 5.50 1 157.00 28.55
Defender 503 16.50 3 167.67 30.48
Midfielder 805 33.00 4 201.25 24.39
Forward 645 27.00 3 215.00 23.89

Note how the formation is a 3-4-3, with defense offering a high points per pound return but not as high an absolute points return.

If we go a step further and picked the team of the week over each of the weeks, a histogram of formations is as below -


3 defenders seems to be the way to go with 24 of the 37 weeks favouring either a 3-5-2 or a 3-4-3.Of course, van Gaal already knows that.

Defense

I always find picking the defense to be more tricky so I'm focusing on that for now.

I typically don't invest a lot in goalkeepers as they only bring extra points through the occasional clean sheets and the rare penalty save or even rarer assist or a goal (Begovic's goal during the 1-0 over Southampton denied me 12 clean sheet points). Clean sheets are more of a collective effort than individual brilliance and is harder to rely on unless you have an Allardyce, a Pulis or a Mourinho digging their feet in and playing some solid ol' fashioned 19th century football. Furthermore, the fact that you need two keepers on the rolls to fill one active position is a great opportunity to exploit some bench strength. I typically won't be found with a Cech (Courtouis?) in my team, I'll try and manage by rotating a Mannone and a Speroni maybe. Szczeny makes it to the top 11 for the year but at 5.5 is just 0.5 too expensive for my liking. His inclusion might be a result of my excluding the bench rotation option. More on picking goalkeepers in part 2.

I also minimise the active defenders by playing a 3-4-3 or a 3-5-2. Central defenders have similar scoring prospects as 'keepers which is why you won't find me with an expensive Kompany or a Vidic. I might be open to a similar outlay on a wing-back maybe because of the higher assists or goals probability and therefore a Baines or a Coleman is possible. The trade-off is usually between chasing clean sheets or chasing goals and assists. A Joel Ward at 4.5 or so getting frequent clean sheets, but not scoring much? Or a more expensive Zabaleta providing assists but not regular with the clean sheets? Or an even more expensive Baines with better chances of both? Again, more on this in part 2. Or part 3 if I split part 2 into goalkeepers and defenders.

Offense
Offense is easier. Pick out players in the middle of a hot streak and squeeze them in somehow. Most of my cash goes into the forward line and the midfield. These players are capable of producing points out of individual effort and are not as reliant on the team as defenders and keepers. I've been favouring a 3-5-2 of late because of the surplus of attacking midfielders who create and score goals while also getting that 1 point for clean sheets (think Yaya Toure, Juan Mata, Eden Hazard, or Aaron Ramsey). The team of the year composition, the summary chart, and Suarez's sale and van Persie's injuries would agree that this trust in five midfielders is well deserved.


Conclusion


This chart summarises the entire post suggesting that most teams of the week are arranged in a 3-4-3 with a median spend of 5m on the goalkeeper, 17m on defense, 29m on midfield and 20m on the forwards. This results in a median points tally of 10, 35, 56, and 35 from the GK, D, M, and F respectively.

Stick to a 3-4-3 (or a 3-5-2, now that there's no Suarez and more or less no van Persie). Or should you? More details in the upcoming posts.



Other Posts in the Series


> Part 1: General Team Composition
Part 2: Picking the Goalkeeper
Post 3: Picking the Defensive Line
Part 4: The Value of Money
Part 5: The Value of Wildcards
Part 6:  Getting Ready for 2014-15
Part 7: How Much Does the Opposition Matter?

2 comments:

  1. how jobless are you? :P

    btw the cash value of the team does not goes up every week, the value of each player changes every week depending upon the player's demand (number of fantasy managers transferring him in/out)

    ReplyDelete
    Replies
    1. I'm a little jobless but I also think of it as doing a service to all the fantasy league players around the world. Good karma.

      And yeah, I didn't word that very well. The idea was that the value of the players goes up and down so the value of the team also goes up or down which can be encashed, if one so wanted. Let me phrase that differently. Thanks!

      Delete