[R] Predicting complicated GAMMs on response scale

William Paterson wdp1 at st-andrews.ac.uk
Mon May 18 20:48:44 CEST 2009


I am using GAMMs to show a relationship of temperature differential over
time with a model that looks like this:-


where DaysPT is time in days since injury and Diff is repeat measures of
temperature differentials with regards to injury sites compared to
non-injured sites in individuals over the course of 0-24 days. I use the
following code to plot this model on the response scale with 95% CIs which
works fine:-

plot(p.d$DaysPT,b$fit,ylim=c(-4,12),xlab="Days post-tagging",ylab="dTmax
(ºC)",type="l",lab=c(24,4,12),las=1,cex.lab=1.5, cex.axis=1,lwd=2)

However, when I add a correlation structure and/or a variance structure so
that the model may look like:- 


I get this message at the point of inputting the line

Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  : 
        variable lengths differ (found for 'DaysPT')
In addition: Warning messages:
1: not all required variables have been supplied in  newdata!
 in: predict.gam(g.m$gam, p.d, se = TRUE) 
2: 'newdata' had 25 rows but variable(s) found have 248 rows 

Is it possible to predict a more complicated model like this on the response
scale? How can I incorporate a correlation structure and variance structure
in a dataframe when using the predict function for GAMMs?

Any help would be greatly appreciated.

William Paterson

View this message in context: http://www.nabble.com/Predicting-complicated-GAMMs-on-response-scale-tp23603248p23603248.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list