What are the factors that most top world happiness countries have in common?

Based on three datasets collected by Gallup World Poll and posted on Kaggle in 2015, 2016, and 2017, six aspects are considered when giving the happiness score to countries around the world and ranking their happiness level according to that score: economy (GDP per Capita), family, healthcare (life expectancy), level of freedom, generosity, and trust in the government.

The plotting of each factor shows the data of that factor for each country from the highest to the lowest in happiness ranking.

In 2015, the histogram displaying the economic performance of each country using GDP per Capita shows a trend that is strongly right-skewed. Even though the highest ranking country, Switzerland, does not have the highest GDP per Capita, from data points, we can apply a linear regression test that will result in a strong negative, linear relationship. The similar scenario also appears in the GDP per Capita versus country’s ranking graph in 2016 and 2017. This linear relationship that is displayed by the data plot implies there is a correlation between the economy of a country and its world happiness ranking: The better the economic performance (judging using GDP per capita), the higher in the rank that country is.

Family is also taken into consideration by Kaggle to give the happiness score to each country. The histogram is drawn using the family score of each country. The family score versus country rankings data plot shows a similar trend for 2015, 2016, and 2017: a lightly right-skewed negative relationship. Even though the difference between each country’s family score is not significant, the relationship implies a correlation between family and country ranking: the higher the family score, the higher happiness score the country receives. Thus, this factor plays a role in grading a country’s happiness level.

Another important factor that comes into ranking a country’s happiness ranking is freedom. In this context, freedom takes the political and social definition. The freedom score versus country ranking is graphed using scatterplot. In all of the three years, the scatterplot demonstrates a linear relationship if we apply the linear regression test. This relationship is strong and negative. The relationship can be estimated using the y = a + bx equation with a negative slope. The x-value is the country ranking and the y-value is the freedom score. This means that a higher ranking (smaller x-value) will give a greater freedom score. This gives us a reasonable justification based on the data that freedom and country ranking correlate.

The people’s satisfaction with the government is also important. The data on the people’s trust in their government is collected and converted numeric score. The trust score versus country ranking is graphed using scatterplot. Unlike other factors, this scatterplot does not display a linear relationship, so it is inaccurate if we use linear regression test. However, visually, the distribution in the graph can be fitted with the equation y = a + b/x with x-value is the country ranking and y-value is the trust score. This relationship means that the higher the country ranking (smaller x) the greater the trust score. This implies a reciprocal correlation: most world happiness country has high trust score. The fact that the scatterplots in 2015, 2016, and 2017 look identical to each other make this correlation reasonably justified.

Among all factors, the generosity seems to be more out of place. The data for this factor from each country is plotted with the country ranking using scatterplot. One thing that makes the generosity score data diverges from other factors is that it does not show any clear relationship between the datasets. Using any statistical regression test would give a very low R-squared value. This means that there is no apparent relationship between generosity score and the country ranking. Thus, it is difficult to make any inference on the correlation for this data. It could be that generosity score is not very indicative of a country’s happiness score.

As every country around the globe is trying to improve social welfare, it is important to pay attention the overall happiness of the general population. Based on the data analysis, economy, family, healthcare, level of freedom, and relationship between government and the people show strong correlation to the how well-performed a country is in happiness score. Therefore, in order to improve the quality of life of the people, countries should seriously take a look into the aspects of the people’s life and make action.



*The graphs are shown in order of year 2015, 2016, 2017

You can view my code here:

Share this project
  1. April 27, 2018 by Anna Thompson

    To be completely honest, when I first clicked on this page, I assumed that the project would have something to do with positive psychology (probably just because I’m in a psychology class). However, I was pleasantly surprised to find that the project was for a computer science class, yet was still applicable to some of the things I’ve been learning recently (very cool that everything is interconnected!)! I can’t say that I know too much about computer coding, but all of your trend and relationship analysis was both interesting and accurate. Just out of curiosity, in which countries are people the happiest? Is there one factor in particular that you find most important in determining this happiness? Overall, awesome job!

  2. April 27, 2018 by Rory Smith

    Similar to Anna Thompson, when I first read the title of your presentation I thought that it would relate to positive psychology. However, what I instead found was very informative and thought-provoking (and can be applied to psychology as well!). Last semester, I was in a class at my school called “Mission-Driven Life” which investigated how best to lead a moral, happy, and productive life. During the class, we read an article that described Denmark as one of the happiest countries in the world, but I couldn’t quite figure out how that was measured. Thank you for sharing this information, as it cleared some things up for me! Based on your findings, do you think that one factor is most influential? If a country were to try to “raise its happiness rank,” per say, what would you recommend they focus on primarily? Nice job, I really loved your presentation!

  3. April 28, 2018 by BBracker

    Did you find any correlations with any other variables that were not part of the 6 used in the computation?

  4. April 28, 2018 by Nakul.Bajaj

    Are there any other aspects of peoples’ lives that are important and might contribute to happiness that you may have not mentioned in your article, or did not have enough space to write about?

  5. April 29, 2018 by Esther Bedoyan

    I liked the three variables that you choose to focus on (freedom, trust in government, and generosity). I was a little dissapointed when there was no noticable correlation between happiness and generosity, because I feel like we’d all like to think that being generous yourself increases your own happiness, however it was not surprising to see increased freedoms correlate with increased happiness. Although I think you did a great job with the visuals overall, I feel like it’d be helpful if you added a title and make the text on the axis a little bit bigger. But I really liked your paper!

  6. April 29, 2018 by Jimmy Chen

    Very interesting article. Perhaps things like generosity cannot be well quantified. Generous people may not really consider themselves generous.

  7. April 29, 2018 by Melle.Koper

    Great article, very interesting topic!

  8. April 29, 2018 by Justin.Chen

    The graphics in your article are extremely helpful for understanding your points. It is a great article that has clearly been the result of much hard work.

  9. April 30, 2018 by Naoya.Okamoto

    Great article. It’s interesting that there are some factors that occur on a lower-level scale, such as family and generosity. It’s not only large factors like GDP.

  10. April 30, 2018 by Ananth J Josyula

    When I first saw this article I immediately knew that you would be analyzing many different facets of “happiness”, indicating a deep complexity in the material; from what I see, you did just that. Great job Huy.

  11. April 30, 2018 by Cole.Biafore

    I think this is a really cool article considering all the different variables you tested. I never realized how impactful trust and freedom were in correlation to happiness. To be completely honest, I was a little surprised that there was no correlation between generosity and happiness and I wonder what may be causing that to occur.

Sorry, the comment form is closed at this time.

Sorry, the comment form is closed at this time.