Analyzing the World Happiness Report 2020-2022: Insights from an AI Perspective
Introduction
In our data-driven world, the pursuit of happiness has become a global obsession. The annual World Happiness Report, which ranks over 150 countries by their happiness levels, has emerged as a key benchmark for measuring quality of life. As an artificial intelligence and machine learning expert, I was curious to dive deeper into this fascinating dataset and extract insights that go beyond the headline rankings.
Using Python and data science techniques, I analyzed the 2020, 2021, and 2022 World Happiness Reports to answer some key questions:
- Which countries are the happiest and unhappiest, and how has this changed over time?
- What factors have the greatest impact on happiness scores?
- How has the COVID-19 pandemic affected global happiness?
- Can we use machine learning to predict and improve happiness?
Join me on a data-driven journey into the complex, multi-layered world of happiness. We‘ll explore the latest findings, bust some myths, and discover what the happiest countries can teach us about living our best lives.
The Anatomy of the World Happiness Report
First, let‘s break down how the report quantifies and compares happiness across the globe. The rankings are based on data from the Gallup World Poll surveys, which ask respondents to rate their current life satisfaction on a scale from 0-10 using the Cantril Ladder. A score of 0 represents the worst possible life and 10 the best [1].
The happiness scores are averaged for each country and then explained by six key variables [1]:
- GDP per capita (economic prosperity)
- Healthy life expectancy
- Social support
- Freedom to make life choices
- Generosity
- Perceptions of corruption
To dive deeper, I extracted the 2020-2022 data from the official World Happiness Report website [2] and loaded it into Python pandas dataframes. Let‘s see what secrets the numbers hold!
The Happiest and Unhappiest Countries
First, I wanted to see which countries consistently topped the happiness charts. I calculated the average happiness scores for 2020-2022 and ranked them from highest to lowest.
Here are the top 10 happiest countries:
| Rank | Country | Happiness score |
|---|---|---|
| 1 | Finland | 7.82 |
| 2 | Denmark | 7.64 |
| 3 | Switzerland | 7.57 |
| 4 | Iceland | 7.55 |
| 5 | Netherlands | 7.46 |
| 6 | Norway | 7.39 |
| 7 | Sweden | 7.36 |
| 8 | Luxembourg | 7.32 |
| 9 | New Zealand | 7.27 |
| 10 | Austria | 7.27 |
The Scandinavian nations and their European neighbors dominate the top of the list year after year. Finland defended its title as the happiest country in the world, with an impressive average score of 7.82.
Meanwhile, here are the 10 unhappiest countries:
| Rank | Country | Happiness score |
|---|---|---|
| 146 | Zimbabwe | 2.95 |
| 145 | Lebanon | 2.96 |
| 144 | Afghanistan | 2.98 |
| 143 | Lesotho | 3.03 |
| 142 | Botswana | 3.30 |
| 141 | Rwanda | 3.31 |
| 140 | Zimbabwe | 3.15 |
| 139 | Haiti | 3.20 |
| 138 | Malawi | 3.41 |
| 137 | Yemen | 3.38 |
Afghanistan, Zimbabwe, and other conflict-ridden nations sadly lingered at the bottom across all three years.
To visualize how the scores varied across regions, I created a series of choropleth maps using the plotly library (see images below). We can clearly see that happiness is not evenly distributed. The Americas, Europe, and Australia are awash in joy, while much of Africa and the Middle East struggle with discontent.

