Niana Analytics · football data hubMetrics · tactical data · formats · video analysis

Home › How metrics are calculated

How expected goals models are built and where they break

Niana Analytics desk · How metrics are calculated ·
How expected goals models are built and where they break

Expected goals is quoted as if it were one agreed quantity. It is not. Every xG figure is the output of a particular model, trained on a particular library of shots, with a particular list of inputs. Two values for the same attempt can differ without either being dishonest.

In this guide (7)
  1. What the model is actually asked
  2. The training set decides the model
  3. Location: distance and angle
  4. Foot, head and the type of attempt
  5. Pressure, defenders and the pass before
  6. Where the logic stops working
  7. Reading the number honestly

This guide takes the model apart rather than the metric's reputation. It covers the question a model is trained to answer, the features that enter it, the way those features push a probability up or down, and the situations where the logic quietly stops working.

What the model is actually asked

An xG model is a classifier before it is anything else. It is shown a large archive of historical attempts, each labelled with what actually happened, and it learns which characteristics separate the goals from the misses.

The output is a probability for one shot, never a forecast of a scoreline. Adding those probabilities across a match gives a total, and that total is a statement about the quality of the chances created rather than about the result. Because the learning is empirical, the model also inherits the habits of its data: a competition where shooting from range is common teaches a different baseline from one where nearly every attempt arrives from inside the area.

The training set decides the model

Two models with identical features can still disagree if they learned from different football. The competitions, the era and the quality of the underlying event data all shape the weights.

Data quality is the quiet variable. If the recorded position of an attempt is imprecise, or if the log misses some attempts entirely, the model learns a distorted relationship between position and outcome.

That is why a model should be judged on calibration rather than on a memorable miss. Calibration means the predicted probabilities hold up in aggregate across thousands of attempts, not that the model looks right on a highlight reel.

Location: distance and angle

Distance to goal is the dominant input in almost every published model. Close-range attempts convert far more often than efforts from outside the area, and the relationship is steep rather than gradual.

Angle works alongside distance. A position level with the goal but wide of the post offers a narrow view of the target, and the model treats that narrowness as a penalty even when the distance is short.

What the model is fedWhat it never sees
Distance and angle to goalThe identity and form of the shooter
Body part used for the attemptWeather, surface and fatigue
Type of pass that created itThe tactical reason the space appeared
Defenders between ball and goalWhether a better option was available
Set piece against open playDeflections and lucky bounces

Foot, head and the type of attempt

The body part is the second family of inputs. Headers convert at a lower rate than shots with the foot from a comparable position, and models encode that gap directly.

The type of attempt carries information too. A first-time strike from a cut-back, a volley from a cross and a controlled finish after a turn are different events even from the same spot, and the finer models separate them.

Some models also record whether the attempt followed a dribble, because a shooter who has just beaten a defender faces a different picture from one receiving the ball with the defence set.

Pressure, defenders and the pass before

Pressure is the feature that separates a basic model from a modern one. An attempt struck with a defender closing and a goalkeeper set is harder than the same attempt struck in space, and the model needs a way to say so.

Event data alone struggles here, because it records actions rather than proximity. Tracking data and pressure events fill the gap, which is one reason two providers can return different values for an identical-looking chance.

The pass before the shot is the last common input. A pull-back from the byline creates a different quality of chance from a hopeful cross, and models that record the pass type reward the difference.

Where the logic stops working

A model cannot know whether the attempt was the right decision. It scores the shot that happened, not the pass that was available, so a side that shoots wastefully from good positions can look respectable while a side that refuses bad shots is quietly penalised.

Rebounds and deflections are awkward in the same way. A scrambled finish after a block is a real chance in the data, but its probability rests on events the model barely observes.

Imperfect input leaks into the output at the edges. Unrecorded attempts, mislabelled body parts and inconsistent pitch geometry all make a model look more confident than its evidence allows, and none of that is visible in the final number.

Reading the number honestly

A few reading habits keep an xG figure useful, and none of them require knowing the exact specification behind it.

  • Compare values from one provider over time, not across providers for one match.
  • Read a run of matches before drawing a conclusion from a single game.
  • Treat a lasting gap between xG and goals as a question, not a verdict.
  • Check whether penalties and set pieces are counted separately.
  • Remember the model scores decisions made, not decisions available.
  • State which model produced the figure before quoting it.

None of this makes expected goals unreliable. It makes the metric specific: a well-defined question about the quality of the chances a team created, answered with the assumptions of whichever model produced the number.

Read that way the figure earns its place. It describes the attempts, and it leaves the argument about who deserved to win to the people watching.

Common questions

How is xG calculated from individual shots?

Every attempt is scored by a model trained on a large archive of past shots, each labelled with whether it became a goal. The model learns which features separate goals from misses and applies those weights to a new attempt, returning a probability between zero and one. Those probabilities are then added together to give a match or season total.

Why do two sites show different xG for the same match?

Because they are different models. Providers train on different competitions and eras, record different features, and treat penalties, deflections and set pieces in their own way. The correct habit is to compare a team's values within one provider over time, and never to mix sources when reading a trend.

Which features matter most in an xG model?

Distance to goal and the angle to the target dominate, and most implementations combine them into one geometric description of the shooting position. Body part, the type of pass that created the chance, pressure from defenders and the distinction between set piece and open play adjust that baseline. The shooter's reputation is usually left out on purpose.

Does a higher xG mean a team deserved to win?

No. xG measures the quality of the chances a team produced, not the fairness of the result or the merit of the performance. A side can create better chances and lose, and the model has no view on whether the right pass was played. Read the gap between xG and goals as a prompt for further questions.

About our numbers. Every figure on this site describes a method, a formula or a competition rule. We deliberately do not publish invented player statistics, match scores or rankings, and we add no links to outside sites. Read every metric as a tool with a definition, not as a verdict.

Read next

How metrics are calculated

How xA is calculated: crediting the pass before the shot

Expected assists explained: how a pass inherits the xG of the shot it creates, which pass traits raise the value, and why xA misses the pass before the pass.

How metrics are calculated

How is xGOT calculated? Post-shot models explained

Post-shot expected goals explained: why on-target placement replaces shot location, how goalkeeper position enters the model and how to read the gap with xG.

How metrics are calculated

How PPDA is calculated: passes allowed per defensive action

PPDA explained: the passes allowed per defensive action ratio, which events enter the denominator, why the zone matters and what the number hides.