Three of the best recent xG papers could not be reproduced one-to-one on open data, because each leans on something Statsbomb does not publish: tracking speeds, reception speeds, the duration of the previous event. So for my 2024 undergraduate project at UFRJ I did the next best thing. I took the variables from Anzer & Bauer, Hewitt & Karakuş and Narayanan & Pifer that can be computed from Statsbomb event data, merged them into one feature set and trained a single model on it. That model is the one labelled Aggregated xG in the simulator, and it is the one that agrees most closely with Statsbomb’s own xG. This article explains what went into it, what was left out, and how it was chosen.

Three papers, three kinds of data

Anzer & Bauer (2021) built their model on 105,627 Bundesliga shots with synchronised event and optical tracking data. Their distinctive contribution is the position of every defender and of the goalkeeper at the moment of the shot, which lets them derive the speed of the shooter and the pressure applied by defenders. They trained separate gradient boosting models for shots with the foot, headers and direct free kicks.

Hewitt & Karakuş (2023) used 15,575 shots, logistic regression and gradient boosting, and the usual geometric features. Their novelty is a position-adjusted xG, with separate estimates for forwards, midfielders and defenders, and a player-adjusted version fitted to Lionel Messi to quantify how far above the average his finishing sits.

Narayanan & Pifer (2024) trained xG and post-shot xG models on 28,942 Statsbomb shots to show that models built on men’s football misestimate women’s shots. Their feature list is rich in context: player density inside the shot triangle, the distance to the two nearest defenders, first-time shots, pressure, technique and body part, plus timing variables such as reception speed, shot speed, the duration of the previous event and the distance covered before shooting.

The simulator needs models that ignore player identity and that run on the data Statsbomb gives away for free. Each paper fails one of those tests in part: Anzer & Bauer need tracking data, Hewitt & Karakuş adjust by player and position, and Narayanan & Pifer use timing variables that the open event feed does not contain. The remaining features overlap heavily, so instead of three crippled replicas I built one model from the union of what survives. A second reason was variety: a fourth model that behaves differently from the Kos Angle model and the CNN makes the simulator more useful as a comparison tool.

The feature set

The merged model is trained on sixteen variables. The simulator exposes most of them in its results table, which is why names such as d1 and density appear there.

VariableWhat it measuresSource
x, yBall position in Statsbomb coordinates (x from 60 to 120, y from 0 to 80).All three
goalkeeper x, yGoalkeeper position in the same coordinates.Anzer & Bauer
distanceDistance from the ball to the centre of the goal line.Hewitt & Karakuş, Narayanan & Pifer
goalkeeper distanceDistance from the goalkeeper to the centre of the goal line.Hewitt & Karakuş
angleAngle at the ball between the two posts, in degrees.Hewitt & Karakuş, Narayanan & Pifer
players inside shotNumber of players inside the shot triangle.All three
player densityPlayers inside the triangle divided by the triangle’s area.Narayanan & Pifer
d1, d2Distance from the shooter to the nearest and second-nearest defender inside the triangle.Narayanan & Pifer
first timeWhether the shot was taken first time.Hewitt & Karakuş, Narayanan & Pifer
under pressureWhether the shooter was under pressure.Hewitt & Karakuş, Narayanan & Pifer
open goalWhether the goal was open at the moment of the shot.Hewitt & Karakuş
techniqueVolley, half volley, lob, backheel and so on.Hewitt & Karakuş, Narayanan & Pifer
body partLeft foot, right foot, head or other.Anzer & Bauer, Narayanan & Pifer

Two details deserve a note. The goalkeeper enters twice, once as raw coordinates and once as a distance to goal, so the model can learn both “the keeper is off their line” and “the keeper is covering the wrong post”. And the density and d1/d2 variables turn the vague idea of a crowded box into three numbers: how many bodies are in the lane, how tightly packed they are, and how close the nearest ones are to the shooter.

Counting players differently on purpose

The Kos Angle model counts a player as inside the shot triangle if any part of their body, given a fixed width, overlaps it. For the combined model I deliberately changed the rule: a player counts only if the centre of their body is inside the triangle, and the count includes teammates and the goalkeeper as well as defenders.

I made the change so that the two models would react differently to the same scene, and so that the difference would be visible in the simulator. That is why the results table shows two separate rows, Players inside shot (Karim & Marwane) and Players inside shot (Aggregated). Drag a defender so that they straddle the edge of the lane and you will see one counter move before the other. A player standing on the boundary blocks part of the goal in reality, so the Kos Angle rule is arguably the more physical one; the centre rule is simpler and closer to how the original papers describe the feature.

Training: logistic regression, AdaBoost, gradient boosting

The training set is the same 23,098 Statsbomb open-play shots used for every re-trained model on this site: Bundesliga 2023/24, Ligue 1 2022/23, Serie A and Premier League 2015/16, the 2018/19 Champions League, Euro 2020 and the 2022 World Cup, with free kicks and penalties removed. The three classifiers come from the source papers: logistic regression (Hewitt & Karakuş, Narayanan & Pifer), AdaBoost (Narayanan & Pifer) and gradient boosting (all three). Hyperparameters were picked by grid search, following the same procedure as the Kos Angle re-training.

ClassifierPrecisionRecallRMSEBrierROC-AUC
Logistic regression0.81860.78270.44200.14000.8858
AdaBoost0.85990.81670.39770.23560.9230
Gradient boosting0.89290.82920.36760.10490.9396

