library(lme4)
m1 <- lmer(resp ~ pred1 + pred2 + pred3 + (1|site), data = Xs)
mod.predictions1 <- predict(m1, re.form = NA)
plot(pred1, mod.predictions1) # plot 1
Xs$pred2 <- mean(Xs$pred2)
Xs$pred3 <- mean(Xs$pred3)
mod.predictions2 <- predict(m1, newdata = Xs, re.form = NA)
plot(pred1, mod.predictions2) # plot 2
Between plot1
and plot2
, what is the difference? If I want to show
how does my resp
change with pred1
, should I show plot1
or plot2
?
Best Answer
If you want to show how your outcome
resp
is related topred1
, you should go for the second approach, because in the first one the predictions you obtained are affected by changing values ofpred2
andpred3
.In general, you can something like this