September 29, 2026
Multilevel prediction of Brazilian Football Championship results using team and player data
Multilevel Prediction of Brazilian Football Championship Results Using Team and Player Data
Alexandre Quirino Ramos Pinto; Walter Mesquita Filho
DOI: 10.22167/2675-6528-202602616
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
Predicting outcomes in football matches is a complex challenge that requires capturing structural performance patterns over time. The objective was to develop and evaluate a Generalized Linear Mixed Model (GLMM) with a Poisson distribution to probabilistically predict the number of goals scored in the Brazilian Football Championship – Serie A, between 2016 and 2024, incorporating historical team statistics and individual player ratings. Data from 3,417 matches were collected via web scraping from the SofaScore portal. The hierarchical structure of the model included fixed effects, such as home advantage, offensive history, and player ratings, and random effects of intercept per team (offense and defense) and per season. The final model presented a total intraclass correlation coefficient of 6.05%, with σ_attack = 0.140 and σ_defense = 0.136, confirming the relevance of hierarchical effects. Home advantage proved to be statistically significant, with an Incidence Rate Ratio of 1.31. In temporal validation (2023-2024), the model achieved an accuracy of 49.4%, a Brier Skill Score of 7.1%, and a Ranked Probability Score Skill Score of 9.0% compared to a naive reference model. The results corroborated the suitability of the multilevel GLMM approach for probabilistic prediction in football, contributing to sports analytics with Brazilian data.
Keywords: Team performance; GLMM; Poisson; SofaScore.
1. Introduction
The prediction of sports outcomes has been arousing growing academic and practical interest, driven by the advancement of data analysis methodologies and the availability of detailed databases on athlete and team performance. Football, in particular, represents an especially rich field of study, as it combines considerable randomness with structural patterns that reflect technical quality, strategy, tactics, and group dynamics (Maher, 1982; Dixon and Coles, 1997). In Brazil, the first division Brazilian Football Championship – Série A, is considered one of the most competitive tournaments in the world, bringing together twenty teams in home and away matches over 38 rounds per season, which generates a longitudinal dataset of great richness for statistical modeling.
A team’s performance in a match is simultaneously influenced by individual factors, such as the technical quality and physical condition of the players, and by collective factors, such as the overall strength of the squad and the advantage of playing at home. Predicting football match outcomes is a challenge that combines the inherent randomness of the sport with the need to capture structural performance patterns over time. This natural hierarchical structure of the data, in which match observations are nested within teams which, in turn, vary over seasons, makes classic regression models, which assume independence between observations, limited for this type of analysis.
In this context, Generalized Linear Mixed Models (GLMM) emerge as a methodologically appropriate approach to extend mixed-effects models to responses with non-normal distributions, combining fixed and random effects (Fávero and Belfiore, 2017; Goldstein, 2011). For count variables, such as the number of goals, the Poisson distribution is the natural choice, with a logarithmic link function (Stroup, 2012). Multilevel modeling, based on the works of Raudenbush and Bryk (2002) and Snijders and Bosker (1999), allows for the decomposition of the total data variability into components associated with different hierarchical levels, overcoming the limitations of models that assume independence between observations.
For the realization of this study, data were collected through web scraping from the SofaScore portal (SofaScore, 2022), a platform that provides real-time individual player statistics and ratings for matches around the world (SofaScore Notes, 2024). The dataset covered all matches of the first division Brazilian Football Championship – Série A, from the 2016 to 2024 seasons, totaling 3,417 matches. The information included team performance statistics and individual player ratings for each match, which serve as predictor variables in sports analysis models.
Given the complexity and richness of Brazilian football data, and the suitability of the GLMM approach to handle the hierarchical structure and the count nature of goals, the main objective of this work was to develop and evaluate a Poisson GLMM model for probabilistic prediction of Brazilian Football Championship match results, incorporating both historical team statistics and individual player ratings as predictors.
2. Material and Methods
The present study was characterized as a quantitative, inferential research, with the objective of developing and evaluating a statistical model for the probabilistic prediction of football match results. The methodological approach adopted was the modeling of Generalized Linear Mixed Models (GLMM) with Poisson distribution, suitable for count variables such as the number of goals. The unit of analysis consisted of matches from the Brazilian Football Championship, first division – Series A.
The data were collected through web scraping from the SofaScore portal (sofascore.com), covering all matches of the Brazilian Football Championship Series A, from the 2016 to 2024 seasons. 3,417 matches were obtained, out of a theoretical total of 3,420. The matches not included were: Atlético-MG and Chapecoense (2016), CSA and Palmeiras (2019), and Athletico and Internacional (2024), due to cancellation or incomplete data. The collection was carried out with the Playwright and Asyncio libraries of the Python 3.12 language, and the data were consolidated into a CSV file.
The dataset contained 76 variables, including match identification, final score, round, season, technical game statistics, and individual player ratings. Manual adjustment of approximately 30 player rating observations that were not correctly captured by web scraping was performed. In the preparation step, using the Pandas and NumPy libraries, the average team rating was calculated, and historical strength variables were created with a sliding window (average of the last five previous matches), such as offensive strength, defensive strength, and historical rating. Values from the first round without history were filled with the global average. The dataset was restructured to the long format, totaling 6,834 observations, and all continuous covariates were standardized (z-score).
Exploratory data analysis was conducted to characterize the distribution of variables of interest and support modeling choices. The distribution of goals was assessed through comparative histograms with the Poisson distribution, and the variance/mean ratio was calculated. The advantage of playing at home was quantified by win, draw, and loss ratios, and by the evolution of average goals over the seasons. Correlations between game statistics and goals were calculated using the Pearson coefficient.
The Poisson GLMM model was specified to model the number of goals scored, considering the count nature of the data and the hierarchical structure. The specification included fixed effects and random effects, which model subgroup-specific variability, such as teams and seasons (Stroup, 2012). Estimation was performed by penalized maximum likelihood, using the Laplace approximation, implemented in Python with the SciPy library and the L-BFGS-B algorithm. The variances of the random effects were determined by profile likelihood with the Nelder-Mead algorithm.
The research instantiated four progressively more complex models, following a “step-up” approach (Raudenbush and Bryk, 2002). Model 0 (M0) was a baseline model, and the subsequent models (M1, M2, M3) added pre-game historical covariates and random intercepts for team offense, team defense, and season. Model 4 (M4) extended M3 with the Dixon-Coles (1997) correction for low scores, introducing a parameter that adjusts the joint probability of scores (0x0, 1×0, 0x1, and 1×1).
Model fit was assessed using Pearson’s chi-squared statistic (x²/df), Shapiro-Wilk test for normality of random effects, and intraclass correlation coefficient (ICC), calculated according to Nakagawa and Schielzeth (2010). The likelihood ratio test (LRT) was employed to compare nested models. Model validation was temporal, using the 2016-2022 seasons for training (2,658 matches) and 2023-2024 for testing (759 matches), respecting the chronological order of the data.
For each match in the test set, the model generated expected goal values, from which probabilities for the three possible outcomes (home win, draw, away win) were obtained by Monte Carlo simulation with 5,000 samples from the Poisson distribution. Predictive performance was evaluated by three metrics: Simple Accuracy (proportion of correct predictions by the maximum probability outcome), Brier Score (BS), and Ranked Probability Score (RPS). For both metrics, the Skill Score was calculated relative to a naive model of uniform probabilities.
3. Results and Discussion
The exploratory data analysis revealed important characteristics for modeling. The distribution of goals observed for home and away teams showed good adherence to the Poisson distribution across the entire range of values, indicating that this is an appropriate choice for the response variable. In the 3,417 games analyzed, the average number of goals for the home team was 1.395, with a variance of 1.306, while the away team scored an average of 0.976 goals per game, with a variance of 0.970. The dispersion indices, calculated as the variance/mean ratio, were 0.9363 for the home team and 0.9943 for the away team, both close to one, which reinforces the adequacy of the Poisson distribution and suggests the absence of relevant overdispersion in the data.
The distribution of match results in the Brazilian Championship – Série A, between 2016 and 2024, showed that 47.6% ended with a home team victory, 27.3% with a draw, and 25.2% with an away team victory. These proportions are consistent with patterns observed in other high-level South American championships, as pointed out by Pollard and Pollard (2005). The average number of goals scored per season for home and away teams remained relatively stable over the analyzed period, with home teams scoring between 1.27 and 1.49 goals per game, and away teams between 0.80 and 1.07 goals per game. The home team’s win rate varied between 43.9% in 2017 and 53.2% in 2018, highlighting the persistence of the home-field advantage.
The Pearson correlation between game statistics and the number of goals scored identified shots on goal as the strongest predictor, with a correlation coefficient of 0.467 and p < 0.001. Next, team rating also proved to be a relevant predictor, with r = 0.410 and p < 0.001. On the other hand, ball possession (r = -0.055) and accurate passes (r = 0.004) showed low correlation with goals scored, suggesting that game volume does not directly translate into greater finishing ability. To avoid future information leakage, only historical variables calculated with a sliding window were included as predictor variables in the model, ensuring that the prediction was based exclusively on data available before the match.
GLMM Model Adjustment
The final Generalized Linear Mixed Model (GLMM), named M3, demonstrated satisfactory convergence through the L-BFGS-B algorithm, achieving a marginal log-likelihood of −9,305.79. The analysis of estimated coefficients for fixed effects revealed that home-field advantage was the most expressive predictor. The Incidence Rate Ratio (IRR) for the home advantage was 1.308, with a 95% confidence interval between 1.236 and 1.384 and a p-value less than 0.001. This indicates that, keeping other factors constant, the home team scores, on average, 30.8% more goals than the visiting team. This finding is in line with international literature, which documents home advantages ranging between 20% and 50%, depending on the league and the period analyzed (Pollard and Pollard, 2005; Constantinou and Fenton, 2012).
The average historical rating of the team’s players also proved to be a statistically significant and positive predictor for the number of goals scored. The coefficient for the historical rating presented an IRR of 1.072, with a 95% confidence interval between 1.040 and 1.106 and p < 0.001. This means that teams with a better historical average of individual performance tend to score more goals, with a 7.2% increase per standard deviation in the standardized variable. This result validates the hypothesis that individual performance information adds predictive value to the model, as proposed in the introduction.
In contrast, the effects of the team’s attack history and the opponent’s defensive quality, although showing the expected signs, were not statistically significant at the 5% level, with confidence intervals that included unity. The IRR for attack history was 1.018, with a 95% CI between 0.991 and 1.045, and for the opponent’s defense it was 1.028, with a 95% CI between 0.994 and 1.062. The coefficient for the opponent’s historical rating, in turn, showed a positive sign (IRR = 1.008, 95% CI between 0.971 and 1.047), which is contrary to the expectation that opponents with higher defensive quality would reduce the number of goals scored, and was also not statistically significant.
Three hypotheses were raised to explain the unexpected behavior of the opponent’s historical rating. Firstly, confrontations between teams of higher technical quality can result in more open matches, causing the term to capture the offensive character of the game rather than the opponent’s defensive quality. Secondly, the SofaScore rating is assigned after the match and may partially incorporate the outcome, introducing an endogenous component into the variable. Finally, there may be collinearity with the random defense effect per team, which already absorbs the opponent’s latent defensive strength, leaving little independent variance for the fixed term. Due to its reduced magnitude and caveats, this coefficient should not be interpreted as a causal estimate.
Random effects and ICC
The analysis of variance components and Intraclass Correlation Coefficients (ICC) revealed the importance of the hierarchical structure of the data. The total ICC calculated was 6.05%, indicating that a significant fraction of the variation in goals scored can be attributed to structural differences between teams and seasons, justifying the use of the multilevel model. Although most of the variation in goals is explained by the residual randomness inherent in football, the presence of random effects is statistically relevant. The attack component per team (u_atk) showed an estimated standard deviation of 0.140 and an ICC of 3.02%, while the defense component per team (u_def) had an estimated standard deviation of 0.136 and an ICC of 2.84%.
The attack and defense components per team presented similar magnitudes, with a slight predominance of the offensive component. This suggests that the latent offensive and defensive strength of the teams are important and comparable factors in explaining the variability of goals. In contrast, the season effect (u_tmp) proved to be marginal, with an estimated standard deviation of 0.035 and an ICC of only 0.19%. This result indicates that the systematic variation between seasons is small compared to the intrinsic differences between teams, reinforcing the idea that team identity and performance are more decisive than annual fluctuations in the overall context of the championship.
The substantial heterogeneity among the teams was evidenced by the estimated random effects. Regarding offensive strength, Flamengo (0.274) and Palmeiras (0.256) stood out as leaders, followed by Atlético-MG (0.186), reflecting the dominance of these clubs in the analyzed period. As for defensive strength, the lowest values, indicative of better performance, were observed for Palmeiras (-0.252), Internacional (-0.183), and Corinthians (-0.157). It is noteworthy that Palmeiras simultaneously stood out among the best offenses and best defenses, a result consistent with its overall performance in the studied seasons. The error bars associated with the estimates were wider for teams with a smaller number of participations, which reflects the shrinkage of estimates towards the overall mean, an effect promoted by the multilevel structure.
Model diagnosis
The final model diagnostics confirmed a good fit to the data. The Pearson chi-squared statistic divided by the degrees of freedom resulted in 0.903, a value close to one indicating adequate calibration of residual variance and the absence of overdispersion. This result corroborates the suitability of the Poisson distribution for modeling the goals scored. Additionally, Shapiro-Wilk tests, applied to the estimated random effects, did not reject the normality hypothesis for any of the three components: attack per team (p = 0.942), defense per team (p = 0.095), and season (p = 0.863). The validation of the model’s distributional premise is crucial for the robustness of inferences.
The QQ-plots of the estimated random effects for attack, defense, and season, as well as the global fit QQ-plots of the four fitted models, showed that the randomized quantile residuals, proposed by Dunn and Smyth (1996), follow a standard normal distribution. This type of residual is the most appropriate diagnostic for discrete responses, as Pearson or deviance residuals in count models are asymmetric and assume discrete values, producing step-like patterns in QQ-plots even under correct specification. The conformity of the quantile residuals to the standard normal distribution indicates that the model is well-specified and that the underlying assumptions have been met.
Model Comparison
The comparison between the models, performed through log-likelihood and the likelihood ratio test (LRT), demonstrated a progressive improvement in fit as additional components were incorporated. The GLM Poisson model with pre-game covariates (M1) presented a log-likelihood of -9,371.58, significantly superior to the null model (M0), with an LRT x² of 403.75 and p < 0.001. This highlighted the explanatory power of game predictors in modeling the number of goals.
The incorporation of random effects by team and season in the model (M2) resulted in a substantial improvement in fit, with an LRT x² of 497.52 and p < 0.001 compared to M1. Subsequently, the complete GLMM model with pre-game covariates (M3) generated a significant additional improvement, with an LRT x² of 37.82 and p < 0.001 in relation to M2. These results confirm the importance of the multilevel structure and historical covariates for predicting goals in the Brazilian Football Championship.
The Dixon-Coles correction parameter (p) was estimated at 0.0155, and the likelihood ratio test (LRT x² = 0.45, p = 0.500) indicated that this correction for low scores did not bring statistically significant gain in this dataset. This finding differs from what Dixon and Coles (1997) observed in European leagues, where the correction is highly relevant. The absence of significance in the Brazilian context may be related to the greater unpredictability and frequency of goals in the country’s football, suggesting that the dynamics of low scores may be less pronounced or have a different impact on predicting outcomes.
Temporal validation and predictive performance
The temporal validation of the model was performed using the seasons from 2016 to 2022 for training (2,658 matches) and the seasons from 2023 to 2024 for testing (759 matches), totaling 1,518 observations. This chronological approach avoided future information leakage and simulated a real-world scenario of model usage. The model generated probabilities for the three possible outcomes (home win, draw, away win) through Monte Carlo simulation with 5,000 samples from the Poisson distribution for each match in the test set.
The distribution of the results predicted by the M3 model for the 2023 and 2024 seasons showed a tendency to over-predict home wins, with 85.1% of predictions indicating a home win, in contrast to the 47.0% observed. Furthermore, the model rarely predicted draws. This pattern is documented in Poisson models for football that do not incorporate specific correction for draws (Dixon and Coles, 1997). The dispersion of observed goals versus those expected by the model presented a global Mean Absolute Error (MAE) of 0.835, indicating a good proximity between the predicted and actual values.
The temporal validation metrics confirmed the model’s superior performance compared to a naive benchmark model. The 9.0% Ranked Probability Score Skill Score (RPS Skill Score) and the 7.1% Brier Skill Score indicate that the model adds predictive value, even in ordinal terms, over the uniform “baseline”. These results are comparable, in order of magnitude, to those reported by Baio and Blangiardo (2010) for the Italian league with Bayesian random effects models. However, direct comparisons of Skill Score with international literature should be interpreted with caution, due to differences between leagues, periods, and test sets.
The model’s simple accuracy was 49.4% for the 2023 and 2024 seasons. However, this metric should be interpreted with caution, as a naive rule that always predicted the home team’s victory would be correct in 47.0% of the test set matches. The model’s gain over this baseline, in terms of accuracy, is modest. The difficulty in predicting draws reflects the probabilistic nature of the outcome: although the model assigns an average probability of 26.9% to draws, close to the observed frequency of 26.2%, the maximum probability strategy (argmax) rarely selects them, as the probabilities of each team winning are generally higher. This suggests a limitation of the decision criterion, rather than a miscalibration of the probabilistic model, which justifies the use of scoring rules such as the Brier Score and RPS, as advocated by Constantinou and Fenton (2012).
In summary, the Poisson Generalized Linear Mixed Model proved to be a suitable predictive approach for probabilistic goal prediction in the Brazilian Football Championship, capturing the hierarchical structure of the data. The home advantage and players’ historical rating were identified as significant predictors, while the Dixon-Coles correction did not prove relevant in this context. Temporal validation confirmed the model’s predictive capability, offering a complete probability distribution for match outcomes, which represents a valuable contribution to sports analysis with Brazilian data.
4. Conclusion
The present study aimed to develop and evaluate a Generalized Linear Mixed Model (GLMM) with a Poisson distribution to probabilistically predict the number of goals scored in the Brazilian Football Championship – Série A, incorporating historical team statistics and individual player ratings. It was found that the multilevel GLMM approach proved adequate for probabilistic goal prediction, capturing the hierarchical structure of the data, with a total Intraclass Correlation Coefficient of 6.05%. The home-field advantage was identified as the most significant predictor, indicating that the home team scores, on average, 30.8% more goals. The average historical player rating also proved to be a statistically significant and positive predictor. In contrast, the team’s offensive history and the opponent’s defensive quality did not show statistical significance. The temporal validation of the model, conducted with the 2023 and 2024 seasons, confirmed its superior performance compared to a naive benchmark model, with a Ranked Probability Score Skill Score of 9.0% and a Brier Skill Score of 7.1%. Additionally, it was found that the Dixon-Coles correction parameter did not provide a statistically significant gain for this dataset, a finding that differs from international literature and contributes to sports analysis with Brazilian data, offering a complete probability distribution for match outcomes.
However, the model presented limitations when using only pre-game historical data, without considering contextual information such as absences due to injury, suspension, weather, or pitch conditions. The random team effects were treated as constants throughout the nine seasons, which represents a simplification. It is suggested that future studies explore the incorporation of these contextual variables, the adoption of random slopes for home advantage, the joint modeling of scores through the bivariate Poisson, and the comparison of GLMM with hierarchical Bayesian models or machine learning approaches, in order to verify possible additional predictive gains.
Bibliographic References
Baio, G.; Blangiardo, M. 2010. Bayesian hierarchical model for the prediction of football results. Journal of Applied Statistics 37(2): 253-264.
Constantinou, A.C.; Fenton, N.E. 2012. Solving the problem of inadequate scoring rules for assessing probabilistic football forecast models. Journal of Quantitative Analysis in Sports 8(1): 1-14.
Dixon, M.J.; Coles, S.G. 1997. Modelling association football scores and inefficiencies in the football betting market. Journal of the Royal Statistical Society: Series C (Applied Statistics) 46(2): 265-280.
Dunn, P.K.; Smyth, G.K. 1996. Randomized quantile residuals. Journal of Computational and Graphical Statistics 5(3): 236-244.
Fávero, L.P.; Belfiore, P. 2017. Manual de Análise de Dados. Elsevier, Rio de Janeiro, RJ, Brasil.
Goldstein, H. 2011. Multilevel Statistical Models. 4ed. John Wiley & Sons, Chichester, Reino Unido.
Maher, M.J. 1982. Modelling association football scores. Statistica Neerlandica 36(3): 109-118.
Nakagawa, S.; Schielzeth, H. 2010. Repeatability for Gaussian and non-Gaussian data: a practical guide for biologists. Biological Reviews 85(4): 935-956.
Notas SofaScore. 2024. Entendendo a Nota SofaScore: um guia completo. Disponível em: <https://www.sofascore.com/news/pt/nota-sofascore-explicada/>. Acesso em: 17 jun. 2025.
Pollard, R.; Pollard, G. 2005. Long-term trends in home advantage in professional team sports in North America and England (1876-2003). Journal of Sports Sciences 23(4): 337-350.
Raudenbush, S.W.; Bryk, A.S. 2002. Hierarchical Linear Models: Applications and data analysis methods. 2ed. Sage Publications, Thousand Oaks, CA, USA.
Snijders, T.A.B.; Bosker, R.J. 1999. Multilevel Analysis: An introduction to basic and advanced multilevel modeling. Sage Publications, Londres, Reino Unido.
SofaScore. 2022. About Us. Disponível em: <https://corporate.sofascore.com/about>. Acesso em: 30 mar. 2025.
Stroup, W.W. 2012. Generalized Linear Mixed Models: Modern concepts, methods and applications. CRC Press, Boca Raton, FL, USA.
Article originating from the Final Course Project of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform