MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Intermediate Regression in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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 dan Jalankan Kode