Aan de slagGa gratis aan de slag

Interactions with understandable coeffs

The previous model with the interaction term returned coefficients that were a little tricky to interpret. In order clarify what the model is predicting, you can reformulate the model in a way that returns understandable coefficients. For further clarity, you can compare the results to the models on the separate house age categories (mdl_0_to_15, mdl_15_to_30, and mdl_30_to_45).

taiwan_real_estate, mdl_0_to_15, mdl_15_to_30, and mdl_30_to_45 are available.

Deze oefening maakt deel uit van de cursus

Intermediate Regression with statsmodels in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Model price vs. house age plus an interaction, no intercept
mdl_readable_inter = ____

# Print the coefficients for mdl_0_to_15
print("mdl_0_to_15 coefficients:", "\n", ____)

# Print the coefficients for mdl_15_to_30
print("mdl_15_to_30 coefficients:", "\n", ____)

# Print the coefficients for mdl_30_to_45
print("mdl_30_to_45 coefficients:", "\n", ____)

# Print the coefficients for mdl_readable_inter
print("\n", "mdl_readable_inter coefficients:", "\n", mdl_readable_inter.params)
Code bewerken en uitvoeren