[R-sig-ME] Confidence intervals in GAMM4

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Jun 5 19:36:11 CEST 2013


On Thu, 2013-05-30 at 12:12 -0300, Rodrigo Tardin wrote:
> Hi all,
> 
<snip />
> 
> I searched in R for confidence intervals in GAMM4 but I did not find it. I
> could obtain variance and std deviation for the random and fixed effects
> Groups Name             Variance            Std.Dev.
>  RANDOM (Intercept)  1.4973e+01        3.8694319
>  Xr.0   s(DISTCOAST)  4.7361e-02        0.2176263
>  Xr     s(DEPTH)          1.9779e-06        0.0014064
> 
> 
> Here it is my model.
> n3 <- gamm4(OCC_BIN~s(DEPTH)+s(DISTANCE_TO_COAST)+offset(RT),random = ~
> (1|RANDOM),correlation=corAR1(),method="ML", family=binomial,data=bryde3)

Unfortunately, this is *totally* wrong. There is no `correlation`
argument in `gamm4()` nor `glmer()`, which is the underlying fitting
function. That this didn't raise an error is due to `gamm4()` etc having
argument `...` which silently mops up any left over, non-used arguments.

`gamm()` in package *mgcv* does have a `correlation` argument but that
will fit your binomial GLMM via PQL which isn't such a good solution for
such models.

In nlme:::lme there was a function intervals() which could provide the
CI on the REs - see if there is an equivalent for lme4:::glmer. IIRC
Doug has something on this in his in-prep book on mixed effects models
via lme4, see chapter 1 in
http://lme4.r-forge.r-project.org/lMMwR/lrgprt.pdf

That presumes that you sort out the AR(1) business; you can't do that in
glmer().

Options are to move back to mgcv::gamm() but as I said, PQL isn't great
of binomial models. If your REs are simple, then mgcv::gam() can be
used. Again this doesn't have a correlation argument but ?magic (after
loading mgcv) has an example of including the correlation in the fit via
some jiggery-pokery. Alternatively and related to gam() is mgcv::bam()
which can take a known AR(1) parameter into account during the fitting.
This fits the AR(1) given the ordering of the data, which is what
`correlation=corAR1()` would have done - perhaps this just plain won't
work in nlme:::lme if you don't specify any ordering variable? - but I'm
not sure that will be correct given that your data are strictly time
ordered.

HTH

G

> The OFFSET is the boat route (the number of times the boat searched for
> whales in each 2x2km grid)
> RANDOM is the individual whale as done in previous studies (Hazen et al
> 2009 - MEPS - doi:10.3354/meps08108)
> 
> Can someone help me, please?
> Sincerely,
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-- 
Gavin Simpson, PhD                          [t] +1 306 337 8863
Adjunct Professor, Department of Biology    [f] +1 306 337 2410
Institute of Environmental Change & Society [e] gavin.simpson at uregina.ca
523 Research and Innovation Centre          [tw] @ucfagls
University of Regina
Regina, SK S4S 0A2, Canada



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