As in the Kos Angle article, the precision and recall figures are high because the classes were balanced for training; on raw data, where only about one shot in ten is a goal, they would be far lower. Read the table for its ordering rather than its absolute values. Gradient boosting is best on every column. AdaBoost beats logistic regression on classification metrics but has by far the worst Brier score, which is the first hint of a problem that the next table makes impossible to miss.

Choosing the model: agreement with Statsbomb

A classifier that separates goals from misses is not automatically a good xG model, because xG is a probability and the probability has to be right. To pick the model for the simulator I trained on the first 18,500 shots, roughly 80%, and compared each model’s xG with Statsbomb’s own xG on the remaining 20%, about 4,600 shots containing 474 goals.

ModelTotal xGMAERMSEPearson r
Goals actually scored474–––
Statsbomb (reference)438.5–––
Logistic regression454.20.03330.05820.88
AdaBoost2,126.40.37590.38540.80
Gradient boosting447.70.02840.05080.91

AdaBoost’s total is not a typo. Across roughly 4,600 shots it handed out 2,126 expected goals, an average of about 0.46 per shot, for a sample in which about one shot in ten went in. Its correlation with Statsbomb is still a respectable 0.80, which tells you it ranks shots sensibly; it simply cannot put them on the right scale. That is a known property of AdaBoost’s probability output, which is a squashed sum of weak learners and tends to bunch near 0.5 unless it is calibrated afterwards. The Brier score of 0.2356 in the previous table was the same fact seen from the other side. For an xG model, this is disqualifying on its own.

Logistic regression and gradient boosting both land within a few goals of Statsbomb’s total, and all three sit below the 474 goals actually scored, which is reassuring rather than worrying: a test sample where finishing beat expectation should look that way under any well-calibrated model. Gradient boosting wins on all three agreement metrics, with a mean absolute difference of under 0.03 xG per shot and a correlation of 0.91. It is the model that runs in the simulator as Aggregated xG.

How it compares with the other models on the site

The 0.91 correlation is the highest of any model in the simulator against Statsbomb. The gradient boosting version of the Kos Angle model reaches 0.80 on the same held-out set, and the CNN models reach 0.82 (original) and 0.69 (re-trained) on a separate La Liga 2020/21 sample, so the numbers are not all measured on identical shots. Still, the gap is wide enough to mean something. The most plausible reason is also the least exciting: Statsbomb’s own model uses the same kind of inputs. Event data with freeze frames gives you ball position, keeper position, defenders in the lane, technique, body part and pressure, and that is almost exactly this feature list. A model trained to mimic Statsbomb from Statsbomb inputs has an easier job than one trying to see the same thing through a 30×40 image.

Agreement with a commercial model is not the same as truth, and the models-compared article goes into why no xG number is the number. But if you want a single value from the simulator that behaves like the figures you see on broadcasts, this is the row to read first.

Where it behaves differently

Chapter 5 of my project puts a ball on the goal line with nobody around it. The Kos Angle model returns 98%; the combined model returns 78%. Both are high, but the 20-point gap is instructive. The Kos Angle model has one dominant feature that is maximised by an empty triangle. The combined model spreads its attention over sixteen features, several of which, such as d1, d2 and density, are undefined or zero when the lane is empty, a situation that is rare in the training data. Gradient boosting does not extrapolate; it returns whatever the nearest populated leaves say, and those leaves were grown on real shots, which almost never happen from the goal line with no defender in sight.

Open the goal-line shot in the simulator

The flip side is that in ordinary scenes, with a keeper in position and two or three defenders around, the combined model is the one with the most to say. It is the only model in the simulator that knows where the keeper is standing, whether the shot was first time, and how far the nearest defender is from the shooter. That is why it tends to react most when you toggle under pressure or move the goalkeeper off the line while leaving everything else untouched.

Limits worth knowing

  • No speed, no time. The timing features from Narayanan & Pifer and the shooter speed from Anzer & Bauer are gone. A shot at the end of a counter-attack and a shot from a static build-up look the same to this model.
  • No per-position or per-player adjustment. The point of Hewitt & Karakuş was to adjust by role; this model, by design, does not know who is shooting.
  • No separate header model. Anzer & Bauer trained headers separately. Here the body part is just one categorical feature among sixteen.
  • Balanced training. As with the other re-trained models, class balancing changes what precision and recall mean, and the Statsbomb comparison is the fairer yardstick.

Further reading

  • Where xG models disagree — three shots, real and invented, where the four models part ways.
  • The Kos Angle explained — the model that counts bodies in the lane the other way.
  • The xG glossary — Brier score, MAE, Pearson correlation and friends in plain English.
  • Open the simulator, build a shot, then move only the goalkeeper and watch which rows change.

Sources: Anzer, G.; Bauer, P. (2021). A Goal Scoring Probability Model for Shots Based on Synchronized Positional and Event Data in Football (Soccer). Frontiers in Sports and Active Living, 3. DOI 10.3389/fspor.2021.624475. Hewitt, J. H.; Karakuş, O. (2023). A machine learning approach for player and position adjusted expected goals in football (soccer). Franklin Open, 4. Narayanan, S.; Pifer, N. D. (2024). An xG of Their Own. Journal of Sport Management, 38(2), 92–109. DOI 10.1123/jsm.2023-0022. Training results from Schlaepfer, A. (2024). Modelos de expected goals no futebol: desenvolvimento de um simulador de chutes. Undergraduate project, UFRJ.