What defines a happy country?

Oleh Misko
12 min readJul 22, 2020
Source: https://www.pexels.com/@elletakesphotos

Could you say that you are happy? What about your neighbors, friends? World Happiness Report (WHR) conducts an annual survey to measure the happiness of the citizens in different countries. They have detailed reports with explanations and interesting insights on their official website.

In this blog post, I would perform an analysis of the data that they gathered and share some of my opinions. Moreover, I would try to train a simple Linear Regression model to predict happiness scores for different countries and then compare it with the ground truth. A good model may give information about what features have a bigger influence on happiness scores.

The data is sourced at Kaggle. However, it requires a number of pre-processing steps before doing any visualization or training. I could send a cleaned version of the data on-premise.

What data are we working with?

The dataset provides us a number of files that correspond to happiness surveys starting from 2015 up to 2020. So, in essence, we have information about happiness in different countries for six consecutive years. The datasets do not vary a lot, however, there are some differences in the name conventions, which were a part of the pre-processing step. In general, we have information about:

  • Country and region of the world
  • Economy (GDP per Capita)
  • Level of freedom and ability to self-express
  • Family and social support
  • Generosity in the country
  • Health level and life expectancy
  • Trust (government corruption level)
  • Dystopia residual score
  • Happiness rank and happiness score
Data example extracted from the 2015 annual report

This data is available for 173 countries for each year. A detailed explanation of each feature and how they were measured is available in the corresponding sections of reports on the WHR website.

The rankings are based on answers to the main life evaluation question asked in the poll. This is called the Cantril ladder: it asks respondents to think of a ladder, with the best possible life for them being a 10, and the worst possible life being a 0. They are then asked to rate their own current lives on that 0 to 10 scale. The features show the estimated extent to which each of six factors — levels of GDP, life expectancy, generosity, social support, freedom, and corruption — contribute to making life evaluations higher in each country than they are in Dystopia. Dystopia is an imaginary country that has the world’s least-happy people. The purpose in establishing Dystopia is to have a benchmark against which all countries can be favorably compared (no country performs more poorly than Dystopia) [1].

The effect of different factors on the happiness

As a first step, I would like to visualize the relationship between the explanatory features (a term from the statistics and machine learning world) and the target feature (in our case it is the happiness score). We would calculate Pearson’s Correlation Coefficient (PCC) to have a more practical way of saying “this relates with that on the magnitude of X” (correlation is not causation, but could provide valuable information). Additionally, we would check the relations between explanatory features as they may provide interesting insights about life in different countries.

Note: In the examples below I am using an averaged version of the original data. I merged together datasets for six years and then averaged the data country-wise.

Economy

The economic level is a very important aspect of any country. The naive way to think is that the higher the level of the economy in the country — the happier would the citizens be. Is that always true?

The level of the economy has a strong relation to the happiness score

We may see a linear trend in the relation of happiness score to GDP per Capita. The PCC is equal to 0.796 which suggests a high level of positive correlation.

However, from this visualization, we also see that the countries with the biggest avg. GPD per capita, which exceeds the value of 1.6, does not have the highest happiness score. Money does not equal happiness?

Let’s take a closer look at these countries

Oil and gas producing countries seem to hold the prize places

We see that from top-three countries by economy-level — two of them are major oil and gas producing countries. The third country — Luxembourg, is a prominent competitor. But how a small European country could be on the same level as oil and gas industry giants?

Luxembourg is a tax and regulatory haven for the financial sector. It offers large international companies the opportunity to virtually locate their seat of exploitation there, and therefore pay taxes there. Said taxes are extremely low, said companies thus making gigantic saves by not paying proper taxes in the lands where they are effectively active.

In addition to fiscal income, this system provides for a lot of high-paying jobs for bankers and accountants. This has made Luxembourg an important job market, with about 1.500.000 workers for only 500.000 inhabitants [2]

However, Qatar and the United Arab Emirates (UAE) have relatively low health and trust levels (compared to Luxembourg or other developed countries like Norway or Sweden). Nevertheless, these countries show a rapid development and may climb to the top of the table in the near future.

Social security and family

Human beings on a subconscious and biological level give great priority to their families and tribes. So when a person is asked, “What will make you happy?” alongside thinking about a prestigious job, expensive sports cars, and large houses on the Italian coasts he may also think about what people will surround him in these delightful circumstances [3].

