Pages

Showing posts with label Game States. Show all posts
Showing posts with label Game States. Show all posts

Tuesday, 3 September 2013

How Game States Alter Chance Conversion Rates.

Ideally, if you are attempting to quantify an identifiable skill in a sport such as football, you would like both the conditions of the trial and the context within the game to be controlled. Penalty kicks fulfill many of these conditions. A free kick from 12 yards, taken at relative leisure without the intervention of defenders, where only the identity of a similarly skilled goalkeeper alters, is as good as it gets in football. Unfortunately, it is also a rare event and therefore as a way to differentiate a repeatable talent, it ultimately fails.

Shots from open play are much more common events, both from an individual and team perspective. However, the advantages of consistency of each trial that was present in penalty kicks is largely lost. A two yard tap in or a thirty yard volley each appear as an indistinguishable "shot" when all attempts are simply lumped together. 
On a team basis, the two polar extremes for goal attempts from recent seasons are Stoke, at their set piece dependent best (or worst) and optimistic, long range shooting QPR. Both side's struggled for goals, but measured by raw shots alone, Stoke appear the more efficient of the pair. In 2010/11 their conversion rate of 11% hovered around the league average over the last decade, while in comparison, QPR in their relegation season recorded conversion rates of barely half that.
However, the comparison is misleading, City's average shooting distance was just past the penalty spot and QPR's was very nearly at the edge of the box and also a couple of yards wider. Rangers can be faulted for shooting so regularly from distance compared to both Stoke and the rest of the EPL, but it is that misguided optimism that led to an apparently abysmal conversion rate. When shot position is accounted for both QPR and Stoke were converting the chances they elected to take with similar levels of ability. 
If QPR had elected to try to create chances closer to goal, their conversion rate on a shot by shot basis would likely improve, with no real change in shooting ability. Similarly if Stoke shot more from distance, their rate would likely fall, again with no requirement for an underlying change in talent. Tactical approach, rather than changing talent or masses of randomness can be a huge factor in fluctuating shot conversion rates. 
The disconnect between raw counting conversion rates and x,y based rates is obvious in the case of Stoke and QPR, but similar effects are present for all sides.


If we start by looking at the rate at which teams from the EPL have converted shots, regardless of any additional information such as shooting distance, there is a relationship of sorts between conversion rates in season one and those recorded in the subsequent season. The line of best fit appears to indicate that poor conversion rates in one season tend to be followed by poor, if generally slightly improved rates in the next season. At the opposite extreme, a side converting at a well above average 18% would on average fall to around 14% next term. 
So there is evidence of a difference in finishing ability between sides, but also a degree of regression towards the mean, implying an expected amount of randomness, also.
The case of Stoke and QPR's different shooting profiles illustrates that shot position is a major factor in determining a fair expected conversion rate for a side. Shot position is mostly a choice determined by the attacking side, but in some cases a side is also partly forced into shooting from greater distance as time expires from a disadvantageous scoreline position. Such situations when, but not exclusively, a side trails is often accompanied by their opponents in addition presenting a more defensive shell. 
More speculative shots, against packed defenses, intuitively is going to depress conversion rates. So again we have a situation where any side can find itself in a situation where the trials commonly used to calculate the strength of season on season correlations between conversion rates are being altered by circumstances that are partly out of control of the attacking unit. In short, if your defense, through a combination of random chance or poor play puts a side consistently in poor game states, then your shooting conversion rate is likely to fall through poorer quality and better defended chances arising at the opposite end of the field.
We can see possible evidence for more frequent shooting going hand in hand with less efficient conversion rates by plotting Arsenal's total shot numbers and their seasonal conversion rate from 2002-2003 to the present. Random chance inevitably will play a part in the Gunners grabbing or conceding the opening goal, but how frequently they found themselves in either a good or bad game state will then alter the quality of the subsequent shooting trials. Around three quarters of the sides which have played for five or more seasons in the EPL since 2002-03, exhibit the same trait of decreased efficiency with increased shot frequency.
Arsenal, along with the other big four sides, tends to have the simplest game states. Leading is always good, but such is their quality, that drawing and obviously losing is invariably bad. Therefore, the average game state they experienced over a game or a whole season often corresponds closely to the amount of time they spent winning, drawing or losing. This allows us to express a good proxy for game state in a single number by using the proportion of time spent leading, as well as giving half the weight to time spent drawing over the period of a single game or a whole season. 
And the same pattern is seen. The poorer the average season long game state experienced by Arsenal, the more shots they had. Similarly, for Stoke, a side which have a more ambiguous relationship than Arsenal with a stalemate (sometimes against weaker sides it represents a poor game state, more often though, against better teams, it is a good one). In all matches where they had a better than average game state, they took just 8 shots per game, compared to an average of 12 when it was below average.
So we have a connection between more, less efficient shots being taken in poorer game states and while the former may partly drive the latter, the changing game state also alters, for better or worse the likely conditions of the shooting opportunities. Either in the longterm, depressing an already (partly luck driven) poor efficiency or enhancing an already impressive one.
In short, the context of game states is likely to have a significant effect on conversion rates and may even act as a decent proxy for shot distance and defensive pressure.
There are no short cuts to calculating game states. Final scorelines can mislead, a side can trail for 85 minutes and then grab two late goals, or score twice early and concede in second half injury time. Two 2-1 wins, but with vastly differing game states and in all likelihood, dissimilar goal attempt profiles. 
Time spent leading/drawing and losing are the building blocks, but then we have to decide how happy to defend or eager to attack each side will be in the commonly occurring stalemated scoreline. So we also require an estimate of team quality to further quantify game state in this all encompassing area of analysis.
To demonstrate how game state alters the conversion rates of a side from one season to the next, when squad turnover is likely to be light, above I've plotted paired conversion rates from consecutive seasons for Arsenal, again since 2002-13. For amalgamated data comprising 38 games in each point, the correlation is disappointingly poor. The temptation is to assign the lack of correlation entirely to random variation, and while that undoubtedly exists, we also have a naive model, lacking in detail. 
If a side has the good fortune to lead lots of games and if their style of play allows, they can sit deep, sit on their likely high conversion rate and attack their opponents on the counter, where chances may be fewer, but they will likely be of much better quality because their opponents are actively seeking to pull goals back. If during the next season, they fall behind more frequently (possibly because of a poorer defence and/or an unlucky attack), they could easily find themselves with a much reduced conversion rate, as they are forced to trial their shooting skills against more densely packed and better organised defences. 
The poor season on season correlation could be down to a combination of randomness, but also seasonal variation in game state.
If we wish to know how conversion rates correlate from one year to the next, looked at through the lens of total shots, we should at least try to accommodate important factors that appear to contribute, such as game state, both previously and in the season in question. So, instead of plotting paired conversion rates, I've taken the conversion rate in the previous season, along with the game state from that year and the game state experienced by the side in the subsequent year and projected a conversion rate for that subsequent campaign using these three factors. 
In short, if team A (appropriately Arsenal) convert at a certain rate under x average game state, what will they do under y average game state with mostly the same squad based on previous patterns. I've plotted this projection against the actual conversion rates above and the r^2 jumps to nearly 70%.
Game states and previous conversion rates go a long way to explaining, why a side records such apparently random conversion rates in consecutive years. Randomness exists, but other more concrete causes are equally as important.

Wednesday, 24 April 2013

Leading When It Really Counts.

The fundamental building blocks of football analysis are fairly well established. Goals are the rare, but intrinsically valuable currency from which virtually every other match outcome can trace back their origins. Likelihood of winning, the outcome of most interest, is strongly correlated to the ability of each side involved in a game to score and prevent goals. The ability to explain the past and predict the future with reasonable accuracy, in larger enough game samples is well within reach.

Fortunately, shorter term variation from these expected norms are also common place and it is this random noise that prevents football from becoming a sterile exercise in number crunching. Consequently, a team which, for instance suddenly shows an elevated home field advantage may be recording these figures through random variation or through a fundamentally different approach at home compared to away. The temptation is to try to rationally explain the latter, when the cause is almost always predominately due to the former.

