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")
houses_lm <- lm(lifeExp ~ gdpPercap,
data = gapminder)
Hint: Your answer must include a discussion on the p-value.
The coefficient is significant because it is less than 5%.
Hint: Discuss both its sign and magnitude.
GDP was up 49/every capita which means its a positive sign with a magnitude that is higher than the prediction.
Hint: Provide a technical interpretation.
The intercept shows that the life expectance is lower than average.
Hint: This is a model with two explanatory variables. Insert another code chunk below.
library(tidyverse)
options(scipen=999)
data(gapminder, package="gapminder")
houses_lm <- lm(lifeExp ~gdpPercap + year,
data = gapminder)
Hint: Discuss in terms of both residual standard error and reported adjusted R squared.
The second model is better because the standard error is lower while the adjusted R squared is higher than the first model.
Hint: Discuss both its sign and magnitude.
The coefficient of year is 17 years making the sign is positive.
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 predicted life expectancy for this specific example is about 76 years.
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.