Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Intermediate Regression in R

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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 <- ___
Code bewerken en uitvoeren