LoslegenKostenlos loslegen

Predicting with interactions

As with every other regression model you've created, the fun part is making predictions. Fortunately, the code flow for this case is the same as the one without interactions—R can handle calculating the interactions without any extra prompting from you. The only thing you need to remember is the trick for getting combinations of explanatory variables.

mdl_price_vs_both_inter is available; dplyr 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.

# Make a grid of explanatory data
explanatory_data <- ___(
  # Set n_convenience to zero to ten
  ___,
  # Set house_age_years to the unique values of that variable
  ___
)

# See the result
explanatory_data
Code bearbeiten und ausführen