Manually calculating predictions
As with simple linear regression, you can manually calculate the predictions from the model coefficients. The only change for the parallel slopes case is that the intercept is different for each category of the categorical explanatory variable. That means you need to consider the case when each each category occurs separately.
taiwan_real_estate
, mdl_price_vs_both
, and explanatory_data
are available; dplyr
is loaded.
This exercise is part of the course
Intermediate Regression in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Get the coefficients from mdl_price_vs_both
coeffs <- ___
# Extract the slope coefficient
slope <- ___
# Extract the intercept coefficient for 0 to 15
intercept_0_15 <- ___
# Extract the intercept coefficient for 15 to 30
intercept_15_30 <- ___
# Extract the intercept coefficient for 30 to 45
intercept_30_45 <- ___