Make sure to include the unit of the values whenever appropriate.

Q1 Build a regression model to predict life expectancy using gdp per capita.

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)
library(scales)
options(scipen = 999)

Q2 Is the coefficient of gdpPercap statistically significant at 5%?

Hint: Your answer must include a discussion on the p-value. Yes, the coefficient of education is statistically significant because it is less than 5%. ## Q3 Interpret the coefficient of gdpPercap. Hint: Discuss both its sign and magnitude. Every year spent on education the hourly wage will increase $0.94. ## Q4 Interpret the Intercept. Hint: Provide a technical interpretation. The wages for sexM, which is males, is statistically significant because the coefficient is less than 5%. It shows that males are making $2.33 more an hour. ## Q5 Build another model that predicts life expectancy using gdpPercap, but also controls for another important variable, year. Hint: This is a model with two explanatory variables. Insert another code chunk below. The hourly wage for a woman with 15 years and 5 years of experience would be $8.16. You add the intercept (-6.5) and then multiply education (0.94) by 15 and then experience (0.11) by 5 and add those together. ## Q6 Which of the two models is better? Hint: Discuss in terms of both residual standard error and reported adjusted R squared. The intercept at 0 would be statistically impossible. People would be making negative money. ## Q7 Interpret the coefficient of year. Hint: Discuss both its sign and magnitude. The adjusted R squared went from 2.489 to 2.592 after adding union as another predictor. This means that whether or not the person is a union member is has very little statistical significance to the model. Adding the union predictor didn’t impact the residual standard error very much, it only went down a little bit meaning it didn’t help with how much data they had. ## Q7.a Based on the second model, what is the predicted life expectancy for a country with gdpPercap of $40,000 a year in 1997. 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.

Q8 Hide the messages, but display the code and its results on the webpage.

Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.