[R] Plotting the result of a gamm in lattice

el_alisio malnamalja at gmx.de
Sat Mar 29 21:18:32 CET 2014


Hi Stefano,

first of all, it would be really helpful, if you provided a reproducible
example. That way we could better help you!! Second of all, please have a
look at ?gamm before posting a question:

Returns a list with two items:

gam	
an object of class gam, less information relating to GCV/UBRE model
selection. At present this contains enough information to use predict,
summary and print methods and vis.gam, but not to use e.g. the anova method
function to compare models.

lme	
the fitted model object returned by lme or gammPQL. Note that the model
formulae and grouping structures may appear to be rather bizarre, because of
the manner in which the GAMM is split up and the calls to lme and gammPQL
are constructed.

So, what you might want to try, is:

P1 <- predict(M1$gam,
                   newdata = MD,
                   se = TRUE,
                   type = "link") 

However, I am not an expert in using GAMMs, so be careful with what you are
doing and do have a look at the residuals. You might also want to think
about including your random effect as a categorial variable in a "simple"
GAM, this way you could avoid the random effect structure (depends a bit on
the degrees of freedoms the categorial variable might consume and how many
observations you have). Anyhow, be careful and remember (cited again from
?gamm):

gamm assumes that you know what you are doing!

Cheers, 

Jannes




--
View this message in context: http://r.789695.n4.nabble.com/Plotting-the-result-of-a-gamm-in-lattice-tp4687568p4687823.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list