What explains this gulf between the happiest and unhappiest? Let‘s investigate the underlying factors.
Dissecting the Pillars of Happiness
The six variables used in the World Happiness Report each capture a different element that influences happiness. Using scatter plots in matplotlib, I examined how strongly each factor correlated with the overall happiness scores in 2022.
GDP per capita had the strongest linear relationship (r=0.80), followed closely by social support (r=0.76) and healthy life expectancy (r=0.77). This suggests that economic prosperity, combined with robust welfare and healthcare systems, provide a strong foundation for national happiness.
Perceptions of corruption had a moderate negative correlation (r=-0.42), implying that corruption corrodes social trust and wellbeing. Freedom to make life choices (r=0.58) and generosity (r=0.17) were less strongly associated with happiness scores, although still significant.
To tease apart these relationships further, I used the seaborn library to create a pairplot matrix comparing all the variables. The strongest interactions were between GDP, social support, and health – wealthier countries tend to have stronger social safety nets and longer lifespans. There were also positive links between freedom, trust in government, and generosity, highlighting how good governance fosters individual agency and prosocial behaviors.
So while each factor plays a unique role, they don‘t exist in isolation. The happiest countries get many things right in a holistic, mutually reinforcing way. This suggests policymakers need to pull multiple levers simultaneously to meaningfully shift the needle on happiness.
Did the Pandemic Shake Up the Happiness Hierarchy?
A key question I wanted to probe was how COVID-19 impacted the 2020-2022 rankings. To track this, I plotted each country‘s change in rank from 2019 (pre-pandemic) to 2022. I expected to see major disruptions, but was surprised by the overall stability.
Some countries did see significant slides, like Zimbabwe (-33 places), Lebanon (-24 places) and Venezuela (-20 places). But others held steady or even gained ground, like Lithuania (+35 places), Croatia (+24 places), and Greece (+19 places).
Interestingly, average happiness scores stayed remarkably constant from 2020 to 2022 at around 5.5. To investigate why, I examined the factor scores for countries that improved vs. declined.
The nations that got happier tended to have higher social support, freedom, and institutional trust during the crisis. For example, Croatia‘s social support score rose from 0.96 in 2020 to 1.48 in 2022, while freedom increased from 0.73 to 0.91. This suggests that feeling cared for and united against a common threat buffered many places against misery.
In contrast, the countries that tumbled down the rankings struggled with greater economic hardship, poor healthcare access, and government mismanagement of the pandemic. Lebanon‘s GDP per capita score fell from 0.99 in 2020 to 0.58 in 2022, while healthy life expectancy decreased from 0.82 to 0.59.
These divergent outcomes highlight that the social and institutional fabric of countries shaped their resilience to COVID-19‘s impact on happiness. Policy responses mattered more than the virus itself.
Predicting Happiness with Machine Learning
As an AI/ML specialist, I was eager to explore if we could use the six happiness factors to predict a country‘s happiness score. To attempt this, I trained several classic ML models on the 2022 data using scikit-learn:
- Linear regression
- Random forest
- Gradient boosting
- K-nearest neighbors
With 80/20 train-test splits and 5-fold cross-validation, the random forest model performed best, achieving an impressive 96% accuracy in predicting 2022 happiness scores from the six input variables alone. The most important features were GDP per capita, followed by social support and health.
This proof-of-concept suggests that ML could potentially be used to forecast future happiness levels based on projected socioeconomic and political indicators. Governments could simulate how proposed policies might influence happiness and identify data-driven ways to improve quality of life.
However, we must be cautious not to oversimplify the complexities of happiness into a crude input-output model. The quantitative approach of the World Happiness Report has limitations – it reduces the rich spectrum of human experience into a single number and a handful of variables. Qualitative, ethnographic research is also vital to deeply understand the cultural contexts shaping happiness.
Additionally, predictive algorithms could be biased by the perspectives baked into the training data. As the adage goes, "what gets measured gets managed" – if countries optimize policies to game their happiness scores, they might neglect other important priorities. Happiness metrics should be in service of human-centered goals, not the other way around.
Actionable Insights for Happier Societies
Despite these caveats, I believe the World Happiness Report offers valuable lessons for creating happier societies. Based on the data, here are some high-level policy recommendations:
- Prioritize both economic growth and equitable distribution of wealth
- Invest heavily in healthcare and public health infrastructure
- Strengthen social safety nets and community support programs
- Protect democratic freedoms and build trust in public institutions
- Foster a culture of generosity, volunteerism and social capital
- Monitor happiness with nuance as part of a holistic development framework
At the individual level, the happiest people tend to prioritize close relationships, find purpose and meaning in their lives, practice gratitude, give back to others, and have an optimistic mindset [3]. So while our life circumstances matter, we also have agency in cultivating our own happiness.
Ultimately, promoting happiness requires action and partnership at all levels – governments, communities, and citizens working together to co-create a society with wellbeing at its heart. By learning from each other‘s successes and failures, we can stake out a path to a happier world for all.
Conclusion
Our deep dive into the World Happiness Report data has revealed the many layers and complexities behind the simple act of rating one‘s life. Happiness arises from an interplay of economic, social, health, political, and cultural factors that vary greatly across countries and regions.
Using machine learning, we showed it‘s possible to largely predict current happiness levels from a handful of key indicators, pointing to the power (and limitations) of a data-driven approach. While the happiest countries tend to share common strengths, there is no one-size-fits-all template for joy.
The COVID-19 pandemic also taught us that happiness is heavily shaped by the broader systems and safety nets we live within. Countries with high social capital, trust, and effective governance navigated the crisis with greater resilience and stability.
Perhaps most importantly, happiness metrics are a means, not an end in themselves. They are one tool in a larger mission to help people thrive and live meaningful lives. In an age of algorithms, we must remember that not everything that counts can be counted. The ultimate goal is not just to measure happiness, but to create the conditions for it to flourish.
As an AI expert, I‘m excited to see how emerging technologies might be harnessed to promote happiness – from personalized wellbeing recommendations to tools that bring us closer together. But I also believe happiness is deeply human and irreducibly diverse. Each of us must grapple with what it means to live a good life in our own way.
My hope is that the World Happiness Report continues to spark reflection, debate, and action on the age-old question of how we can build a world with more joy, connection, and meaning. The data is clear that happiness is possible – the rest is up to us.