#Import the data
HPI.2019 <- read.csv("HPI.2019.csv", header = T)

#Source the source code
source("fall_2022_lab_2_source_code.R")

#Attach the data
attach(HPI.2019)
cor(wellbeing,gini.CIA)
## [1] -0.4463246
plot(wellbeing,gini.CIA)
abline(59.384,-3.629, col="red")

cor(wellbeing,gini.CIA)^2
## [1] 0.1992057

The equation of the linear model is gini.CIA=59.384+-3.629*wellbeing r^2 is close to zero indicating a weak correlation.


cor(footprint,GDP.per.capita)
## [1] 0.8328638
plot(footprint,GDP.per.capita)
abline(-1992,7242, col="red")

cor(footprint,GDP.per.capita)^2
## [1] 0.6936621

The equation of the linear model is GDP.per.capita=-1992+7242*footprint This model has a moderate to strong correlation.


-1992+(7242*8.21)
## [1] 57464.82
-1992+(7242*4.41)
## [1] 29945.22

America has a positive residual of 5065.18. France has a positive residual 16167.78.

France has a wider array of data.

western.europe <- subset(HPI.2019, continent=="3")
cor(western.europe$footprint,western.europe$GDP.per.capita)
## [1] 0.7323255
plot(western.europe$footprint,western.europe$GDP.per.capita)
 lm(western.europe$GDP.per.capita~western.europe$footprint)
## 
## Call:
## lm(formula = western.europe$GDP.per.capita ~ western.europe$footprint)
## 
## Coefficients:
##              (Intercept)  western.europe$footprint  
##                    15454                      7102
 abline(15454,7102,col="red")

The correlation is stronger in western Europe than the rest of the world. —

Exercise 5: Look Back / Look Ahead

In our research we have found that the well being in France has a very weak correlation despite being in western Europe. Meaning that the data is very spread out, while other countries in this region tend to have stronger correlations. This also plays a big role to the overall residuals of western Europe. It would be interesting to see if there are any more ways that we can record and interpret happiness or maybe even data leading to it. The study of well being seems like an interesting one that we could explore more through statistics.