🎯 The Goal of My Project
In this project, I worked with the 2018 and 2019 World Happiness datasets. My aim was to analyze the internal structure of each year’s data and explore the differences and changes between them over time. ➕ In addition to obtaining prediction results, I performed a comprehensive statistical analysis that included evaluating the model, testing regression assumptions, and comparing coefficients to gain deeper insights into the data. 🎯 Beyond the technical aspect, my goal was also to strengthen my statistical analysis skills while leveraging my psychology background to interpret the findings within a broader psychological and sociological context.
📌 Variables
- 💰 GDP per capita
- 🤝 Social support
- 🏥 Healthy life expectancy
- 🗽 Freedom to make life choices
- 💝 Generosity
- ⚖️ Perceptions of corruption
🧮 Models Tested
- OLS (Ordinary Least Squares)
- Robust OLS
- WLS (Weighted Least Squares)
- Gradient Boosting
📊 Evaluation Criteria
- 📐 AIC
- 📏 BIC
- 📊 R-squared (R²)
- 🔗 Correlation with Happiness Score
- 🔍Regression Assumptions
- 📈Confidence Intervals
- 💡Model Comparison
🏆 Outcomes
- 2018 → OLS model performed best
- 2019 → Robust OLS model performed best
This framework was designed to be modular, reusable, and well-documented, making it adaptable for other datasets or extended with additional statistical methods.
‼️💡 More details: Project Repository
📊Effect of Variables by Year
This graph shows how the factors affecting happiness scores changed between 2018 and 2019.

📢Looking at the variable effects chart, we see that in 2019 the effects of social support, freedom to make life choices, healthy life expectancy, and perception of corruption increased, while the effects of GDP per capita and generosity decreased.These changes are generally around ±0.2. However,since the effects of perception of corruption and generosity are quite weak, we can mostly talk about their indirect influence rather than a direct one.
From these results, it can be said that freedom to make life choices has a very important and key role in happiness scores. At the same time, social support—reflecting interpersonal relationships—and factors with roughly the same level of influence, such as income distribution (GDPper capita) and healthy life expectancy, are among the most influential and should be considered carefully.
Both generosity and social support relate to social relationships, but the weak effect of generosity can be explained in a few ways: Generosity mainly refers to helping others, while social support is more about receiving help—support that people get during difficult times or when in need.
Another important difference is that generosity is often limited to our close social circle, whereas social support can come both from personal networks like family and friends and from more structured sources such as institutions or organizations.Therefore, the scope of support and impact on individuals can differ significantly.
😊Happiness Label Distribution
The distribution of happiness scores by labels is shown in the graph below..

