Happiness is an emotional state characterized by feelings of joy, fulfillment, satisfaction and bliss. Over the past few years from pre-pandemic times to post pandemics. Many individuals have faced some sort of adversity. Covid lock down has given many individuals opportunities to self explore and do a deep dive analysis on self-worth.
Happiness seem to be a big trend the past two years. In the U.S. Declaration of Independence, the pursuit of happiness is protected as a fundamental human right, up there with life and liberty(1). How do one get to that point of happiness? A psychologist, Diener identifies five factors that contribute to happiness: social relationships, temperament/adaption, money, society and culture, and positive thinking style(1).
Based on observation, and research. Do these Fivefactors: social relationships, adaption, money, society and culture, and positive thinking style provide an insight on better life expectancy when the population is happier?
The origin of site for information about world happiness report is found on: Website: https://worldhappiness.report/ed/2021/
The dataset was found VIA the Kaggle: https://www.kaggle.com/datasets/ajaypalsinghlo/world-happiness-report-2021
Once the dataset was downloaded, i added it on Github and used it via RAW data: https://github.com/Wilchau/Data606_Happiness_Project
The method of data collection The data was mainstreamed by being collected through Sustainable Development Solutions Network(SDSN) in 2021 as part of the World Happiness scores and ranking use data from the Gallup World Poll. This is an observational study, where the population of interest is all of the people in the respective countries who takes the survey.
The source: We can focus on getting the libraries set up and the dataset.
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0 ✔ purrr 0.3.5
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.5.0
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(corrplot)
## corrplot 0.92 loaded
library(RColorBrewer)
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
##
## The following objects are masked from 'package:dplyr':
##
## src, summarize
##
## The following objects are masked from 'package:base':
##
## format.pval, units
library(ggpubr)
happiness <- read.csv("https://raw.githubusercontent.com/Wilchau/Data606_Happiness_Project/main/world-happiness-report-2021.csv.xls")
glimpse(happiness)
## Rows: 149
## Columns: 20
## $ Country.name <chr> "Finland", "Denmark", "Swit…
## $ Regional.indicator <chr> "Western Europe", "Western …
## $ Ladder.score <dbl> 7.842, 7.620, 7.571, 7.554,…
## $ Standard.error.of.ladder.score <dbl> 0.032, 0.035, 0.036, 0.059,…
## $ upperwhisker <dbl> 7.904, 7.687, 7.643, 7.670,…
## $ lowerwhisker <dbl> 7.780, 7.552, 7.500, 7.438,…
## $ Logged.GDP.per.capita <dbl> 10.775, 10.933, 11.117, 10.…
## $ Social.support <dbl> 0.954, 0.954, 0.942, 0.983,…
## $ Healthy.life.expectancy <dbl> 72.000, 72.700, 74.400, 73.…
## $ Freedom.to.make.life.choices <dbl> 0.949, 0.946, 0.919, 0.955,…
## $ Generosity <dbl> -0.098, 0.030, 0.025, 0.160…
## $ Perceptions.of.corruption <dbl> 0.186, 0.179, 0.292, 0.673,…
## $ Ladder.score.in.Dystopia <dbl> 2.43, 2.43, 2.43, 2.43, 2.4…
## $ Explained.by..Log.GDP.per.capita <dbl> 1.446, 1.502, 1.566, 1.482,…
## $ Explained.by..Social.support <dbl> 1.106, 1.108, 1.079, 1.172,…
## $ Explained.by..Healthy.life.expectancy <dbl> 0.741, 0.763, 0.816, 0.772,…
## $ Explained.by..Freedom.to.make.life.choices <dbl> 0.691, 0.686, 0.653, 0.698,…
## $ Explained.by..Generosity <dbl> 0.124, 0.208, 0.204, 0.293,…
## $ Explained.by..Perceptions.of.corruption <dbl> 0.481, 0.485, 0.413, 0.170,…
## $ Dystopia...residual <dbl> 3.253, 2.868, 2.839, 2.967,…
When exploring this topic, World Happiness Report comes into mind. This report is done yearly in collaboration around the world to help provide a basic line of happiness in every country. The 2021 Survey reports that there are 149 countries representing the cases with 20 different types of variable presented.
Based on the Glimpse, there is some tidy and cleaning needs to be done in order to showcase the data analysis.
This is an observational study where surveys where conducted.
#Response: What is the response variable, and what type is it (numerical/categorical)? The response variable are the family, freedom,life expectancy, GDP per capita, generosity, and trust in government #Independent variable Definition: The independent variable is the cause. Its value is independent of other variables in your study. Independent variable: factors that affect happiness: family, freedom, life expectancy, GDP per capital, generosity, and trust in government.
#Dependent Variable: Definition: The dependent variable is the variable that is being measured or tested in an experiment. Dependent variable would be: Its value is dependent of other variables in your study. Independent variable: factors that affect happiness: family, freedom,life expectancy, GDP per capita, generosity, and trust in government. This would be a quantitative variable.
head(happiness)
## Country.name Regional.indicator Ladder.score Standard.error.of.ladder.score
## 1 Finland Western Europe 7.842 0.032
## 2 Denmark Western Europe 7.620 0.035
## 3 Switzerland Western Europe 7.571 0.036
## 4 Iceland Western Europe 7.554 0.059
## 5 Netherlands Western Europe 7.464 0.027
## 6 Norway Western Europe 7.392 0.035
## upperwhisker lowerwhisker Logged.GDP.per.capita Social.support
## 1 7.904 7.780 10.775 0.954
## 2 7.687 7.552 10.933 0.954
## 3 7.643 7.500 11.117 0.942
## 4 7.670 7.438 10.878 0.983
## 5 7.518 7.410 10.932 0.942
## 6 7.462 7.323 11.053 0.954
## Healthy.life.expectancy Freedom.to.make.life.choices Generosity
## 1 72.0 0.949 -0.098
## 2 72.7 0.946 0.030
## 3 74.4 0.919 0.025
## 4 73.0 0.955 0.160
## 5 72.4 0.913 0.175
## 6 73.3 0.960 0.093
## Perceptions.of.corruption Ladder.score.in.Dystopia
## 1 0.186 2.43
## 2 0.179 2.43
## 3 0.292 2.43
## 4 0.673 2.43
## 5 0.338 2.43
## 6 0.270 2.43
## Explained.by..Log.GDP.per.capita Explained.by..Social.support
## 1 1.446 1.106
## 2 1.502 1.108
## 3 1.566 1.079
## 4 1.482 1.172
## 5 1.501 1.079
## 6 1.543 1.108
## Explained.by..Healthy.life.expectancy
## 1 0.741
## 2 0.763
## 3 0.816
## 4 0.772
## 5 0.753
## 6 0.782
## Explained.by..Freedom.to.make.life.choices Explained.by..Generosity
## 1 0.691 0.124
## 2 0.686 0.208
## 3 0.653 0.204
## 4 0.698 0.293
## 5 0.647 0.302
## 6 0.703 0.249
## Explained.by..Perceptions.of.corruption Dystopia...residual
## 1 0.481 3.253
## 2 0.485 2.868
## 3 0.413 2.839
## 4 0.170 2.967
## 5 0.384 2.798
## 6 0.427 2.580
names(happiness)
## [1] "Country.name"
## [2] "Regional.indicator"
## [3] "Ladder.score"
## [4] "Standard.error.of.ladder.score"
## [5] "upperwhisker"
## [6] "lowerwhisker"
## [7] "Logged.GDP.per.capita"
## [8] "Social.support"
## [9] "Healthy.life.expectancy"
## [10] "Freedom.to.make.life.choices"
## [11] "Generosity"
## [12] "Perceptions.of.corruption"
## [13] "Ladder.score.in.Dystopia"
## [14] "Explained.by..Log.GDP.per.capita"
## [15] "Explained.by..Social.support"
## [16] "Explained.by..Healthy.life.expectancy"
## [17] "Explained.by..Freedom.to.make.life.choices"
## [18] "Explained.by..Generosity"
## [19] "Explained.by..Perceptions.of.corruption"
## [20] "Dystopia...residual"
Based on this survey and the definition of happiness: five factors
that contribute to happiness: social relationships,
temperament/adaption, money, society and culture, and positive thinking
style. From this name function we can focus on:
1) Social relationships = Social.support[8]
2) Temperament/adaption = Freedom.to.make.life.choices[10]
3) money = logged.GDP per capital [7]
4) society and culture = Regional indicator[2]
5) positive thinking style = Generosity[11]
From these 5 collective scores, I will focus on these variables along with life-expectancy due to
happiness <- happiness %>%
select(-upperwhisker, -lowerwhisker, -Dystopia...residual, - Ladder.score, -Explained.by..Log.GDP.per.capita, -Explained.by..Social.support, -Explained.by..Healthy.life.expectancy, -Explained.by..Freedom.to.make.life.choices, -Explained.by..Generosity, -Explained.by..Perceptions.of.corruption) %>%
mutate(Continent = case_when(
Country.name %in% c("Israel", "United Arab Emirates", "Singapore", "Thailand", "Taiwan Province of China", "Qatar", "Saudi Arabia", "Kuwait", "Bahrain", "Malaysia", "Uzbekistan", "Japan", "South Korea", "Turkmenistan",
"Kazakhstan", "Turkey", "Hong Kong S.A.R., China", "Philippines", "Jordan", "China", "Pakistan", "Indonesia", "Azerbaijan", "Lebanon", "Vietnam", "Tajikistan", "Bhutan", "Kyrgyzstan", "Nepal", "Mongolia",
"Palestinian Territories", "Iran", "Bangladesh", "Myanmar", "Iraq", "Sri Lanka", "Armenia", "India", "Georgia", "Cambodia", "Afghanistan", "Yemen", "Syria") ~ "Asia",
Country.name %in% c("Norway", "Denmark", "Iceland", "Switzerland", "Finland", "Netherlands", "Sweden", "Austria", "Ireland", "Germany", "Belgium", "Luxembourg", "United Kingdom", "Czech Republic", "Malta", "France",
"Spain","Slovakia", "Poland", "Italy", "Russia", "Lithuania", "Latvia", "Moldova", "Romania", "Slovenia", "North Cyprus", "Cyprus", "Estonia", "Belarus", "Serbia", "Hungary", "Croatia", "Kosovo",
"Montenegro", "Greece", "Portugal", "Bosnia and Herzegovina", "Macedonia", "Bulgaria", "Albania", "Ukraine") ~ "Europe",
Country.name %in% c("Canada", "Costa Rica", "United States", "Mexico", "Panama","Trinidad and Tobago", "El Salvador", "Belize", "Guatemala", "Jamaica", "Nicaragua", "Dominican Republic", "Honduras", "Haiti") ~ "North America",
Country.name %in% c("Chile", "Brazil", "Argentina", "Uruguay", "Colombia", "Ecuador", "Bolivia", "Peru", "Paraguay", "Venezuela") ~ "South America",
Country.name %in% c("New Zealand", "Australia") ~ "Australia",
TRUE ~ "Africa")) %>%
mutate(Regional.indicator = as.factor(Regional.indicator)) %>%
select(Country.name, Regional.indicator, everything())
glimpse(happiness)
## Rows: 149
## Columns: 11
## $ Country.name <chr> "Finland", "Denmark", "Switzerland", "I…
## $ Regional.indicator <fct> Western Europe, Western Europe, Western…
## $ Standard.error.of.ladder.score <dbl> 0.032, 0.035, 0.036, 0.059, 0.027, 0.03…
## $ Logged.GDP.per.capita <dbl> 10.775, 10.933, 11.117, 10.878, 10.932,…
## $ Social.support <dbl> 0.954, 0.954, 0.942, 0.983, 0.942, 0.95…
## $ Healthy.life.expectancy <dbl> 72.000, 72.700, 74.400, 73.000, 72.400,…
## $ Freedom.to.make.life.choices <dbl> 0.949, 0.946, 0.919, 0.955, 0.913, 0.96…
## $ Generosity <dbl> -0.098, 0.030, 0.025, 0.160, 0.175, 0.0…
## $ Perceptions.of.corruption <dbl> 0.186, 0.179, 0.292, 0.673, 0.338, 0.27…
## $ Ladder.score.in.Dystopia <dbl> 2.43, 2.43, 2.43, 2.43, 2.43, 2.43, 2.4…
## $ Continent <chr> "Europe", "Europe", "Europe", "Europe",…
I removed:
1) upperwhisker
2) lowerwhisker
3) Dystopia…residual
4)Ladder.score
5)Explained.by..Log.GDP.per.capita
6) Explained.by..Healthy.life.expectancy
7) Explained.by..Freedom.to.make.life.choices
8)Explained.by..Generosity
9) Explained.by..Perceptions.of.corruption
Descriptive statistical analysis
happiness %>%
select(-Regional.indicator, -Standard.error.of.ladder.score,-Country.name, -Continent, -Perceptions.of.corruption, -Ladder.score.in.Dystopia) %>%
Hmisc::describe()
## .
##
## 5 Variables 149 Observations
## --------------------------------------------------------------------------------
## Logged.GDP.per.capita
## n missing distinct Info Mean Gmd .05 .10
## 149 0 148 1 9.432 1.327 7.411 7.692
## .25 .50 .75 .90 .95
## 8.541 9.569 10.421 10.832 10.973
##
## lowest : 6.635 6.958 7.098 7.158 7.288, highest: 11.085 11.117 11.342 11.488 11.647
## --------------------------------------------------------------------------------
## Social.support
## n missing distinct Info Mean Gmd .05 .10
## 149 0 119 1 0.8147 0.1267 0.5826 0.6434
## .25 .50 .75 .90 .95
## 0.7500 0.8320 0.9050 0.9402 0.9476
##
## lowest : 0.463 0.489 0.490 0.537 0.540, highest: 0.947 0.948 0.952 0.954 0.983
## --------------------------------------------------------------------------------
## Healthy.life.expectancy
## n missing distinct Info Mean Gmd .05 .10
## 149 0 135 1 64.99 7.653 52.86 54.99
## .25 .50 .75 .90 .95
## 59.80 66.60 69.60 73.30 73.90
##
## lowest : 48.478 48.700 50.102 50.114 50.833, highest: 74.400 74.700 75.100 76.820 76.953
## --------------------------------------------------------------------------------
## Freedom.to.make.life.choices
## n missing distinct Info Mean Gmd .05 .10
## 149 0 126 1 0.7916 0.1268 0.5802 0.6292
## .25 .50 .75 .90 .95
## 0.7180 0.8040 0.8770 0.9254 0.9430
##
## lowest : 0.382 0.480 0.525 0.548 0.552, highest: 0.949 0.955 0.959 0.960 0.970
## --------------------------------------------------------------------------------
## Generosity
## n missing distinct Info Mean Gmd .05 .10
## 149 0 130 1 -0.01513 0.1645 -0.2146 -0.1820
## .25 .50 .75 .90 .95
## -0.1260 -0.0360 0.0790 0.1534 0.2666
##
## lowest : -0.288 -0.258 -0.246 -0.244 -0.238, highest: 0.311 0.422 0.424 0.509 0.542
## --------------------------------------------------------------------------------
Correlation plays a big part of the happiness:
1) Social support
2) Freedom to make life choices
3) Logged. GDP per capital
4) Regional Indicator
5) Generosity.
Since Regional Indicator is a categorical variable. I will focus on the other 4 variables which are numerical. Social.support, Freedom.to.make.life.choices,Logged.GDP.per.capita, Generosity
corrplot(cor(happiness %>%
select(Social.support, Freedom.to.make.life.choices,Logged.GDP.per.capita, Generosity)),
method="color",
sig.level = 0.01, insig = "blank",
addCoef.col = "black",
tl.srt=45,
type="upper")
ggplot(happiness, aes(x = Healthy.life.expectancy, y = Social.support)) +
geom_point() +
stat_smooth()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
ggplot(happiness, aes(x = Healthy.life.expectancy, y = Logged.GDP.per.capita)) +
geom_point() +
stat_smooth()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
ggplot(happiness, aes(x = Healthy.life.expectancy, y = Freedom.to.make.life.choices)) +
geom_point() +
stat_smooth()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
ggplot(happiness, aes(x = Healthy.life.expectancy, y = Generosity)) +
geom_point() +
stat_smooth()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
People’s definition of happiness are all different In the U.S. Declaration of Independence, the pursuit of happiness is protected as a fundamental human right, up there with life and liberty(1). How do one get to that point of happiness? A psychologist, Diener identifies five factors that contribute to happiness: social relationships, temperament/adaption, money, society and culture, and positive thinking style(1). Research question: Based on observation, and research. Do these Five factors: social relationships, adaption, money, society and culture, and positive thinking style provide an insight on better life expectancy when the population is happier? Going through exploratory data analysis provided by Sustainable Development Solutions Network(SDSN) in providing the best information for World Happiness Report.
The biggest factor would from highest to lowest contribution for
happiness:
1) Social relationships
2)money
3)Freedom to make a life choice
4)Generosity
This can all be mix with depending on where you live to help contribute
the most “happiness” you can experienced, and in this case was important
for 2021.
Based on the data gathered by UN, statistical analysis and inference test, all the factors are varied enough to measure happiness of a country. The analysis showed at least four of the factors: Social Relationships, economy, life expectancy, freedom, play a major role in attaining a higher level of happiness. The correlation between the rest, namely trust in government and generosity, does not really say much about a countries happiness. If anything government can weaken happiness due to their restrain on freedom of choice. For future research, one could collect independent data on other factors such as marriage/divorce, “lockdown” severity or other measures/survey to recall Covid lockdown.
# References
1) https://www.pursuit-of-happiness.org/history-of-happiness/ed-diener/
2) https://www.kaggle.com/datasets/ajaypalsinghlo/world-happiness-report-2021