Time spent leading, drawing or losing hasn't really received the exposure of home field advantage or outright match results, but along with most data recorded in football, it can significantly alter the course of side's season by departing from the line of greatest expectation and help to deliver randomly driven season long highs or lows that are rarely repeated.

Teams cannot chose precisely how many goals they will score and concede over a set number of games, nor can they decide how those goals are distributed within games. But if they could the optimum return for a six to three goal count spread over three matches would be achieved by way of three 2-1 wins. A less favourable outcome would result if all six goals were confined to just one of the three matches. Similarly for lead time, three games where a first minute concession was only overcome by two injury time replies would result in greatly differing lead times compared to a scoring sequence where goals were scored early and conceded late.

So variation is to be expected, even in large numbers of matches and if this variation results in better than expected outcomes, we may overrate sides on the seemingly soundest of evidence, only to be disappointed when they revert to a level of results more in line with their actual skill levels.

Lead time, combined with goal distributions is a prime candidate for causing such miscalculations. As with goals, teams aren't entirely in control of when they lead during a match. Obviously and ideally a side would like to lead going into second half injury time and see the result through for three points. A team gets no added points for leading for a large portion of the match if they then succumb near to the final whistle. In short, is the ability to hold a lead for longer a better indicator of repeatable skill than the other extreme of gathering points with late winners ?

To try to answer this we first need to create a baseline which correlates time spent leading (and ideally drawing) to points accrued over a season. Modelling the data along the lines of this post from last year, appears to highlight a subtle difference in the importance of time spent leading for the poorer teams and the rest. A team with a winning chance of around 20% or less sees their chances of leading peak just after the halftime break, whereas those with winning chances of 20% or greater see their chances of leading constantly rising until the full time whistle.

For example, a side with a 10% chance of winning a game has a greater than 11% chance of leading that game after an hour.



By contrast strong favourites will see their chance of leading the game consistently rise until full time is reached.


The inability of poor sides to hold onto a lead when faced by much stronger opposition has implication for the use of time spent in the lead as an indicator of overall ability. The relationship between lead time and expected points is likely to be different for changing team quality, particularly for those poor sides which spend proportionally more of their lead time mid game (when no actual points are awarded) and less at the game's end (when they are).

We can produce average expected points for differing team quality derived from actual lead/draw time and actual points gained for whole seasons and equally for a single match. The most memorable game from last year's EPL was the last to finish, Manchester City 3 QPR 2. City spent little more than ten minutes leading this game and almost an hour all square. The majority of points scoring outcomes from games with these type of lead/ draw times are going to be draws, occasionally, as happened last season to City, a team will snatch an unlikely win.

Expected Points Based On Lead/Draw Time Comparable To Manchester City's Final Game With QPR.

Type of Team. Average Expected Points from Such A Game.
Big Four Side. 1.2
Other Top Ten Side. 0.9
Bottom Ten Side. 0.8

The ability of top four sides to lead when it matters is illustrated by the line of best fit for three types of team. A top side which had the lead/draw time in a single game identical to Manchester City in 2011/12's final game would expect to average 50% more points than a bottom 10 side under identical circumstances.

Lead/draw times are good indicators of expected points and possibly better future performance indicators than actual points totals, but they also depend on team ability.

On a game by game basis from last year, Manchester City's lead/draw time would have resulted in a typical big four team accruing 86 points, three short of City's actual total. So they gained three more points than expected. By contrast, United's lead/draw time resulted in 89 actual points compared to an expectation of 88. A case of City getting slightly luckier than United ?

The sight of poorer sides leading mid game, but losing when it really counts has been common theme of United's games this season. Newcastle, Villa and Southampton each led mid game, but United led at the final whistle. The champions trailed for over 100 minutes in those three games and led for less than 5 minutes, figures that would see even the best struggling to take much more than a single point on average, yet United ended up with all nine points.

