LoslegenKostenlos loslegen

Predicting with a parallel slopes model

While ggplot can automatically show you model predictions, in order to get those values to program with, you'll need to do the calculations yourself.

Just as with the case of a single explanatory variable, the workflow has two steps: create a data frame of explanatory variables, then add a column of predictions. To make sure you've got the right answer, you can add your predictions to the ggplot with the geom_parallel_slopes() lines.

taiwan_real_estate and mdl_price_vs_both are 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.

# 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