📢In the happiness label distribution bar chart, the "above average" label increased in 2019 compared to 2018. The "average" and "low" labels slightly decreased in 2019, while the "very low" label showed a small increase. For the "high" label, we don't see any change.
From this, we can say that in 2019 the labels shifted more toward the extremes. As the "average" label decreased, the "above average" and "very low" labels increased. However, the fact that the "high" label didn't change suggests that this shift wasn't very strong. There could be a few reasons for this shift---> We previously found that GDP per capita had a stronger positive effect on the happiness score in 2018.The decrease in GDP per capita's effect might have influenced the label changes. Another factor affecting the label changes could be the combination of independent variables. for example: The "freedom to make life choices" variable is the most influential variable.However,when we compare the United Kingdom's 2018 and 2019 data, we see that the freedom to make life choice variable decreased in 2019, while GDP per capita, social support, and healthy life expectancy scores increased. This could explain the difference in 2018 labels and why the 2019 label didn't change. Perhaps the increase in freedom to make a life choice balance out the decreases in the other variables.
📊 2018 Regression Prediction
Overall, when comparing the original happiness scores with the predicted new happiness scores from the regression model, we observe that even in countries with the highest initial scores, the predicted scores decrease, and in some cases, the happiness label changes.
- United Kingdom — (Happiness Score = 7.190, Label = High) → (New Score = 6.290, Label = Above Average)
- Costa Rica — (Happiness Score = 7.072, Label = High) → (New Score = 6.210, Label = Above Average)
However, in some countries, the opposite occurs — both the happiness score and the happiness label increase:
- Qatar — (Happiness Score = 6.374, Label = Above Average) → (New Score = 6.660, Label = High)
- Singapore — (Happiness Score = 6.343, Label = Above Average) → (New Score = 7.080, Label = High)
These results suggest:
- Low scores (e.g., 3.49, 3.93) likely indicate countries with lower economic prosperity, freedom levels, or social support.
- High scores (e.g., 6.97, 6.71) suggest higher life satisfaction among citizens.
- GDP per capita is expected to be higher up to a certain point, but given its relatively small effect on the dependent variable, no major gap is expected between low- and high-scoring countries.
- Freedom to make life choices is expected to be significantly higher in high-scoring countries, as this is the most influential variable.
According to the model’s results, some countries’ happiness levels are lower than expected, potentially due to structural inequalities or lack of social support. Predicted scores above 6 reflect the positive effects of strong economic indicators and social well‑being. When considered alongside the RMSE value, prediction errors are not large, indicating the model captures the general trend accurately.
📊 2019 Regression Prediction
A similar trend to 2018 is observed — overall, scores have generally decreased. However, the changes are not always the same.
- United Kingdom — In 2018, the regression analysis result downgraded the label from High to Above Average, but in 2019, both the original and predicted labels remained High.
Happiness label changes do not occur in all cases, but in some countries, they do:
- Costa Rica — As in 2018, the label dropped from High to Above Average in the regression results.
- Qatar — As in 2018, the label increased from Above Average to High.
⚖️ Model Selection & Machine Learning Comparison
2018: OLS was selected because no heteroskedasticity was detected and the model fit the data well. It offered both interpretability and simplicity.
2019: Significant heteroskedasticity was present. After evaluating OLS, Robust OLS, WLS, and Gradient Boosting:
- Robust OLS: reduced heteroskedasticity and was less sensitive to outliers.
- WLS: achieved very high R² (~0.99) but likely overfitted due to outliers.
- GB: Its fit is weaker compared to the linear models, and it has a higher likelihood of deviating on outliers.
Therefore, Robust OLS was chosen for 2019.
📈 Additional ML Model Evaluation
To complement statistical models, a Gradient Boosting Regressor was tested for both years:
- 2018: R² around 0.61 (lower than OLS at ~0.69) with slightly higher errors → relationships appear mostly linear.
- 2019: R² around 0.58 (slightly below Robust OLS at ~0.60) → minimal gains without tuning.
Interpretation: Gradient Boosting did not outperform classical regression models in either year, suggesting that the data’s predictor–outcome relationships are predominantly linear. For this reason, boosting was not selected as a primary model but included as a robustness check.
🏆 Final Selection
2018 → OLS | 2019 → Robust OLS
🔍Actual Values and Regression Predicted Values 2018
Comparison of model-predicted happiness scores with actual scores for 2018.

📢In the 2018 dataset, the OLS model produced predictions very close to the actual values for most countries, with the majority of points lying near the 45° reference line—indicating a strong overall fit. However, there is a slight underestimation tendency for high happiness scores and some overestimation for lower scores, suggesting that the model's performance at extreme values is slightly weaker compared to mid-range values.
🔍Actual Values and Regression Predicted Values 2019
Comparison of model-predicted happiness scores with actual scores for 2019.

📢In the 2019 dataset, the Robust OLS model produced predictions close to the actual values for most countries, with points clustering near the 45° line. Slight underestimation appears at higher scores, while some overestimation occurs at lower scores, indicating slightly weaker performance at extreme values.
📊 Performance Metrics & Visual Comparisons
📊 Performance Table
This graph displays the comparison of the results from the model selection process.

📢This graph clearly supports the model selection rationale discussed above. In both 2018 and 2019, OLS, Robust OLS, and WLS produce identical results, while GB shows a weaker fit to the dataset. For the 2019 dataset, Robust OLS is the most appropriate choice because: - The Breusch–Pagan test confirmed the presence of heteroskedasticity. - Due to the presence of outliers, using GB would be risky — and its fit was clearly weaker. - Among the remaining models, Robust OLS performs on par without falling behind in accuracy. For the 2018 dataset, the Breusch–Pagan test found no heteroskedasticity. However, the Jarque–Bera normality test indicated the presence of outliers and a non‑normal distribution. - Given the outliers and GB’s weaker fit compared to the other models, GB was excluded. - Because the data is homoskedastic, Robust OLS is unnecessary. - OLS is the most suitable model here due to its simplicity, interpretability, and strong performance. In summary: - 2018: OLS (homoskedastic, outliers present, GB weaker) - 2019: Robust OLS (heteroskedastic, outliers present, GB weaker)
📊 Visual Comparisons
You can view the model predicted happiness scores with actual scores distribution in the following chart:

-📢OLS, Robust OLS, WLS: Show similar predictive performance. - However, since heteroskedasticity was detected in the 2019 dataset, Robust OLS is preferred for more reliable confidence intervals and p‑values. - In the 2018 dataset, no heteroskedasticity was observed, so OLS was sufficient. - GB (Gradient Boosting) performed well overall, but exhibited more noticeable deviations for certain outliers. In summary, while predictive accuracy was similar, the choice of model varied depending on the dataset’s characteristics, with statistical reliability being the key deciding factor.