We often write the equation of a line in the form *y=mx+b*, where *m* is the slope of the line and *b* is the *y*-intercept. Since we will be adding at least two predictors to a multiple regression equation, it is helpful to modify our ordering and notation of this equation:

- First, we may rewrite this equation by putting the intercept term first and the slope term second. $y=b+mx$
- Next, instead of using the names
*b*and*m*, we use the names*b*and_{0}*b*, respectively._{1}

Notice that we’ve also changed our variable name$y=b_0+b_1x_1$*x*to*x*because it is our FIRST predictor._{1} - We are now able to add as many predictors as we need in the form

where$y = b_0 + b_1x_1 + b_2x_2 + ... + b_ix_i$*y*is the response variable,*b*is the intercept, and_{0}*b*is the coefficient on the_{i}*i*th predictor variable. - The “slopes” (
*b*,_{1}*b*,_{2}*b*, etc.) on the variables in multiple regression are called_{3}*partial regression coefficients*.

While this is the proper mathematical way to write a multiple regression equation, it is often easier to write out the equation using actual variable names. For example, if we are modeling test scores (`score`

) based on number of hours studied (`hours_studied`

) and another variable that indicates whether a student ate breakfast (`breakfast`

), our multiple regression equation might look like this:

`$\text{score} = b_0 + b_1 * \text{hours\_studied} + b_2 * \text{breakfast}$`

Of course, after fitting our model, the intercept (*b _{0}*) and coefficients (

*b*and

_{1}*b*) could be filled in with actual numbers from the output of our regression. For instance, our final equation might have an intercept of 32.7, a coefficient of 8.5 on

_{2}`hours_studied`

, and a coefficient of 22.5 on `breakfast`

: `$\text{score} = 32.7 + 8.5*\text{hours\_studied} + 22.5*\text{breakfast}$`

### Instructions

**1.**

Inspect the multiple regression equation:

`$\text{rating} = 2.5 + 1.4*\text{budget} - 0.3*\text{independent}$`

In **script.py**, save the value of the intercept as a variable named `b0`

, and the values of the coefficients for `budget`

and `independent`

as variables named `b1`

and `b2`

, respectively.

How are the associations of `budget`

with `rating`

and `independent`

with `rating`

different from each other?

# Take this course for free

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