# [R] How to plot 3-D surface graph from lmer mixed models?

willow1980 jianghua.liu at shef.ac.uk
Thu Aug 13 12:05:42 CEST 2009

```Dear R users,
I have a problem in plotting 3 dimensional graph using mixed models.
My model is
sur_prop ~
afr_c+I(afr_c^2)+I(afr_c^3)+byear_c+I(byear_c^2)+I(byear_c^3)+I(byear_c^4)+(1|Studyparish)+afr_c:byear_c
+afr_c:I(byear_c^2)+afr_c:I(byear_c^3)+afr_c:I(byear_c^4)+I(afr_c^2):byear_c+I(afr_c^2):I(byear_c^2)+I(afr_c^2):I(byear_c^3)+I(afr_c^2):I(byear_c^4)
This is a study on the effect of mothers' age and cohort year on children's
survival.
I  can extract predicted value using a suggested method from website:
model at X%*%fixef(model). To my knowledge, this method is reasonable. It is a
bit alike matrix representation in multiple regression.
However, I cannot use such predicted values together with age and cohort
values to plot a 3-D surface plot. Since my dataset is very large, it is
certainly useless to plot 3-D points scatter plot, which is very difficult
to discern the pattern. By the way, I have tried "plot3d", "scatterplot" and
"regr2.plot" to give scatter plot.
So, do you have any suggestion on how to plot a surface plot given above
information? For example, how to use "persp" or "wireframe" in case of lmer
with more than two explanatory variables?
Thank you very much for helping!
Best wishes!
--
View this message in context: http://www.nabble.com/How-to-plot-3-D-surface-graph-from-lmer-mixed-models--tp24952273p24952273.html
Sent from the R help mailing list archive at Nabble.com.

```