[R] Gamm and post comparison
Gavin Simpson
gavin.simpson at ucl.ac.uk
Wed Feb 29 17:42:46 CET 2012
On Wed, 2012-02-22 at 10:55 -0800, RHam wrote:
> My data set consist of number of calls (lcin) across Day. I am looking for
> activity differences between three features (4 sites per feature). I am also
> looking for peaks of activity across time (Day). I am using a gamm since I
> believe these are nonlinear trends with nested data.
You don't need gamm() for this as you don't appear to be using any
random effects. gam() will be fine for the model you show below.
I don't know enough about the workings of mgcv to know whether you can
leverage functions in the multcomp package; gam objects inherit from glm
and lm classes and multcomp can work with these, though do not the point
in ?gamObject that gam objects lack the details of the fitting expected
in glm or lm objects.
IIRC, that model could be fitted as a linear mixed model if the smooth
term is set up correctly. multcomp can work with nlme and lme4 so you
could continue to use gamm() as below but use the multcomp package on
the $lme component. The gamm4 package provides a version of gamm() that
uses lme4 instead of nlme for the underlying fitting. Again you might
look into using the lmer representation of the model with multcomp.
None of the above is tested or even based on personal experience of
doing this.
G
> gammdata<-gamm(lcin~Temp+s(Day)+fType+wind+fFeature+Forest+Water+Built,
> list=fSite,data=data, family=gaussian)
>
> summary(gammdata$gam)
> summary(gammdata$lme)
> anova(gammdata$gam)
>
> I can see which variables are significant but I was wondering if there was a
> way to do a post hoc to see differences between features? Or is there a way
> to compare different models (feature) for significance (not best fit)
> against each other?
>
> Thanks,
> Rham
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Gamm-and-post-comparison-tp4411366p4411366.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list