mod_full <- lm(Price ~ Food + Service + East, data = nyc)
planes <- nyc |>
data_grid(
Food = seq_range(Food, n = 25),
Service = seq_range(Service, n = 25),
East = seq_range(East, n = 2)
)
planes <- planes |>
mutate(Price_hat = predict(mod_full, newdata = planes))
pplanes <- data_space_fs |>
add_surface(
data = filter(planes, East == 0),
x = ~unique(Food), y = ~unique(Service),
z = ~matrix(Price_hat, nrow = 25),
opacity = 0.7
) |>
add_surface(
data = filter(planes, East == 1),
x = ~unique(Food), y = ~unique(Service),
z = ~matrix(Price_hat, nrow = 25),
opacity = 0.7
)