LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Intermediate Regression in R

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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
Code bearbeiten und ausführen