CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Intermediate Regression in R

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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 <- ___
Modifier et exécuter le code