Besides that, social security is another important privilege of modern society. Any living person would like to be sure about tomorrow if anything extraordinary will happen. What would her kids eat if she gets fired from her job? How would he handle the sickness of his mother? What could they do if they will lose their house due to a loan fine?

Family and social security levels have a clear linear correlation with the happiness score

And the relationship is not surprising. People like to be sure that everything will be fine under any circumstances and that their families would be taken care of. Therefore, there is a clear linear relationship between social security/family and happiness scores with minor spreads. The PCC is equal to 0.757 which means that the two features have a strong positive correlation.

Countries that are/have been recently in military conflicts (Afghanistan, Yemen, Libya, Iran, Ukraine) are suffering from low values of the social security and family level measurements, as well as economic and corruption problems. People are not safe there and they are not sure what the future day will bring.

Freedom

How one would define freedom? Is a person free when he can openly criticize the authorities of his country? Or is freedom a state of opportunities for self-expression? I believe, that such terms as freedom and love may have an infinite number of definitions, but for the sake of simplicity let’s consider freedom as “an opportunity to openly share the thoughts about various aspects of the life as economics, politics, and culture, as well as the ability to move without restrictions on the territory of his/her and other countries”. This is a very simple definition that would put everyone on the same page.

The spread in the relationship between freedom and happiness score is relatively big

Compared to the two previous figures — here we see a broad spread of the points on the plot. The PCC is equal to 0.597 which is notably lower than for the Economy and Family but still shows a relatively strong positive correlation.

Does it mean that people value freedom less than the economy or family? Well, not necessarily. In a communist model of society, the economy and family are valued in the first place (compared to the freedom which was almost zero), but from the historical facts, it’s not probable that people in the communistic countries were the happiest ones.

Let’s additionally check several countries with the lowest and highest values of freedom.

Countries that are in local war conflicts show low levels of freedom

Most of the countries that are on the bottom of the list by the Freedom feature are either in a local war conflict or have been in conflicts in the last decades (the Angolan Civil War was spanned across 26 years up till 2002 and the Sudanese coup d’état was conducted in 2019). Other countries — Afghanistan and Syria nowadays have active military conflicts in their territories. Either civil or national wars always bring pain and sorrow and it affects the happiness of the citizens. Most of the men in such countries are either voluntarily or by force involved in armed conflicts. Therefore, the freedom for them and their families tends to zero, as well as happiness level.

Fast-developing countries show high levels of freedom

On the other hand, Oman, Cambodia, and Uzbekistan are fast-developing countries that continuously rise on the Global Peace Index and Human Development Index ranks.

On the other hand, Norway (it has had the highest Human Development Index ranking in the world since 2009, a position also held previously between 2001 and 2006) and Denmark (The country ranks highly in some metrics of national performance, including education, health care, protection of civil liberties, democratic governance, LGBT equality, prosperity, and human development) are Nordic countries which were more or less stable throughout the last decades, without major war conflicts or civil conflicts.

Nowadays the rights of social and sexual minorities are considered as one of the major factors of the freedom value for a country. While European and North American countries provide equal rights for either LGBT and non-LGBT citizens and other minorities, countries from the Middle East and some parts of Asia are not as tolerant due to cultural and religious reasons.

Health

It’s hard to evaluate which factor is more important — all arguments may be quite subjective. Nevertheless, I believe that health would definitely be at the top of the leaderboard. Without good healthcare, other factors like freedom or economy may not be as valuable. Moreover, the healthcare level intersects with the social security/family domain and may be dependent on the economy of that country.

Healthcare level shows a positive correlation with the happiness score

With PCC of 0.764, we see a strong positive correlation between the happiness of people and the healthcare level in the country. We could spot that several countries have a very high healthcare level but a rather moderate happiness score. Moreover, there are several countries with quite a low healthcare level but still moderate happiness scores.

Asian countries show the highest healthcare levels

Even though Hong Kong, Japan, and Singapore are highly developed Asian countries we see that they have relatively average levels of freedom and trust. Northern Cyprus has a high healthcare level, but very low government trust and generosity levels.

African countries show the lowest levels of health as well as other factors

On the other hand, we see extremely low healthcare levels in African countries compared to some of the Asian countries. But health is not the only problem in these countries — government trust, generosity, and freedom are major issues as well.

