October 13, 2026
Determinants of student performance in ENEM in São Paulo
Determinants of Student Performance in the Enem in São Paulo
Muriel Figueiredo Maia; José Erasmo Silva
DOI: 10.22167/2675-6528-202603290
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
The study analyzed factors associated with student performance in the National High School Exam (Enem), considering the historical relevance of educational assessment in Brazil. Its objective was to evaluate the predictive performance of the XGBoost model and identify the variables most associated with the participants’ average performance. Microdata from Enem from 2015 to 2023 were used, restricted to the state of São Paulo, organized into student, school, and socioeconomic questionnaire levels. After cleaning and standardization, a final database with 1,886,735 records was constructed. The XGBoost model was configured with hyperparameters to balance predictive capacity and generalization, including native handling of categorical variables. The results indicated that XGBoost showed performance compatible with educational studies. Interpretation by internal contribution values revealed the predominance of institutional and socioeconomic factors in explaining performance, with emphasis on the school’s administrative dependence and variables related to the family context. The research demonstrated that predictive approaches based on trees were capable of capturing relevant patterns without the need for traditional hierarchical models, offering a methodological alternative for understanding educational inequalities. It was concluded that the combination of large data volume, machine learning techniques, and interpretation by contributions allowed the identification of relevant factors for Enem performance and provided subsidies for reflections on educational policies.
Keywords: Machine Learning; Educational performance; Enem; Socioeconomic factors; XGBoost.
1. Introduction
The evaluation process has an extensive trajectory, with records of practices initiated in China aimed at selecting officials, and over time it has come to assume different functions, including measuring student performance. This process was consolidated with studies carried out in England and France and, with the development of influential models in the United States throughout the 20th century (Carvalho, 2017). In Latin America, research on school performance advanced more recently, between the 1980s and 1990s, when Brazil began to develop instruments aimed not only at verifying student performance but also at analyzing the factors that influence it. In this context, evaluations such as the National System for the Evaluation of Basic Education [SAEB] emerged and, as one of its branches, the National High School Examination [Enem] (Carvalho, 2017).
Created in 1998, Enem’s initial objective was to assess students at the end of basic education, and it was later reformulated in 2009 to also serve as a mechanism for accessing higher education (INEP, 2025). School performance, in turn, has been widely studied, and one of the most recognized models is Walberg’s (1984), which identified nine factors determining student achievement, organized into three dimensions: individual characteristics, school factors, and environmental factors.
The influence of this model can be observed in later studies, such as the analysis of socioeconomic and demographic factors through ANOVA, highlighting the impact of gender, race, family income, school type, region, and parents’ education on performance (Carvalho, 2017). Additional studies, such as those conducted in the Northeast region, identified elements that favor or hinder performance, including parents’ education, access to technological resources, age, and income, through linear regression (Souza et al., 2021). In addition to these works, there are also studies that used multilevel models to analyze the performance of third-year high school students, demonstrating the importance of considering the hierarchical structure of the data (Andrade et al., 2007).
Despite the methodological diversity, a gap is observed: a large part of these studies focuses on traditional explanatory models, while predictive approaches capable of dealing with non-linear relationships and complex interactions are still less explored in the analysis of performance in the Enem. Furthermore, although the data present a hierarchical structure involving students and schools, the objective of this study is not to estimate random effects, but to identify general patterns and variables most associated with average performance.
In this scenario, it becomes important to understand which factors stand out in explaining the average performance of ENEM participants and how a tree-based predictive model, such as XGBoost, can capture these patterns even without resorting to traditional hierarchical models. The relevance of this approach lies in the fact that, although multilevel models are widely used in educational research, predictive methods capable of handling non-linear relationships and complex interactions are still less explored in this type of analysis. The use of XGBoost offers a methodological alternative that allows for flexible exploration of the data structure, contributing to the understanding of factors associated with performance and providing evidence that can support discussions on educational policies and strategies aimed at reducing inequalities. Thus, the study aims to evaluate the predictive performance of XGBoost in identifying the variables most associated with students’ average performance, simultaneously considering individual and institutional information present in the exam’s microdata.
2. Material and Methods
The study was conducted in the Visual Studio Code (VS Code) integrated development environment, using the Python programming language. Libraries such as pandas and NumPy were used for data manipulation and processing, scikit-learn for splitting into training and testing sets, cross-validation, and metric calculation, and XGBoost for building the predictive model. The data used originated from the microdata of the National High School Exam (Enem), made available by the National Institute for Educational Studies and Research Anísio Teixeira (INEP/MEC), containing information about the student, school, test location, results, and socioeconomic profile of the participants.
The data collection covered the period from 2015 to 2023, restricted to participants linked to schools in the state of São Paulo. The sample considered high school students who had not completed this stage in the reference year or who completed it in the year of the exam application, aiming to standardize the analysis group. The database was organized in hierarchical layers, covering information about the student, the school, the test, and the socioeconomic questionnaire.
Cleaning procedures were applied, including the exclusion of absent participants in all tests, the removal of records with zero scores in all areas, and the elimination of rows with null values in the column referring to the municipality’s name. The socioeconomic questionnaire variables, originally coded by letters, were converted to numerical values. Similarly, the gender variable was standardized, converting “F” and “M” to 0 and 1.
These conversions had an operational purpose, adapting the categorical variables to the model’s execution environment without altering their intrinsic relationships. The target variable, named MEDIA_GERAL, was calculated as the arithmetic mean of the scores obtained by the participants in the five evaluated areas of the exam. After preprocessing, the final database consisted of 1,886,735 records and 39 variables, with the general average being the only numerical one.
A statistical exploration of the target variable was performed, observing an approximately continuous and symmetric distribution, with no need for additional transformations for model training. Multicollinearity among socioeconomic variables was assessed by calculating the Variance Inflation Factor (VIF), with values below the threshold of 5, the criterion adopted to ensure estimation stability (O’Brien, 2007).
Moderate correlations between socioeconomic variables were observed, especially those related to the possession of durable goods and residential structure, as well as between parents’ schooling. These correlations indicated the need to interpret the importance of the variables in the XGBoost model jointly, and not in isolation.
The XGBoost model was chosen, a tree-based approach, for its ability to handle non-linear relationships and for not depending on low collinearity between predictors. XGBoost, an efficient implementation of “boosting”, sequentially builds decision trees, correcting errors from previous ones and incorporating regularization mechanisms (Bruce et al., 2025).
The XGBoost model was configured to balance predictive performance and generalization. A reduced learning rate was used to mitigate overfitting, and the maximum tree depth was limited. Sampling techniques for observations and variables were employed to increase model robustness and stability. Native handling of categorical variables was enabled, and settings were adopted to ensure reproducibility (XGBoost Developers, 2024).
For comparison purposes, a Linear Regression model was developed, trained and evaluated with the same dataset (70% train, 30% test) and random seed as the XGBoost. Categorical variables were converted into ordinal numerical codes for the Linear Regression, which represented a methodological simplification for this comparison (Souza et al., 2021).
Additionally, a naive baseline model, which predicted the mean of the target variable observed in the training set, was used as a reference to quantify the predictive gain of XGBoost compared to the absence of any predictive model. This approach allowed for the contextualization of the performance of more complex models.
The stability of the results was evaluated through k-fold cross-validation, with five partitions (k = 5), applied to the XGBoost model, maintaining the original hyperparameters. This procedure ensured the reliability of the estimates, minimizing the dependence on a single data split and reinforcing the robustness of the evaluation.
The importance of the variables was estimated using SHAP (SHapley Additive exPlanations) values, a technique that quantifies the contribution of each variable to the model’s prediction. These values were calculated internally by XGBoost, allowing for the measurement of the average impact of variables on the prediction, including those categorical variables treated natively, ensuring consistency with the trained model.
3. Results and Discussion
The evaluation of the predictive performance of the XGBoost model revealed a coefficient of determination (R²) of approximately 0.32, indicating that the model was able to explain about 31% of the observed variability in student performance. In practical terms, this means that approximately one-third of the differences in performance among participants can be attributed to the variables included in the model, such as socioeconomic profile, school characteristics, and demographic data. The remaining two-thirds of the variability stem from factors not captured by the dataset, such as pedagogical and emotional aspects, and the individual preparation of each student. Although this R² does not represent an extremely high level of explanation, it is compatible with the results of initial models in the field of education, where performance is influenced by a multiplicity of factors that are not always directly observable in the available data.
The error metrics provided a more detailed understanding of the model’s accuracy. The mean squared error (MSE) was approximately 6.539, and the root mean squared error (RMSE) was about 80.86 points. Although MSE, due to its quadratic scale, does not have a direct interpretation, RMSE, by returning the error to the original scale of the grade, facilitates understanding. An RMSE of 80.86 points suggests that the grade predicted by the model deviates from the student’s actual grade, on average, by approximately 80 points, more or less. For example, a student with an actual grade of 550 points would tend to have a prediction between 470 and 630 points.
The Mean Absolute Error (MAE) was approximately 59.29 points, measuring the average distance between the predicted score and the actual score without squaring the differences. The distinction between MAE and RMSE is relevant: MAE better reflects the error most students face, while RMSE, more sensitive to large errors, tends to be higher when there are instances of significant error. In this study, the fact that the MAE (59.29) is noticeably lower than the RMSE (80.86) indicates that, although most predictions have a relatively small margin of error, there is a smaller group of students for whom the model errs by considerably larger margins, which elevates the RMSE.
The comparison of XGBoost’s performance with other models revealed its superiority. Compared to the naive baseline model, which predicts the overall average for all students, XGBoost’s RMSE dropped from 99.05 to 82.35 points, a reduction of 16.9%. This improvement demonstrates that the inclusion of socioeconomic, school, and demographic information consistently enhances prediction. Compared to Linear Regression, XGBoost also achieved a superior fit, with an R² of 0.3088 versus 0.2514 and an RMSE of 82.35 versus 85.70 points. This result was expected, as XGBoost is capable of capturing non-linear relationships and interactions between variables that a linear model cannot represent.
Nevertheless, the moderate difference between XGBoost and Linear Regression suggests that a significant portion of the relationship between explanatory variables and performance is approximately linear, being captured even by a simpler approach. The Pearson correlation between the actual values and those predicted by XGBoost was 0.56, indicating a moderate to strong association. This value, at a favorable intermediate level, reinforces that the model consistently follows the observed variation in grades, even with a moderate R², which is important for understanding general performance patterns.
To verify the stability of the results and ensure that the performance was not an artifact of a specific data split, a k-fold cross-validation was performed, with five partitions. The average R² obtained in the five rounds was 0.3080, with a standard deviation of 0.0018, and the average RMSE was 82.33 points, with a standard deviation of 0.23. This minimal variation between rounds, with R² ranging between 0.3062 and 0.3098 and RMSE between 82.10 and 82.56 points, indicates that the model’s performance remained stable regardless of how the data was split. This consistency reinforces the reliability of the evaluation performed and the robustness of the XGBoost model for this dataset.
The interpretation of the importance of the variables was performed using SHAP (SHapley Additive exPlanations) values, a technique that estimates the average contribution of each variable to the prediction of a student’s grade relative to the overall average grade. The higher the SHAP value of a variable, the greater its influence on the model’s predictions. The values were obtained through XGBoost’s internal calculation of contributions, allowing the average impact of each variable to be measured even with categorical variables handled natively by the algorithm, which ensures consistency between the model and the interpretation of the results.
The analysis of the importance of the variables revealed a predominance of institutional and socioeconomic factors. The variable TP_DEPENDENCIA_ADM_ESC, which represents the administrative dependence of the school, showed the greatest influence on the model, with an average impact of 23.23 points on the predicted score. This means that, on average, the administrative dependence of a student’s school alters the score predicted by the model by about 23 points, more or less, an effect considerably larger than that of any other variable analyzed. This finding reinforces the relevance of school management as a determining factor in student performance.
The distribution of the overall grade by the school’s administrative dependency corroborates this observation, showing that federal and private schools present higher performance medians than state and municipal schools. Although the performance dispersions between the groups are similar, the difference in medians is consistent with the magnitude of the impact identified by SHAP for this variable. This pattern suggests that the administrative structure of the educational institution plays a crucial role in student performance, possibly reflecting differences in resources, infrastructure, and pedagogical approaches.
Among other notable factors, socioeconomic variables from the student questionnaire appeared, such as Q006 (family income), Q024 (computer ownership), Q001 (father’s schooling) and Q002 (mother’s schooling), and Q013 (freezer ownership). The contributions of these variables ranged from 4.56 to 9.31 points, indicating that family context and living conditions exert a significant influence on the results. Parents’ schooling (Q001 and Q002) and family income (Q006) are classic indicators of cultural and economic capital that can influence the study environment and access to complementary educational resources, corroborating existing literature on educational inequalities.
The possession of durable goods, such as computers (Q024) and freezers (Q013), also proved relevant, reflecting the family’s socioeconomic level and access to resources that can facilitate study and development. The TP_ESCOLA variable, which indicates the type of school (public, private, or abroad), also showed a relevant impact, with an average of 3.96 points, reinforcing the importance of the institutional environment. Individual attributes, such as age group (6.09 points), race or color (3.59 points), sex (1.61 points), and nationality, although contributing to the explanation of the phenomenon, showed a lower relative weight compared to institutional and socioeconomic factors.
The comparison of the results of this study with previous research demonstrates important convergences on the factors associated with educational performance. The study by Souza et al. (2021), conducted in the Northeast region, identified significant differences between socioeconomic groups, with a gap of 88 points between low-income and non-low-income students. This pattern directly dialogues with the findings of the present work, in which family income (Q006) appears among the variables with the greatest contribution in the model. Furthermore, Souza et al. (2021) identified that parents’ schooling, access to computer and internet, and school type influence performance, factors that also emerge among the most important variables of XGBoost, such as TP_DEPENDENCIA_ADM_ESC, Q001, Q002, Q024, and TP_ESCOLA.
It is important to note that Souza et al. (2021) used Linear Regression as the analysis method, and although XGBoost showed superior predictive performance to Linear Regression in this work, the difference was moderate. This suggests that a considerable part of the relationship between the explanatory variables and student performance is already captured by a simpler linear approach. The fact that similar factors emerge as relevant in both the linear modeling and the non-linear approach adopted in this work reinforces the robustness of these findings, rather than evidencing a pronounced methodological advantage of XGBoost in terms of isolated predictive accuracy.
The study by Carvalho (2017), which analyzed performance in the Enem writing section, also highlighted socioeconomic and demographic factors, including family income, guardians’ schooling, school type, race, and region. Although Carvalho’s (2017) focus was on a specific area of the test, the variables that proved relevant are equivalent to those that appeared among the main contributions of the predictive model used here. This reinforces that socioeconomic and institutional inequalities manifest consistently across different components of the Enem, indicating a transversal influence of these factors on students’ overall performance.
Finally, research based on multilevel modeling by Andrade and Laros (2007) showed that 17% of the variance in school performance can be attributed to the school level, demonstrating that institutional differences explain a relevant part of the results. This conclusion converges with the present study, in which the most influential institutional variable was precisely the administrative dependence of the school (TP_DEPENDENCIA_ADM_ESC). The XGBoost’s ability to capture nonlinear relationships and complex interactions between variables, without the need for traditional hierarchical models, offers a valuable methodological alternative for understanding educational inequalities, even with the limitation of not estimating random effects.
Despite the robustness of the XGBoost model, some methodological limitations must be considered. The comparison with Linear Regression required the conversion of categorical variables into ordinal codes, a simplification that may have underestimated the performance of this model. Furthermore, the absence of more detailed pedagogical, emotional, and contextual information in the database limited the predictive reach of XGBoost, whose R² of approximately 0.31 reflects this gap. However, the value of XGBoost in this work lies less in producing drastically better predictions than traditional methods and more in offering an approach capable of capturing non-linear relationships without compromising the consistent identification of the institutional and socioeconomic factors that effectively explain educational performance.
In summary, the research results indicated that factors related to school structure and family context had the greatest weight in predicting student performance in the Enem, while individual characteristics, such as sex, race, and age, showed less influence. The XGBoost model demonstrated superior predictive performance to the naive baseline model and Linear Regression, and k-fold cross-validation confirmed the stability and reliability of these findings. The identification of the school’s administrative dependence and socioeconomic variables such as family income and parental education as the main factors associated with students’ average performance meets the study’s objective and provides important subsidies for reflections on educational policies aimed at reducing inequalities.
4. Conclusion
This study sought to evaluate the predictive performance of the XGBoost model in identifying the variables most associated with the average performance of students in the National High School Exam, considering individual and institutional information. It was found that the XGBoost model presented predictive performance compatible with the educational area, explaining about 31% of the observed variability in grades and outperforming reference models such as linear regression and the naive baseline model. The stability and reliability of these findings were confirmed through k-fold cross-validation. The analysis of variable importance, performed using internal contribution values, revealed the predominance of institutional and socioeconomic factors. The administrative dependence of the school stood out as the variable with the greatest influence, indicating that school management plays a crucial role in performance. Variables such as family income, parents’ education level, and ownership of durable goods also proved relevant, reinforcing the influence of family context and living conditions. Individual attributes, such as age group and race or color, had a lower relative weight. These results converge with existing literature, which points to the consistency of socioeconomic and institutional inequalities in educational performance.
Despite the robustness of the XGBoost model, some limitations were identified. The comparison with linear regression required the conversion of categorical variables into ordinal codes, which may have underestimated the performance of this model. Furthermore, the absence of more detailed pedagogical, emotional, and contextual information in the database limited the predictive reach of XGBoost. However, the main contribution of the study lies in demonstrating that predictive approaches based on trees are capable of capturing relevant patterns and consistently identifying the institutional and socioeconomic factors that explain educational performance, even without the need for traditional hierarchical models. For future studies, it is suggested to include pedagogical, emotional, and contextual variables, as well as to apply more robust coding techniques for categorical variables in comparative models, aiming to expand the predictive capacity and comparability between approaches. This work thus offers a valuable methodological alternative and subsidies for the improvement of educational policies aimed at reducing inequalities.
Bibliographic References
Andrade, J.M.; Laros, J.A. 2007. Fatores associados ao desempenho escolar: estudo multinível com dados do SAEB/2001. Psicologia: Teoria e Pesquisa 23(1): 33-42.
Bruce, P.; Bruce, A.; Gedeck, P. 2025. Estatística prática para cientistas de dados: 50+ conceitos essenciais usando R e Python. 2ed. Alta Books, Rio de Janeiro, RJ, Brasil.
Carvalho, F.E.D. 2017. Fatores socioeconômicos associados ao desempenho dos estudantes na prova de redação do Exame Nacional do Ensino Médio (Enem). 179f. Tese (Doutorado em Educação) – Universidade Federal do Ceará, Faculdade de Educação, Programa de Pós-Graduação em Educação, Fortaleza, CE, Brasil. Disponível em: https://repositorio.ufc.br. Acesso em: 20 set. 2025.
Instituto Nacional de Estudos e Pesquisas Educacionais Anísio Teixeira [INEP]. 2025. Enem – apresentação. Disponível em: https://www.gov.br/inep/pt-br/areas-de-atuacao/avaliacao-e-exames-educacionais/enem. Acesso em: 13 set. 2025.
O’BRIEN, R.M. 2007. A Caution Regarding Rules of Thumb for Variance Inflation Factors. Quality & Quantity 41(5): 673–690.
Souza, A.E.; Santos, L.M.S.; Larruscaim, I.M.; Besarria, C.N. 2021. Determinantes do desempenho no Enem na região Nordeste: uma análise de dados em painel do período de 2015 a 2019. Revista Brasileira de Estudos Regionais e Urbanos 15(4): 690–711. DOI: 10.54766/rberu.v15i4.915.
Walberg, H.J. 1984. Improving the productivity of America’s schools. Educational Leadership 41: 19-27.
XGBoost Developers. 2024. XGBoost Documentation – Parameters. Disponível em: https://xgboost.readthedocs.io/en/stable/parameter.html. Acesso em: 11 jan. 2026.
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