[R] multiple comparisons for GAMs

peter dalgaard pdalgd at gmail.com
Fri Aug 3 10:39:33 CEST 2012


On Aug 2, 2012, at 21:09 , Bird_Girl wrote:

> Hi,
> 
> I have a question regarding whether it is possible to do post hoc tests on a
> model fit with GAM {mgcv}.  My response variable is abundance (no.
> individuals per plot), and I have one continuous predictor (light) and one
> factor (height) which includes 7 levels. 
> 
>> mod2=gam(log_abundance~s(light)+height+te(light,by=height)+s(long)+s(lat))
> 
> The relationship between log_abundance and light at the seven levels of
> height all differ significantly from the overall relationship between
> log_abundance and light, and relationships at most of the 7 levels are not
> linear.  I would like to do some kind of multiple comparison or post hoc
> test to determine whether the relationship between log_abundance and light
> differs significantly among the different levels of height (i.e., is the
> relationship at 200 m different from that at 400 m)? Is there any way to do
> this?
> 
> Thanks in advance, and I apologize if this is a stupid question – I am new
> to R.

Nothing stupid about it, but maybe difficult to give a complete answer to in email (a simplified, reproducible example would help so that readers can try out suggestions). 

I would expect that library(multcomp) is your friend. It should work since gam objects have coef() and vcov() methods. Look into glht() and mcp(height="Tukey"). 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list