[R-sig-ME] compare two GAMM4 models using AICs

Highland Statistics Ltd highstat at highstat.com
Tue Oct 24 23:00:15 CEST 2017



>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 24 Oct 2017 19:49:50 +0000
>> From: dani <orchidn at live.com>
>> To: "r-sig-mixed-models at r-project.org"
>>     <r-sig-mixed-models at r-project.org>
>> Subject: [R-sig-ME] compare two GAMM4 models using AICs
>> Message-ID:
>>     <MWHPR1201MB0029CE3D9C5EC1956640DB70D6470 at MWHPR1201MB0029.namprd12.prod.outlook.com> 
>>
>>
>> Content-Type: text/plain; charset="UTF-8"
>>
>> Hello everyone,
>>
>>
>> I am fitting two gamm4 models because I would like to see whether 
>> there is justification for including a spline term for x1. Can this 
>> be done by comparing the AICs for the underlying mixed models (i.e., 
>> the "mer" part) of the two models?
>
>

Technically it won't crash..."so it can be done"..but I am not sure 
whether you want to do this. Internally, the smoother is written as a 
mixed model (X * b + Z * u)....and those random effects (which is part 
of the smoother) don't count towards the number of parameters.

>> b1 <- gamm4(y~x1+offset(e),data=dat,random=~(1|fac))
>
>> b2 <- gamm4(y~x1+s(x1)+offset(e),data=dat,random=~(1|fac))
>
>
>


I am confused about your use of an offset in a Gaussian model, and I am 
confused why you would use x1 and s(x1) in the same model. The s(x1) 
already contains the linear part of the smoother.

Why not fit the first model and inspect residuals for any patterns? If 
there are, then using a smoother is an option.

Kind regards,

Alain Zuur


>
>>
>> summary(b1$gam)
>>
>> summary(b1$mer)
>>
>>
>> summary(b2$gam)
>>
>> summary(b2$mer)
>>
>>
>> AIC(b1$mer)
>>
>> AIC(b2$mer)
>>
>>
>> Thank you very much!
>>
>> Best,
>>
>> DaniNM
>>
>> <http://aka.ms/weboutlook>
>>
>>     [[alternative HTML version deleted]]
>>
>>
>

-- 

Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: highstat at highstat.com
URL:   www.highstat.com

And:
NIOZ Royal Netherlands Institute for Sea Research,
Department of Coastal Systems, and Utrecht University,
P.O. Box 59, 1790 AB Den Burg,
Texel, The Netherlands



Author of:
1. Beginner's Guide to Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA. (2017).
2. Beginner's Guide to Zero-Inflated Models with R (2016).
3. Beginner's Guide to Data Exploration and Visualisation with R (2015).
4. Beginner's Guide to GAMM with R (2014).
5. Beginner's Guide to GLM and GLMM with R (2013).
6. Beginner's Guide to GAM with R (2012).
7. Zero Inflated Models and GLMM with R (2012).
8. A Beginner's Guide to R (2009).
9. Mixed effects models and extensions in ecology with R (2009).
10. Analysing Ecological Data (2007).



More information about the R-sig-mixed-models mailing list