Exercise

# Manually calculating predictions with interactions

In order to understand how `predict()`

works, it's time to calculate the predictions manually again. For this model, there are three separate lines to calculate for, and in each one, the prediction is an intercept plus a slope times the numeric explanatory value. The tricky part is getting the right intercept and the right slope for each case.

`mdl_price_vs_both_inter`

and `explanatory_data`

are available; `dplyr`

and `tidyr`

are available.

Instructions 1/2

**undefined XP**

- Get the coefficients from
`mdl_price_vs_both_inter`

, assigning to`coeffs`

. - Get the three intercept coefficients from
`coeffs`

, assigning to`intercept_0_15`

,`intercept_15_30`

, and`intercept_30_45`

. - Get the three slope coefficients from
`coeffs`

, assigning to`slope_0_15`

,`slope_15_30`

, and`slope_30_45`

.