Around par for the course last term, this time around United have stretched their points total way beyond repeatable levels with a glut of timely scores. By trailing to seven teams after an hour, but losing to just four by full time, they are respecting the spirit of what a team of their quality may expect to achieve, but hardly the letter of the law. A six and five split would be much nearer to a typical Big 4 expectation.

They deserve to be champions, but they have also been, at times extraordinarily lucky as well. Their current lead/draw time is characteristic of a side just approaching 80 points rather than one powering on towards 90.

It's most likely not a trick they will consistently be able to repeat.

Wednesday, 13 February 2013

Quick And Easy Game States For Football.

One of the more glaring omissions in attempting to make sense of the huge increase in available football data relates to a lack of context. A priority during one stage of a match may become less so as the game progresses and often the driving force for change will be the game state. The balance between defence and attack will shift with changing scorelines, time remaining and the relative abilities of the competing sides.

In this post here, I looked at how shooting efficiency, frequency and the identity of the shooter and type of goal attempts changed with changing game state. Arsenal's shooting was more efficient, less frequent and more confined to recognised goalscorers when they held a comfortable match position, compared to less efficient, more frequent and more evenly spread among defenders as well as strikers, when they were trying to recover from a losing or drawing position.

Analysing a single team for one season was relatively data intensive, requiring time stamped goal attempts, as well as regular in running calculations of the individual game state positions for the team. Arsenal are of course a successful side, so with a few exceptions, if they are trailing or even simply drawing during a game their current game state will be below their expectations for the game result as a whole. Therefore, they will have the desire, but much more importantly the ability to try to alter their current situation for the better. How they attempt to recover should be reflected in the change in simple in running stats, such as goal attempts or corners won.

Deducing game states for the very best teams is fairly easy without the need to calculate in running goal expectancy for both sides, then relate that to time remaining and current score and compare their current match position with their hopes before kickoff. In short, if they are trailing or drawing, the very best are probably under performing and will be dissatisfied with their current game position.

However, it is less clear if say Wigan are in an agreeable position or capable of improving their lot by referring solely to the current score. In this post I showed that Wigan are more likely than usual to score if they trail, but more likely to concede than usual if they lead. Losing is obviously bad and therefore encourages sides to try to level the game, partly by increased effort and partly by taking more risks and the same situation applies to their opponents when a side such as Wigan lead. But when the game is level and involves non big four sides, it is much less clear where the incentive to attack or defend currently lies. To estimate which team may be driving for a win and which will be happy with a point, we need to go back to calculating regular game states for both sides.

Short cuts are always welcome, as long as they preserve the essential ingredients of the more labour intensive study. In this post  I showed how the pregame supremacy estimates are strongly related to the time a side will expect to spend leading, drawing and trailing in a match. So, if we use in running success rate, described here as a proxy for how the game actually went for a particular team and compare it to the pregame supremacy prediction expressed in a similar format, we can produce an informed guess as to how the game panned out for each team through the lens of actual game states compared to pregame aspirations.

For example last season Blackburn visited Old Trafford in a game that Ferguson would dearly want back. Unsurprisingly, United were strong pregame favourites and were given around a 83% chance of winning and 12% for the draw. In the format of success rate, where a team is given half credit for a draw and full credit for a projected win, that equates to a pregame projected success rate of 0.89. The reality was very different, Blackburn led for almost an hour, drew for just over half an hour and United never had the chance to lead, for an in running success rate from United's perspective of 0.19. A comparison of these two figures immediately tells us that United spent much of the time chasing a game and two goals from 27 shots appears to confirm this view.

As with Arsenal, this case is self evident, but the method allows us to tease apart the likely flow of attack and defensive contests in much closer match ups. This approach of comparing expectation with reality, may provide a quick, but reasonably representative way to add game state context to a multitude of stats, ranging from shot and save percentage to proportion of corners, without sacrificing the merits of the more detailed method involving repeated, team specific calculations.

