Using R Solve: Country GDP LifeSatisfaction Brazil 8669.998 7 Mexico 9009.28 6.7
ID: 3875516 • Letter: U
Question
Using R Solve:
Country GDP LifeSatisfaction Brazil 8669.998 7 Mexico 9009.28 6.7 Russia 9054.914 6 Turkey 9437.372 5.6 Hungary 12239.89 4.9 Poland 12495.33 5.8 Chile 13340.91 6.7 Slovak Republic 15991.74 6.1 Czech Republic 17256.92 6.5 Estonia 17288.08 5.6 Greece 18064.29 4.8 Portugal 19121.59 5.1 Slovenia 20732.48 5.7 Spain 25864.72 6.5 Korea 27195.2 5.8 Italy 29866.58 6 Japan 32485.55 5.9 Israel 35343.34 7.4 New Zealand 37044.89 7.3 France 37675.01 6.5 Belgium 40106.63 6.9 Germany 40996.51 7 Finland 41973.99 7.4 Canada 43331.96 7.3 Netherlands 43603.12 7.3 Austria 43724.03 6.9 United Kingdom 43770.69 6.8 Sweden 49866.27 7.2 Iceland 50854.58 7.5 Australia 50961.87 7.3 Ireland 51350.74 7 Denmark 52114.17 7.5 United States 55805.2 7.2 Norway 74822.11 7.4 Switzerland 80675.31 7.5 Luxembourg 101994.1 6.9 Does money make people hapier? In order to explore this question, you might download the Better Life Index data from the OECD's website as well as stats about the Gross Demestic Product (GDP) per capita from the IMF's website. Then you join the tables and sort by GDP per capita. Luckily, you can just download this table from Canvas Geron2017_DS_LifeSatisfaction.csv and load it directly into R with the following command: GDP.df = read.csv (file.choose (), header = TRUE) The file Geron2017_DS_LifeSatisfaction.csv contains the following variables: Country Name of the respective country GDP Gross Domestic Product (GDP) per capita LifeSatisfaction Life Satisfaction IndexExplanation / Answer
Table:
country <- c("Brazil","Mexico","Russia","Turkey","Hungary","Poland","chile","Slovak Republic","Czech Republic","Estonia","Greece","Portugal","Slovenia","Spain","Korea","Italy","Japan","Isarel","New Zealand","France","Belgium","Germany","Finland","Canada","Netherlands","Austria","United Kingdom","Iceland","Australia","Ireland","Denmark","United States","Norway","Switzerland","Luxemberg")
GDP <- c(8669.998,9009.28,9054.914,9437.372,12239.89,12495.33,13340.91,15991.74,17256.92,17288.08,18064.29,19121.59,20732.48,25864.72,27195.2,29866.58,32485.55,35343.34,37044.89,37675.01,40106.63,40996.51,41973.99,43331.96,43603.12,43724.03,43770.69,49866.27,50854.58,50961.87,51350.74,52114.17,55805.2,74822.11,80675.31,101994.1
)
class = "data.frame"
LifeSatisfaction <- c(7,6.7,6,5.6,4.9,5.8,6.7,6.1,6.5,5.6,4.8,5.1,5.7,6.5,5.8,6,5.9,7.4,7.3,6.5,6.9,7,7.4,7.3,7.3,6.9,6.8,7.2,7.5,7.3,7,7.5,7.2,7.4,7.5,6.9)
linear.model <- lm(GDP ~ LifeSatisfaction)
summary(linear.model)
plot(GDP,LifeSatisfaction, pch=16, ylab="LifeSatisfaction", cex.lab=1.3, col="red")
abline(lm(GDP~LifeSatisfaction), col = "blue")
GDP2 <- GDP^2
quadratic.model <- lm( LifeSatisfaction ~ GDP + GDP2)
summary(quadratic.model)
GDPvalues <- seq(0, 10, 1)
predictedcounts <- predict(quadratic.model,list(GDP=GDPvalues, GDP2=GDPvalues^2))
lines(GDPvalues, predictedcounts, col = "darkgreen", lwd = 3)
plot(GDP, LifeSatisfaction,pch=16, xlab="LifeSatisfaction", ylab="GDP", cex.lab=1.3, col="blue")
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.