Learn

Let’s practice our model interpretation skills! We know that for continuous independent variables, like podcasts, the regression coefficient represents the difference in the predicted value of sales for each one-dollar increase in podcasts. Given the output of calling summary(model) below, we can correctly say that for every one dollar increase in podcast advertisement spending, total sales of the related project increases by 1.742 dollars.

summary(model) #output Call: lm(formula = sales ~ radio, data = train) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9.57927 0.91176 10.506 < 2e-16 *** podcast 1.74240 0.03255 5.353 3.71e-07 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

We could also extract the value of the podcast coefficient, the second coefficient returned by our model, using list indexing as follows:

podcast_coefficent <- model$coefficients[2]

It is important to note that the interpretation of the intercept coefficient is slightly different from that of variable coefficients. The intercept coefficient represents the value we would predict for our outcome variable, sales, given that podcast spending is equal to zero. It is crucial to remember that the intercept coefficient is only interpretable if we can reasonably expect a zero value for all independent variables in a model. Assuming, just as our simple linear model does, that spending on podcasts is the only variable that explains changes in sales, it does not make sense for any sales to occur without podcast spending. Therefore, for this model, our intercept coefficient is not interpretable.

However, in many cases, intercept coefficients are interpretable! As you’ve seen throughout this lesson, the analysis of any model results requires a thorough understanding of our data, the system that produces this data, and a critical approach to interpretation of coefficient values.

Instructions

1.

The code used to build two simple linear models, model, a regression of clicks on total_convert, and model2, a regression of impressions on total_convert, is already included in your notebook. Use summary() to print out the results of model and model2.

2.

Save the results of calling model$coefficients[2] to a variable called clicks_coefficient; uncomment the following f-string to print out an example of how this estimate would be described in a written analysis.

3.

How might we interpret the coefficient estimate for our model intercept? Set the variable intercept_coefficient equal to the lowercase letter (ex. "a") associated with the statement that correctly interprets the estimate value:

A. The intercept coefficient is not significantly different from zero, therefore the model suggests that when clicks equal zero, the number of total_converts is likely to be around zero. This is reasonable because if a user has not clicked on an ad, we do not expect them to purchase the related product.

B. The intercept coefficient is negative and significant; this means that when clicks equal zero, we expect the number of total_converts to be less than zero. This makes sense because the user did not click on an ad, so we expect zero or less products to be purchased.

C. The intercept coefficient is greater than zero, so when clicks equals zero we expect total_converts to be somewhen between 0.90 and 1.25. Even though a user does not click on an ad, they have been exposed to the product brand and might purchase the product by later searching for it through a search engine.

D. The The intercept coefficient is close to zero; this means that when when clicks equal zero, the number of total_converts is likely to be around zero. This is reasonable because if a user has not clicked on an ad, we do not expect them to purchase the related product.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?