tag:blogger.com,1999:blog-79240389573397471812021-12-14T01:46:49.869-08:00vfbstatistischJBhttp://www.blogger.com/profile/16705368457050570901noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-7924038957339747181.post-15580730150613700702017-11-18T05:09:00.000-08:002017-11-18T05:09:04.309-08:00Insights about xG in single matches and goal probability distributions <div class="hidepic" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-C9ZBuCuuWds/WhAwvauy9rI/AAAAAAAABOk/Wphwzw8pcI8-f2CWK0kCBjqXP5wR5lsNgCLcBGAs/s1600/xG1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="595" data-original-width="800" height="150" src="https://3.bp.blogspot.com/-C9ZBuCuuWds/WhAwvauy9rI/AAAAAAAABOk/Wphwzw8pcI8-f2CWK0kCBjqXP5wR5lsNgCLcBGAs/s300-c/xG1.png" width="150" /></a></div>
Summing up the xG values of a team's chances during a game is problematic. In this text, I try to show some counter-intuitive insights about "expected scorelines" by looking at the underlying probability distributions over the number of goals.<br />
<a name='more'></a><br />
<i>(This text in a sense builds on parts of <a href="https://medium.com/@dannypage/expected-goals-just-don-t-add-up-they-also-multiply-1dfd9b52c7d0">this 2014 article by Danny Page</a> and also <a href="https://medium.com/@ferdiaoh/interpreting-the-expected-goals-of-single-matches-d0572f141545">this recent one by Ferdia O'Hanrahan</a> and there are probably a lot more people who did similar work already. However, I wanted to get some intuition about one or two things that I haven't seen being discussed deeply enough to really understand what's going on. Hence, this article exists.)</i><br />
<br />
Based on a number of chances with xG values assigned to them, the number of goals a team scores during a football match can be modeled as a so called <a href="https://en.wikipedia.org/wiki/Poisson_binomial_distribution">poisson binomial distribution</a>. This distribution is generated by doing binary success/failure experiments repeatedly with varying probabilities of success. In this case, the experiments are shots (plus maybe other dangerous situations) and the probability of success is the xG value assigned to them. The probability distribution assigns each number of goals a probability that this number of goals is scored from the chances (respectively their xG values) it was generated from.<br />
<br />
<div class="postbreite" style="clear: both; text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-xjXqjo5kyUg/Wg8E0a_4fcI/AAAAAAAABNs/yRWbfAs8OlsbYuE1hzSTKF7xYAclO7GYQCLcBGAs/s1600/xG1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="595" data-original-width="800" height="297" src="https://2.bp.blogspot.com/-xjXqjo5kyUg/Wg8E0a_4fcI/AAAAAAAABNs/yRWbfAs8OlsbYuE1hzSTKF7xYAclO7GYQCLcBGAs/s1600/xG1.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">A simple example for how such a probability distribution looks like.</td></tr>
</tbody></table>
</div>
<br />
The xG sum is also the <i>mean</i> of this distribution.* If you take a look at the example, 2.2 and 0.3 lie pretty much in the center of the distributions. If you would simulate these shots 10,000 times, add all the goals up, and divide them by 10,000 you would get about 2.2 goals for Team Red and 0.3 goals for Team Blue.<br />
<br />
Now, the problem is that the poisson binomial distribution can look very differently depending on which xG values you aggregate (and that part of this effect on shape is hard to quantify). Blue's distribution above is highly asymmetrical, sharp and not far spread out, whereas Red's distribution looks more symmetrical, more spread out and flatter.<br />
<br />
Without considering the shape of the underlying distribution, the mean (i.e. the xG sum) is prone to misinterpretation.<br />
<br />
Here are three insights I gained from playing around with this stuff:<br />
<br />
<h4>
1. The (rounded) xG sum is not necessarily equal to the most probable number of goals</h4>
<br />
Look at this example:<br />
<br />
<div class="postbreite" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-M82FOPOvltM/Wg8Jb0E8hFI/AAAAAAAABN4/a9xSKArUeeYHUGxOSFVrn9faU1VcqMCYQCLcBGAs/s1600/xG2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="595" data-original-width="800" height="297" src="https://4.bp.blogspot.com/-M82FOPOvltM/Wg8Jb0E8hFI/AAAAAAAABN4/a9xSKArUeeYHUGxOSFVrn9faU1VcqMCYQCLcBGAs/s1600/xG2.png" width="400" /></a></div>
<br />
Both teams have an xG sum of 1.8. Team Blue achieved this with many low-xG-chances and Team Red with few high-xG-chances. The mode (= the most probable number of goals = the peak of the probability distribution ≠ the mean) of Team Red lies clearly at 2 goals, the number nearest to 1.8. However, for Team Blue, scoring two goals and scoring one goal are pretty much equally likely (actually, scoring two goals is even slightly <i>less</i> likely than scoring one goal!).<br />
<br />
So, if Team Blue scores one goal from this game, you actually shouldn't be more surprised than if they score two. The notion that Team Blue "underperformed" is however still valid. The probability that they score <i>two or more</i> goals from these chances is higher than scoring one goal or none.<br />
<br />
The second insight is related:<br />
<br />
<h4>
2. More chances lead to more variance in the result.</h4>
<br />
This one is intuitively clear. The more chances you have, the more different amounts of goals you can score and (on average) the lower the chance of scoring a particular number of goals. This is especially the case if you have many chances, the outcome of which is hard to predict, i.e. chances valued around 0.5 xG (which correspond to pretty high quality in the low scoring game football). If you have twenty chances worth 0.02 xG, you will most likely score zero or one goal. The distribution will have low variance. Yet, any additional chance inscreases the variance of the number of goals scored. The closer they are to 0.5 xG, the more they do so.**<br />
<br />
Some consequences of this are:<br />
<br />
<ul>
<li>A high deviation of a team's actual goals from its expected goals should be less surprising if they had a lot of chances. See the example above.</li>
<li>When the expected scoreline is close, a draw can still be unlikely if there were many chances in the game.</li>
<li>While more shots and higher chance quality obviously increase your chances of winning (as they increase your xG sum), they almost inevitably make your goal output more erratic.</li>
</ul>
<br />
<h4>
3. You can be less likely to win a game despite having a higher xG sum.</h4>
<br />
When you multiply the probability of team A scoring 2 goals with the probability of team B scoring 0 goals you get the probability of the game ending with a 2:0. Adding up these "result proabilities" you can compute a probability of team A winning, team B winning and a draw.<br />
<br />
What's interesting is, that even when the xG sum of team A and team B are equal, the winning probabilities of these teams are almost always unequal. Starting from an extreme instance of this you can even construct cases where the team that leads by xG actually has a lower chance of winning the game. For example:<br />
<br />
<div class="postbreite" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-p94PymkpC9M/Wg8X9qfsqBI/AAAAAAAABOU/yamNjajGbcIy5H6LuQ5VnO2wW0gULgHAwCLcBGAs/s1600/xG4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="595" data-original-width="800" height="297" src="https://3.bp.blogspot.com/-p94PymkpC9M/Wg8X9qfsqBI/AAAAAAAABOU/yamNjajGbcIy5H6LuQ5VnO2wW0gULgHAwCLcBGAs/s1600/xG4.png" width="400" /></a></div>
<br />
You can compute that Team Red has a winning chance of 37.1% and Team Blue has a winning chance of 33.7% <b style="background-color: #f8f9fa; color: #222222; font-family: sans-serif; font-size: 13.3px; text-align: -webkit-center;">–</b> a difference of 3.4 percent points. Projected onto a season of 34 games this corresponds to a difference of about three and a half points.<br />
<br />
From the example <a href="http://thepowerofgoals.blogspot.de/2014/02/twelve-shots-good-two-shots-better.html">(and as Mark Taylor already suspected in this 2014 article)</a> it seems like this effect could be a many chances vs few big chances thing. If you have one or two high-qualitiy chances, you are very unlikely to score none of them and that way you may decrease your probability of losing by an exceptionally high amount.<br />
<br />
To make more precise statements, you would have to analyze what affects the shape of the distribution and its conversion to goal difference and winning percentages, which is a lot more complicated than looking at the plain mean and variance.<br />
<br />
Still, it would be interesting to see how this asymmetry works, what inuitively causes it and how relevant it is.<br />
<br />
<br />
________________<br />
<br />
* The mean of a poisson binomial distribution is simply the sum of the individual "success probabilities" of the single experiments. See <a href="https://en.wikipedia.org/wiki/Poisson_binomial_distribution">wikipedia</a>.<br />
<br />
** The variance of a poisson binomial distribution is the sum of terms of the form (p_i * (1 - p_i)) ranging over all experiments, where p_i is the success probability of a single experiment. If you plot this term over p_i, you will see a peak at 0.5 and a value of zero at 0 and 1. Again, see <a href="https://en.wikipedia.org/wiki/Poisson_binomial_distribution">wikipedia</a> for the formula.JBhttp://www.blogger.com/profile/16705368457050570901noreply@blogger.comtag:blogger.com,1999:blog-7924038957339747181.post-75599068335202118362017-01-17T13:28:00.002-08:002017-02-25T11:17:24.194-08:00Voronoi diagrams with velocity<div class="hidepic">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-ipIqSDDzD0w/WH6i8oNVsdI/AAAAAAAAA_k/NXqR4j2pfYYy00-sQfwXiX8H64gkr6obQCLcB/s1600/voronoi_velo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://4.bp.blogspot.com/-ipIqSDDzD0w/WH6i8oNVsdI/AAAAAAAAA_k/NXqR4j2pfYYy00-sQfwXiX8H64gkr6obQCLcB/s300-c/voronoi_velo.png" width="150" /></a></div>
</div>
<i>Voronoi diagrams are an interesting approach to visualize and analyse constellations of players on the pitch. In this article we want to observe what happens when we add information about velocities to the naive version which works with pure positional data.</i><br />
<a name='more'></a><br />
When watching and analysing football games, one task is to find out which regions or spaces are decisive for the emergence of goals and which of these are threatened by the attacking team or controlled by the defending one. This way you identify stuff like holes in the build-up structure which can not only hinder progression but also turn into dangerous counter-spaces after losing the ball. Also we might find general information about which spaces are systematically controlled by a team and which are rather vulnerable. In any case, always both teams are taken into account. A hole in your defensive shape doesn't need to be a problem if your opponent doesn't threaten it.<br />
<br />
Voronoi diagrams are the standard approach for subdividing the pitch in a way that is supposed to tells us something about which spaces are <i>controlled</i> by who. In the basic implementation, we divide the football field into 22 so-called Voronoi cells, one for each player. Every point inside of one player's cell is then supposed to be closer to this player than to any of the other 21. For this article, I will combine the cells of the players team-wise to obtain a team-based subdivision.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-OiJki398Hog/WICXNvwPaWI/AAAAAAAABAQ/CPv-ctVVG88sOfQayTzGUPcZLOWHPtwfgCLcB/s1600/fckbru_e.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://1.bp.blogspot.com/-OiJki398Hog/WICXNvwPaWI/AAAAAAAABAQ/CPv-ctVVG88sOfQayTzGUPcZLOWHPtwfgCLcB/s1600/fckbru_e.png" width="442" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Example diagram based on a scene from FC Kopenhagen vs FC Brügge in<br />
the 2016 Champions League. The ball-carrier is marked with an orange dot. <a href="https://twitter.com/vfbtaktisch/status/782698917347688452">Brügge's</a><br />
<a href="https://twitter.com/vfbtaktisch/status/782698917347688452">pressing is (sometimes) world class, by the way.</a></td></tr>
</tbody></table>
<br />
The light blue and the grey areas are the combined cells of Kopenhagen's and Brügge's players. The standard implementation of Voronoi diagrams employs regular Euclidean distance to measure how close two points are to each other. So, here, the interpretation of some point 'x' in space sitting in the cell of player 'A' would be something like this: If every player stood still and the ball suddenly popped up at 'x' and everyone would start to run at 'x' at the same time with the same speed, 'A' would be the one who reaches it first.<br />
<br />
Obviously, some of these implications are problematic when we are looking for a meaning similar to "control over space". Firstly, balls don't suddenly pop up anywhere. Take the situation above where Kopenhagen's Erik Johansson possesses the ball. If, for example, he played a high ball to exactly the point where winger Benjamin Verbic stands right now, the pass would take some time. In the meantime, Brügge's left winger Izquierdo might arrive before the pass does and we would have a duel for the ball and maybe a turnover. Not exactly what you would expect when playing the ball into "controlled space".<br />
<br />
But let's leave the the ball aside for now and tackle another important problem. Football is a highly dynamic game, where players constantly move around, as opposed to the static setting implied by the diagram above. Say, Kopenhagen's striker Santander was right at the moment sprinting forward while Brügge's defenders stood still, he might use his tempo advantage and reach a long ball behind the defensive line rather easily. To capture effects like this, we need to base our diagram on a metric other than Euclidean distance.<br />
<br />
So, first of all, instead of just looking at the static 2D positions, we add an instantaneous velocity for each player. Also, let's assume that each player moves with uniform and equal acceleration. This is not super realistic, but a useful simplification for now. Then we define the distance between a player and a point in space as <i>the shortest possible time, in which the player can reach this point</i>, given his limited acceleration. That is, if he's running away from a certain point in space, he has to decelerate first and re-accelerate which takes him more time than if he was starting with zero momentum. Conversely, if he's running towards a point in space, he will reach it quicker thanks to his tempo advantage.<br />
<br />
So let's take a look at the example scene, now with velocities.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-ReDYipmcxek/WICXeEPAIsI/AAAAAAAABAU/XWvo0gqbEqg40d5bCQSHd_W8rLJYLP1WgCLcB/s1600/fckbru_v.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://4.bp.blogspot.com/-ReDYipmcxek/WICXeEPAIsI/AAAAAAAABAU/XWvo0gqbEqg40d5bCQSHd_W8rLJYLP1WgCLcB/s1600/fckbru_v.png" width="438" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The same scene taking accout of current velocities, visualized as arrows.</td></tr>
</tbody></table>
<br />
The information gain we obtain is reflected by a more complex and nuanced structure of the cell borders. We can oberve that left winger Falk, who is currently drifting inside could be found by a pass into Brügge's incompact midfield centre, indicated by the blue patch on the half-left. I also like the curved shape of the Poulain-Santander-van Rhijn lines, indicating that Poulain's preventive dropping against Santander's run enables him to cover the direct path towards the goal even if a super precise long ball is played into the blue area. The narrowness of this blue stripe shows that Santander is not likely to receive a ball without immediate pressure there.<br />
<br />
So this is somewhat nicer and more intuitive, but some limitations of the approach are still visible as well. For example, the blue spaces around Falk and Delaney are actually totally under control of Vanaken and Vossen by means of their cover shadows. Also, we expect points in space that are close to the borders to be easier to set under pressure for the defending teams. Thus, large patches are nicer for the attacking team than narrow slices. Adding soft borders, taking into account <i>how much</i> earlier a player reaches this point is probably an easy way to add more nuance to this.<br />
<br />
Below, I have added two more plots, that may provide the one or other insight. The first one is taken from the <a href="http://vfbtaktisch.blogspot.com/2015/02/uefa-cup-finale-1989-ssc-neapel-vfb.html">1989 UEFA Cup final</a> where both teams defended man-to-man and with lower intensity compared to today's standards. Since a lot of offensive movement was simply mirrored by the players' corresponding man-markers at that time, there might have been less and rather boring dynamic effects in general. In this case the two methods yield pretty similar results.<br />
<br />
<a href="https://3.bp.blogspot.com/-Jl9Zg1tDK2o/WICZjMDKF-I/AAAAAAAABAs/4_zB9-YCtqcOFpyvS_2SYnJUjNFcUvCMACLcB/s1600/sscvfb_e.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://3.bp.blogspot.com/-Jl9Zg1tDK2o/WICZjMDKF-I/AAAAAAAABAs/4_zB9-YCtqcOFpyvS_2SYnJUjNFcUvCMACLcB/s1600/sscvfb_e.png" width="217" /></a><a href="https://4.bp.blogspot.com/-rFGoIKTBDxc/WICZjF6kBII/AAAAAAAABAw/ifL6qT_Lum0gv5z-Jtrep797lheXdr46gCLcB/s1600/sscvfb_v.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="320" src="https://4.bp.blogspot.com/-rFGoIKTBDxc/WICZjF6kBII/AAAAAAAABAw/ifL6qT_Lum0gv5z-Jtrep797lheXdr46gCLcB/s1600/sscvfb_v.png" width="215" /></a><br />
<br />
The last example is from a 2016 game again and shows a counterattack by Borussia Mönchengladbach which is intercepted by FC Ingolstadt. Accounting for the pressure the ball-carrier (in this case Stindl) is under, might me another issue that has to be taken care of.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-_H8KdEVE9pQ/WICYDp8b7YI/AAAAAAAABAc/tVJP-NdjqyQQIO_ksKceOVWSVj5uivAvACLcB/s1600/glaing_e.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://3.bp.blogspot.com/-_H8KdEVE9pQ/WICYDp8b7YI/AAAAAAAABAc/tVJP-NdjqyQQIO_ksKceOVWSVj5uivAvACLcB/s1600/glaing_e.png" width="218" /></a></div>
<a href="https://1.bp.blogspot.com/-GoJHw0Kj8hU/WICYD3MesMI/AAAAAAAABAg/h3rXmaqL8gk5x16afgW89rRJZaVprBT0ACLcB/s1600/glaing_v.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="320" src="https://1.bp.blogspot.com/-GoJHw0Kj8hU/WICYD3MesMI/AAAAAAAABAg/h3rXmaqL8gk5x16afgW89rRJZaVprBT0ACLcB/s1600/glaing_v.png" width="215" /></a>JBhttp://www.blogger.com/profile/16705368457050570901noreply@blogger.com