Tournament Prediction with Elo Ratings and Monte Carlo Simulation
Learn how to build a tournament championship prediction model by combining Elo ratings, Poisson-distributed goal scoring, and Monte Carlo simulation. This article walks through the three core components—strength representation, match outcome generation, and bracket simulation—with runnable Python code and guidance on interpreting the results.
1. Problem Definition
Predicting the probability of each team winning a tournament comes down to one question: given the strength of each team and the structure of the schedule, what is the probability that each team ultimately wins the title? This problem consists of three parts.
The first is strength representation: quantifying the differences between teams into comparable numbers.
The second is single-match outcome generation: converting strength differences into win/draw/loss outcomes and score distributions for an individual match.
The third is schedule simulation: repeatedly simulating the entire tournament according to the real competition format and tallying the distribution of champions.
The approach adopted in this article is: use Elo ratings to represent team strength, use the Poisson distribution to generate goal counts, and use Monte Carlo methods to repeatedly simulate the full schedule. This combination is simple and produces interpretable results, making it well suited as a baseline implementation for a prediction model.
2. The Elo Rating System
The Elo rating was originally used to rank players in head-to-head competitive games. Its core idea is: after each match, adjust both sides’ ratings based on the gap between the actual result and the expected result. The side that performs above expectation gains points; the side that underperforms loses points.
2.1 Expected Win Probability
Let the ratings of teams A and B be R_A and R_B. The expected score of A against B is:
E_A = 1 / (1 + 10^((R_B − R_A) / 400))
Here, 400 is a commonly used scale parameter. In a binary model that only considers wins and losses, a rating gap of 400 points corresponds to a theoretical win probability of about 91% for the stronger team. Soccer matches can end in draws, so a separate mechanism for handling draws is needed in practice; the code later in this article shows how.
2.2 Rating Updates
After a match, the rating is updated as follows:
R’_A = R_A + K × (S_A − E_A)
S_A is the actual score: 1 for a win, 0.5 for a draw, and 0 for a loss. K is the update step size, which determines how sensitive the rating is to recent results. A larger K produces more volatile ratings; a smaller K produces more stable ones.
In soccer, matches vary greatly in importance, so the K value for major official tournaments should generally be higher than for friendlies. The specific value should be determined through backtesting on historical data rather than by copying a fixed number.
2.3 Code Implementation
def expected_score(r_a: float, r_b: float) -> float:"""Compute A's expected score against B (a draw counts as 0.5)."""return 1.0 / (1.0 + 10 ** ((r_b - r_a) / 400))def update_rating(r_a: float, r_b: float, score_a: float, k: float = 20.0) -> float:"""Update A's rating based on the actual score; score_a is 1, 0.5, or 0."""return r_a + k * (score_a - expected_score(r_a, r_b))
3. Generating Scores from Rating Differences
3.1 The Poisson Distribution
The number of goals in a single match can be described by a Poisson distribution:
P(X = k) = λ^k × e^(−λ) / k!
Here λ is the team’s expected number of goals and k is the actual number of goals. The Poisson distribution suits random events that occur infrequently within a unit of time, which matches the statistical characteristics of goals in soccer reasonably well.
3.2 From Rating Difference to Expected Goals
The key question is how to derive λ from the rating difference. One simple mapping is:
λ_A = λ_0 × 10^((R_A − R_B) / 800)
λ_B = λ_0 × 10^((R_B − R_A) / 800)
λ_0 is the average number of goals for two evenly matched teams and must be estimated from historical match data. When ratings are equal, both teams have the same λ; the larger the rating gap, the larger the stronger team’s λ. This formula is only a modeling starting point—in practice it can be replaced by a regression model based on historical goal data.
3.3 Code Implementation
import mathimport randomdef expected_goals(r_a: float, r_b: float, base: float = 1.3) -> tuple[float, float]:"""Map the rating difference to expected goals for both sides.base must be calibrated with historical data."""lam_a = base * 10 ** ((r_a - r_b) / 800)lam_b = base * 10 ** ((r_b - r_a) / 800)return lam_a, lam_bdef poisson_sample(lam: float, rng: random.Random) -> int:"""Sample a goal count from the Poisson distribution using Knuth's algorithm."""threshold = math.exp(-lam)k, p = 0, 1.0while True:p *= rng.random()if p <= threshold:return kk += 1
3.4 The Independence Assumption
The model above assumes that the two teams’ goal counts are independent. This assumption is biased in low-scoring scenarios—for example, the observed frequencies of 0-0 and 1-0 deviate systematically from what the independent model predicts. A commonly used improvement in the literature is the Dixon-Coles adjustment, which applies a separate correction to low-scoring combinations. A first implementation can ignore this adjustment and introduce it after the baseline is stable.
4. The Monte Carlo Simulation Workflow
The idea behind Monte Carlo methods is to repeatedly sample the same random process and estimate probabilities from frequencies. For tournament prediction, a single simulation consists of the following steps:
- Simulate all group-stage matches according to the grouping rules, recording each team’s points and goal difference.
- Rank the teams within each group based on points, goal difference, and other rules to determine which teams advance.
- Simulate the knockout bracket round by round until a champion is produced.
- Repeat the above process N times and tally each team’s share of championships.
4.1 Handling Single Knockout Matches
Knockout matches do not allow draws, so a tied match needs an additional step to determine a winner. A simplified approach is to decide the winner randomly according to the rating-based expected probability, which approximates the outcome of extra time and penalty shootouts.
def play_match(a: str, b: str, ratings: dict, rng: random.Random, knockout: bool = False):"""Simulate a match and return the winner; returns None for a group-stage draw."""lam_a, lam_b = expected_goals(ratings[a], ratings[b])goals_a = poisson_sample(lam_a, rng)goals_b = poisson_sample(lam_b, rng)if goals_a != goals_b:return a if goals_a > goals_b else bif not knockout:return None# Drawn knockout match: decide the winner by rating-based expected probability# (simplified model of extra time and penalties)return a if rng.random() < expected_score(ratings[a], ratings[b]) else b
4.2 The Knockout Bracket and Main Loop
def simulate_knockout(teams: list[str], ratings: dict, rng: random.Random) -> str:"""Simulate a single-elimination bracket and return the champion.The number of teams must be a power of two."""current = list(teams)while len(current) > 1:current = [play_match(current[i], current[i + 1], ratings, rng, knockout=True)for i in range(0, len(current), 2)]return current[0]def monte_carlo_champion(teams: list[str], ratings: dict,n: int = 10000, seed: int = 42) -> dict[str, float]:"""Run n simulations and return each team's championship probability.A fixed seed ensures reproducible results."""if len(teams) == 0 or len(teams) & (len(teams) - 1) != 0:raise ValueError("The number of knockout teams must be a power of two")if len(set(teams)) != len(teams):raise ValueError("Team names must be unique")rng = random.Random(seed)counts: dict[str, int] = {}for _ in range(n):champion = simulate_knockout(teams, ratings, rng)counts[champion] = counts.get(champion, 0) + 1return {team: c / n for team, c in sorted(counts.items(), key=lambda x: -x[1])}
A full tournament implementation also requires extending the logic for group-stage ranking and selecting the best third-placed teams. The structure is the same as the main loop above, with an additional qualification step before the knockout stage begins.
5. How to Interpret the Results
5.1 Probabilities Are Estimates
Monte Carlo results are frequency estimates and carry sampling error. When the championship probability is p, the standard error of N simulations is √(p(1−p)/N). With N = 10000 and p = 0.1, the standard error is about 0.003, or 0.3 percentage points. Two teams whose probabilities differ by less than the standard error should not be ranked against each other.
