Description of the data, data_quiz5
countrycontinentlifeExp life expectancy in yearpop total populationgdpPercap GDP per capita in U.S. dollarHint: The data is posted in Moodle. Look for data_quiz5.csv under the Data Files section.
Hint: Use head() to display the first six rows
## country continent lifeExp pop gdpPercap
## 1 Albania Europe 76.423 3600523 5937.030
## 2 Algeria Africa 72.301 33333216 6223.367
## 3 Argentina Americas 75.320 40301927 12779.380
## 4 Australia Oceania 81.235 20434176 34435.367
## 5 Austria Europe 79.829 8199783 36126.493
## 6 Bahrain Asia 75.635 708573 29796.048
Hint: Create a scatter plot to examine the relationship between GDP per capita (mapped to y-axis) and life expectancy (mapped to x-axis).
##
## Call:
## lm(formula = lifeExp ~ +gdpPercap, data = myQuizData)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.718 -1.451 -0.026 1.547 4.731
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 71.93701497 0.37902480 189.79 <0.0000000000000002 ***
## gdpPercap 0.00021917 0.00001693 12.94 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.023 on 81 degrees of freedom
## Multiple R-squared: 0.6741, Adjusted R-squared: 0.6701
## F-statistic: 167.5 on 1 and 81 DF, p-value: < 0.00000000000000022
the coefficient has to be yes because even if it was at 1% the life expectancy statistically would be signifcant
Hint: Discuss both its sign and magnitude.
the sign is positive and the magnitude of 0.2-16 is significant because they are the pr value.
Hint: Make your argument using the relevant test results, such as p-value.
##
## Call:
## lm(formula = lifeExp ~ +gdpPercap + pop, data = myQuizData)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.7248 -1.4147 0.0797 1.5230 4.6904
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 71.9896863261102 0.3941173539354 182.661 <0.0000000000000002
## gdpPercap 0.0002182577364 0.0000171015303 12.762 <0.0000000000000002
## pop -0.0000000007794 0.0000000015061 -0.518 0.606
##
## (Intercept) ***
## gdpPercap ***
## pop
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.032 on 80 degrees of freedom
## Multiple R-squared: 0.6752, Adjusted R-squared: 0.6671
## F-statistic: 83.15 on 2 and 80 DF, p-value: < 0.00000000000000022