How the economy influences the healthcare system?

Additionally, let’s check the relation between the economy and healthcare levels in the country.

We see a clear linear trend with moderate deviations. A PCC of 0.837 shows a very strong positive correlation between the level of economical development and the healthcare system in the country.

Economic opportunity motivates and enables people to invest in their health; its absence does the reverse. Although the Patient Protection and Affordable Care Act remains “the law of the land”, even small changes may matter. For example, economic theory predicts that weak enforcement of the individual mandate would raise health care premiums, lower coverage, and destabilize health insurance exchanges. Why? Young, healthy enrollees, without a mandate, will opt not to purchase health insurance coverage on exchanges. In response, insurers may raise premiums to meet expected costs of the remaining, sicker enrollees on exchanges, which in turn will accelerate exits of more healthy people, and eventually insurers, from the exchange. Therefore, small policy details have large economic impacts on insurance coverage and costs [5].

Government trust and corruption level

The last feature that we will explore is the level of trust in the government and government corruption. Trust is an essential element of social capital — it’s a key contributor to establish well-being, including economic and social development. Each feature that we explored has some influence on the general picture, but the honesty and quality work of the authorities may have the most significant influence on the economy, healthcare, and social security levels.

There is no visible linear correlation between government trust and happiness scores as we had more or less with all previous features. The PCC value of 0.377 indicates a weak positive correlation. Although countries with higher government trust levels tend to have higher happiness scores, most of the countries respond quite low government trust.

Public trust in the government remains near historic lows. Only 17% of Americans today say they can trust the government in Washington to do what is right “just about always” (3%) or “most of the time” (14%) [6].

A recent study investigating the political attitudes of citizens of Western European countries suggests that lockdown policies have increased their support for the government. The study, published in the European Journal of Political Research, suggests that confinement measures have increased citizens’ support for their prime minister or president by about 4% and trust in the government by around 3% [7].

In general, this means that people tend not to trust their authorities a lot around the world.

Would a simple algorithm explain the importance of the factors?

Finally, we would try to train a simple Linear Regression algorithm to predict country happiness levels based on all the factors discussed above.

As the dataset, I took combined data for 2015–2020, which results in 973 data points. The happiness score would be our target variable (Y) and all other features — economy, health, family and etc. would be explanatory variables (X).

To obtain training and testing sets I split the dataset by 85/15 ratio due to a relatively small amount of available data. The performance of the model is evaluated using Mean-Squared Error (MSE) and R2 score.

The prediction on hold-out data (random sample is visualized) show relatively good performance

From the figure above we may see that the model generally does a good job. The MSE error is 0.29 and the Coefficient of determination is 0.76. The weight coefficients for the model:

There are no heavy outliers, but the freedom, economy, and health have the biggest weights. On the other hand, generosity seems to be not so important in terms of predicting the happiness score, as well as social security/family level. Of course, these assumptions are rather rough estimates than some conclusions but may lead to some valuable insights.

Conclusions

Source: https://www.pexels.com/@wildlittlethingsphoto

The estimation of happiness levels throughout the world is an important task. The results could give us an understanding of what we as a human nation should pay attention to. Even nowadays there are hundreds of campaigns that are aiding third-world and developing countries it’s still not enough. The changes begin from the inside — we need to change the way we think about countries that are far away but may benefit from our assistance.

I hope that this blog post gave some interesting ideas and thoughts to you. Maybe it’s you, who will run the next campaign to provide healthcare assistance to people in the Central African Republic? Or maybe you and your friends will start a donation company to afford a sufficient level of education for the children of Yemen. The changes that we can do are waiting for us — we just need to dare.

References

[1] World Happiness Report, 2015.

[2] Quora, How did Luxembourg get so rich?

[3] Yuval Noah Harari, Sapiens: A Brief History of Humankind.

[4] Wikipedia, Central African Republic.

[5] Ellen Meara, Darthmouth Institute. 3 Examples of How Economics Affects Health and Health Care.

[6] Pew Research Center. Public Trust in Government: 1958–2019.

[7] Damien Bol et al. The effect of COVID‐19 lockdowns on political support: Some good news for democracy?

--

--

Oleh Misko

Machine Learning Engineer with MSc in Data Science. Passionate about statistics, math, data analysis and visualization, machine learning and deep learning.