willow1980 wrote:
Dear Professor Murdoch,
That is exactly the difficulty for me. I don't know how to make a prediction
with lmer using "expand.grid"; at the moment, I can use
“mo...@x%*%fixef(model)” to get predicted values for existing observational
data, but not data by "expand.grid". Actually, if I know this, I can then
use "persp" or "wireframe" to plot 3-D surface graph. Do you know or have
available code for this aim?

No, I've never used lmer.
Duncan Murdoch
Sorry, this request must sound very lazy or stupid.
Thank you very much for helping!
Best regards,



Duncan Murdoch-2 wrote:
I only see two explanatory variables: afr_c, byear_c. If you have more than two, you can't use a surface plot: surfaces are two dimensional.

All of the 3D surface functions want basically the same thing: a matrix giving evaluations of a function at locations of the explanatory variables. So you need to calculate that. I'd do it by using expand.grid to create a large set of combinations of values of the explanatory variables, ask your model to do predictions at all of those locations, and then reshape the result into a matrix.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to