CommencerCommencer gratuitement

Including an interaction

Just as in the case with one numeric and one categorical explanatory variable, it is possible that numeric explanatory variables can interact. With this model structure, you'll get a third slope coefficient: one for each explanatory variable and one for the interaction.

Here you'll run and predict the same model as in the previous exercise, but this time including an interaction between the explanatory variables.

taiwan_real_estate is available; dplyr, tidyr and ggplot2 are 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.

# Fit a linear regression of price vs. no. of conv. stores and sqrt dist. to nearest MRT, with interaction
mdl_price_vs_conv_dist <- ___



# See the result
mdl_price_vs_conv_dist
Modifier et exécuter le code