🌍 World Happiness Analysis

Analysis and Visualization of World Happiness Data

🎯 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

🏆 Outcomes

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.

Değişken Etkileri Yıllar

📢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..

Mutluluk Etiket Dağılımı

📢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.

However, in some countries, the opposite occurs — both the happiness score and the happiness label increase:

These results suggest:

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.

Happiness label changes do not occur in all cases, but in some countries, they do:

⚖️ 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:

Therefore, Robust OLS was chosen for 2019.

📈 Additional ML Model Evaluation

To complement statistical models, a Gradient Boosting Regressor was tested for both years:

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.

Tahmin vs Gerçek 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.

Tahmin vs Gerçek 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.

Model Comparison Table

📢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:

Predicted vs Actual

-📢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.