2024-06-06

colnames(happiness_data)

Introduction

  • The World Happiness Report is a survey of the state of global happiness. It currently ranks 155 countries by their happiness levels.
  • The hypothesis being tested in whether a country’s GDP per capita can influence its happiness score.

What is Hypothesis Testing

  • Hypothesis testing is a method that uses testing to see if the data can prove a particular hypothesis.
  • Null Hypothesis: There is no correlation between a country’s GDP per capita and its happiness score
    • If a country has a high GDP, they won’t have a high happiness score
  • Alternative Hypothesis: There is a correlation between a country’s GDP per capita and its happiness score
    • If a country has a high GDP, they will have a high happiness score

Visualization

## `geom_smooth()` using formula = 'y ~ x'

Visualization Part 2

Visualization Part 3

Latex

  • Correlation coefficient formula: \(t = \frac{\bar{x} - \mu}{\frac{\sigma}{\sqrt{n}}}\)

Slide With R Code

library(ggplot2)
ggplot(happiness_data, aes(x = Economy..GDP.per.Capita., 
                           y = Happiness.Score)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(x = "GDP per Capita", 
       y = "Happiness Score", 
       title = "Relationship between GDP 
       per Capita and Happiness Score")
## `geom_smooth()` using formula = 'y ~ x'

Results and Conclusions

  • Based on the three plots in the slides and the correlation coefficient (0.78), we can say that both of these indicate a strong positive linear relationship between GDP and happiness scores. Therefore, we can say that having a high GDP per capita leads to higher happiness scores within a country.