Using Data to Analyze Happiness Around the World

Posted on Aug 16, 2020

LinkedIn | Github |ShinyApp

Working as a solutions engineer in the technical services division for an electronic healthcare records company, a bulk of my success was measured by happiness of my customers. However, happiness is not always so easy to measure because everyone has different standards and situations. In this project, I aim to investigate the success of countries around the world by analyzing different factors that attribute to happiness among citizens of different parts of the world. In this text we will use data to analyze happiness around the world.

Data Overview

The data I used for this project was taken from World Happiness Report. Each country is given an overall happiness score for each year and the overall happiness score can be broken down into the following 6 categories:
- GDP per Capita
- Healthy Life Expectancy
- Freedom to Make Life Choices
- Generosity
- Perception of Corruption
- Social Support

A country is given a score for each of the 6 categories and each category score measures how that category improves people's lives compared to Dystopia. Dystopia is a hypothetical country with the lowest scores in all of the 6 categories. The overall score is the summation of the 6 category scores and a residual component called Dystopia Residual that reflect the extent to which the 6 variables over or under estimate the average score.


World Map

My shiny dashboard contains 2 main tabs: World Map and Explore. The World Map tab allows the user to select the year and categories to create a new overall score. The user input is reflected in the world map which shows a darker green for countries with higher scores. The actual data that drives the map is also shown in the bottom.

Overall Happiness Score 2019 World Map

This map shows that Americas, Europe, Australia and New Zealand have higher happiness score than Africa and Asia for the year 2019. Since everyone has different priorities that make their lives happy, users can choose the criteria that are most important for them and investigate how countries rank based on their individual preferences for happiness.


Let's zoom in to the explore page to investigate correlations and trends.

In the variables tab of the explore page, we can investigate which category scores are highly correlated with the overall score by selecting Happiness Score on the Y-axis and desired criteria to investigate on the X-axis.

Highest Correlated Categories

The three highest correlated categories with respect to the overall score are GDP per capita, healthy life expectancy and social support. This shows that countries that are happier due to GDP, healthy life expectancy and social support are more likely to be happier overall.

Lowest Correlated Categories

On the contrary, generosity, perception of corruption and freedom to make life choices were the lowest correlated categories. Therefore, having a high score for these categories does not necessarily lead to higher overall happiness.


On the trends tab, users can analyze which countries had the most increase or decrease in scores for a selected time range.

Top 5 Increasing and Decreasing Countries

The graphs above show top 5 increasing and decreasing countries from 2015 to 2019. With such trending information, countries can understand their current situation with respect to previous years and take actions to make their citizens happier or keep them happy. Further research can be done to analyze trends of happiness scores with factors that may contribute to happiness such as political stability, income disparity and incarceration rates.


Similar to the world map page, regions tab allows users to select criteria of their interest and group by the sub region or continent. A bar graph shows the aggregated score from user's input for each region and the data table is shown below.


Aggregate Scores by Continent

Our observations from the world map page that showed Americas, Oceania and Europe to be happier than Asia and Africa holds true according to the bar chart above.


Through this project, we identified the top 3 correlated categories for overall happiness score were GDP per capita, healthy life expectancy and social support. We also identified which countries were most increasing or decreasing in happiness. This information can serve as a foundation forΒ  further analysis studying the cause of decrease or increase in happiness. Furthermore, we quantified that Americas and Oceania are the happiest continents above Europe, Asia and Africa. I hope you can use this dashboard to select criteria that are most important to you and see which countries or regions are happiest to your standards.

The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

About Author

Brandon Ryu

Experienced Engineer who enjoys using strong research and technical background to guide healthcare software products that aim to improve patient care around the world. Strong interdisciplinary professional who focuses on collaborating with users, stakeholders and developers to drive...
View all posts by Brandon Ryu >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI