0
$\begingroup$

I have come across a code that predicted the winner of the World Cup using the Poisson distribution. Does this have any logic? is it reasonable? Searching the internet I have not found any reliable reference site that could support this theory.

the code does the following:

  1. Here comes a part of Data Engineering that is not relevant where you collect data. At the end it has a dataframe with countries and their strengths (It is basically his average number of goals scored per conceded)
country GoalsScored GoalsConceded
Spain 1.69 1.1
Germany 1.89 0.98
Argentina 1.44 1.323

2. Predict the points o each match using poisson.

def predict_points(home, away):
    #1 lambda for home and for away.
    lamb_home = df_team_strength.at[home, 'GoalsScored'] * df_team_strength.at[away, 'GoalsConceded']
    lamb_away = df_team_strength.at[away, 'GoalsScored'] * df_team_strength.at[home, 'GoalsConceded']
    #2 calculates the possibilite of 100 outcomes (0-0) (0-1)...(10-0)
    prob_home, prob_away, prob_draw = 0, 0, 0
    for goals_home in range(0, 11):
        for goals_away in range(0, 11):
            p = poisson.pmf(goals_home, lamb_home) * poisson.pmf(goals_away, lamb_away)
            if goals_home == goals_away:
                prob_draw += p
            elif goals_home > goals_away:
                 prob_home += p
            else:
                prob_away += p
    points_home = 3 * prob_home + prob_draw
    points_away = 3 * prob_away + prob_draw
    return (points_home, points_away)
 

Example. pretict_points("Argentina", "Mexico") (2.455, 1.223)

  1. Makes the prediction with all the matchs of all the groups using the formula above.

  2. Take the first 2 or each group and simulate the knockout, quarter, semi and final.

notebook github:

$\endgroup$
2
  • 2
    $\begingroup$ I have not looked at the code, but one model is to assume that the number of goals scored in a match by each team is Poisson distributed, conditioned on rate parameters calculated previously, and conditionally independent of the number scored by the other team in the same match. This is an extremely strong assumption, so unlikely to be correct, but is enough to be able to build a simulation model for matches. $\endgroup$
    – Henry
    Commented Nov 29, 2022 at 12:01
  • $\begingroup$ code is not so important, but I just have interest in opinions from people that really knows and not for a random forum $\endgroup$ Commented Nov 29, 2022 at 13:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.