In one sentence
A GAM is a GLM where each input's effect is a flexible smooth curve learned from data rather than a fixed straight line.
How it works
Many effects in sport are curved: goal rates rise through a match and spike near the end, and the value of rest days climbs, then levels off. A straight-line model forces these into a slope; a GAM lets the data draw the shape.
Each input gets its own smooth curve, built from flexible pieces called splines. The model adds these curves together (hence "additive"), then applies a link, just like a GLM. A penalty on wiggliness stops the curves chasing noise.
The big selling point is that you can still plot and inspect each effect. That makes GAMs a good middle ground between simple regression and black-box machine learning.
The maths
- g: the link function (log for goal rates, logit for probabilities).
- f_1 to f_k: smooth curves, one per input.
- λ_j: smoothing penalties; bigger values force straighter curves.
- f″: the curvature of each curve, which the penalty discourages.
In words: add up a smooth curve for each input, and balance fitting the data against keeping the curves gentle.
Worked betting example
An in-play goal-rate GAM: log goal rate per minute = log(0.030) + f(minute). The fitted curve gives f ≈ 0.05 for minutes 71 to 80 and f ≈ 0.20 for minutes 81 to 90 plus about 3 minutes of stoppage time.
The match is 0-0 after 70 minutes.
- Minutes 71 to 80: rate 0.030 × e^0.05 ≈ 0.0315 per minute, times 10 minutes ≈ 0.315 expected goals.
- Minutes 81 to 93: rate 0.030 × e^0.20 ≈ 0.0366 per minute, times 13 minutes ≈ 0.476 expected goals.
- Total expected goals remaining ≈ 0.792. Treating goals as a Poisson process, P(at least one goal) = 1 − e^(−0.792) ≈ 54.7%. Fair price for over 0.5 ≈ 1.83.
- Betfair prices: over 0.5 at 1.70, under 0.5 at 2.40.
- Backing under 0.5 with £10 at 2% commission: a win pays £14 × 0.98 = £13.72. EV ≈ 0.453 × £13.72 − 0.547 × £10 ≈ +£0.75.
- Backing over at 1.70 has EV ≈ −£0.78.
The baseline 0.030 should come from these two teams' pre-match expectations, not a league average, or the edge is illusory.
Where it's good
- In-play goal and point rates that change through a match.
- Effects with a natural curve: age curves for players, days since last run in racing, travel distance.
- Weather effects, such as temperature on scoring, where extremes matter.
- Replacing hand-made bands (for example, "0 to 7 days, 8 to 14 days") with a smooth fit.
- Explaining a model to yourself: each plotted curve is a clear story.
Limitations and pitfalls
- Curves can still overfit where data is thin, especially at the edges of the input range.
- Interactions (for example, the minute effect depending on the score) must be added explicitly as two-way smooths, which need much more data.
- Choosing the number of spline pieces and smoothing method changes results; check sensitivity.
- In-play, markets react within seconds; a model that is right but slow cannot get matched at the price it wants.
- Extrapolating beyond the data, such as unusual stoppage times, is unreliable.
- Betfair in-play markets have a delay and suspend on events, which limits how you can act on model output.
How to build it
- R: mgcv is the gold standard. Python: pygam, or statsmodels GLMGam.
- Data: for in-play rates, minute-by-minute records with goals and match state.
- Let the software choose smoothness by REML or cross-validation rather than setting it by hand.
- Tip: plot every fitted curve with its confidence band before using the model; wild wiggles are a warning sign.
Related methods
- Generalised linear models: the straight-line version.
- Linear regression: the simplest member of the family.
- Survival analysis: another way to model time to the next goal.
- Regularisation: the same penalty idea applied to coefficients.
- Poisson processes: the model for goals arriving over time.