Make sure to include the unit of the values whenever appropriate.
Hint: The variables are available in the gapminder data set from the gapminder package. Note that the data set and package both have the same name, gapminder.
library(tidyverse)
options(scipen=999)
data(gapminder, package="gapminder")
Life_lm <- lm(lifeExp ~ gdpPercap,
data = gapminder)
Hint: Your answer must include a discussion on the p-value.
Yes it is statistically significant at 5% because the p-value is .0000000000000002 which is definitely lower than 5%.
Hint: Discuss both its sign and magnitude.
There is definitely an increase of .00075 years per an increase of 1 of gdpPerCAP.
Hint: Provide a technical interpretation.
library(tidyverse)
options(scipen=999)
data(gapminder, package="gapminder")
Life_lm <- lm(lifeExp ~ gdpPercap + year,
data = gapminder)
Hint: This is a model with two explanatory variables. Insert another code chunk below.
library(tidyverse)
options(scipen=999)
data(gapminder, package="gapminder")
Life_lm <- lm(lifeExp ~ gdpPercap + year,
data = gapminder)
Hint: Discuss in terms of both residual standard error and reported adjusted R squared.
The residual standard error is better in the second one which means it misses by an average of 9.7 years compared to the 10.5 years on the first graph. The adjusted R square is better in the second one as well because the second graph explains 44 percent of the life expectance compared to only 34%
Hint: Discuss both its sign and magnitude.
The life expectancy is .24 years when there are zero years which is not possible.
Hint: We had this discussion in class while watching the video at DataCamp, Correlation and Regression in R. The video is titled as “Interpretation of Regression” in Chapter 4: Interpreting Regression Models.
The life expectancy is .24 years when there are zero years which is not possible.
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.