To test this model, I looked to see if the league as a whole follows the Arsenal trait of having more frequent, but less accurate attempts overall in matches where they are likely playing catch up from their pregame expectations. I plotted shooting efficiency against the amount of deviation in actual in running success rate compared to pregame hopes and the trend appears to be present league wide. When likely trailing against expectation, in general, shots are less efficient, presumably as attempts become more speculative, against more concentrated defenses and from less able striking talent. R^2 is 0.17, which is huge for data points comprising individual games. R^2 is a hostage to sample size, and when sample size is small, random variation predominates, R^2 doesn't always need to be large. It too must be given context. Which is where we started this post.


Sunday, 19 August 2012

Quantifying Which Team Is Happier With The Current Scoreline.

One vital ingredient you need to add to your analysis of a football match is the current score context. Teams adjust their playing style depending upon whether they are comfortably ahead or well behind, generally adopting a less attacking and more defensive stance in the former case and vice versa in the latter. These micro shifts in emphasis can in turn impact upon in game match events such as shots and saves. For example a team chasing a game may produce more goal attempts, but they are often from further out, instigated by a wider pool of players and subject to more defensive pressure. This kind a subtle difference in shot or save quality is often lost in aggregated data, but visible in more granular batches.

The general game state for each team in a match is fairly easy to qualify if one team has an advantage on the scoreboard, but actually quantifying these positions as well as the numerous occasions when the match is stalemated requires more effort. Arsenal and Sunderland were level after a hour at the Emirates on Saturday and the visitors from the North East would have been much more comfortable with the scoreline than were their hosts. The real question is how much happier were Sunderland ?

One way to add context to such games is to calculate the combined win and draw expectancies for each team in running and track the change in these values compared to where they stood at kick off.


Full Time Score. 0-0.

Arsenal were unsurprisingly large pregame favourites to beat Sunderland, they were in the region of 70% likely to win the game and a shade under 20% to draw it. Combined, these two figures suggest that Arsenal's long term success rate (wins + half draws divided by games played) from such a match up would average just under 0.8 making Sunderland's long term success rate just over 0.2. 

As the game progresses, goal expectacies for each team also decline and at the still stalemated hour mark Arsenal's win probability would have been around the region of 0.5 and their predicted long term success rate for this game position would have declined from just under 0.8 at kick off to just under 0.7 now. In raw terms The Gunners had lost 0.1 of their pre match predicted success rate by their failure to score. In running success rates of rivals are intimately entwined, they must always total one, so Sunderland had seen their pre game success rate climb by the same amount. 

In this situation using game win a draw probabilities allows the 60th minute to be contextualized for both Arsenal and Sunderland. In non numerical terms, Sunderland are very happy and Arsenal aren't and this will partly dictate how each team approaches the final third of the match.

A further example from yesterday illustrates the effect of  goals in a more evenly matched game such as Newcastle's entertaining of Tottenham.


Scorers.
1-0, D Ba, 55'
1-1, Defoe, 76'
2-1, H B Arfa (pen), 81'

Newcastle are probably inferior to Tottenham at the moment, but home advantage gave them a very slight match day edge. In contrast to the Arsenal/Sunderland game, while the game remained or became level, both teams were probably fairly happy with the scoreline. This is denoted by the closeness of each team's plots to the neutral zero line and tactical approaches from both sides are likely to mirror those used league wide in evenly matched contests. Tottenham found themselves twice in losing positions, one of which they managed to salvage and league wide, teams attempt this rescue operation by committing more to attack than defence. 

Utilizing time and score specific success rate movements such as these into more granular shot data will prevent erroneous conclusions regarding team shot conversion rates being formed and being incorporated into aggregated totals. Teams, even good ones may appear to have declining shot conversion rates from previous years or previous months, but often this is because they may have found themselves trailing or drawing more often and therefore had more frequently faced overtly defensively minded opponents. This variation in game position is to be expected for all teams across and during seasons. One year Arsenal will find themselves trailing or drawing more often than previously through random variation rather than a sea change in team quality.

Aggregated data can be very useful, but it can also mislead.