Hi Keith,
The basic strategy for this type of problem is as follows.
# 1. Create a grid of the response values you're interested in
grid <- expand.grid(
# you do one variable with a finer resolution than the others
# because this can go on the x axis
x1 = seq(min(df$x1), max(df$x1), length = 20),
# use quartiles for low, medium and high, or pick them yourself
x2 = quantile(df$x2, c(0.25, 0.5, 0.75),
x3 = quantile(df$x3, c(0.25, 0.5, 0.75)
)
# 2. Compute predicted values
grid$y <- predict(mymodel, grid)
# 3. Plot
qplot(x1, y, data = grid, geom = "line") + facet_grid(x2 ~ x3)
qplot(x1, y, data = grid, geom = "line", colour = x2) + facet_grid(~ x3)
# You'll need to play around with where each of the three variables go
# to get the best view for your data/model.
# You should probably also repeat the same plots with the raw data
# just to check that you're not missing anything in the model.
Hadley
--
http://had.co.nz/