Get startedGet started for free

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.

This exercise is part of the course

Intermediate Regression in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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
Edit and Run Code