[R-sig-ME] mixed effects model glmer
Ben Bolker
bbolker at gmail.com
Wed Sep 23 22:41:27 CEST 2015
On Wed, Sep 23, 2015 at 2:36 PM, M West <westm490 at gmail.com> wrote:
> I am trying to fit a mixed effects model with repeated measures data.
>
> Data are:
>
> y variable = percentage (# females/total)
> x variable = percentage
>
> measured across multiple sites for 4 years.
>
> here's the model:
>
> y <- cbind(total females, (Total - total females)))
>
> mod1 <- with(data, glmer(y ~ disease prevalence + (1|Site) + (1|Year),
> family = binomial, data = data1))
Just to be clear, disease prevalence is a number in [0,1]?
>
> 1) This model runs, but the summary(mod1) just generates a series of the
> following....which doesn't make any sense so something must be wrong with
> the model specification...I'm just not sure what.
>
> 2) Also, what is the default AR correlation on these models (i.e., do I
> need to specify it or is the temporal psuedoreplication taken care of)?
AR models are not currently easy in lme4. My suggestion (=hack) would
be to get the residuals and use nlme::gls(resid~1,correlation=corAR1()) (or
something like that) to see if you should worry about autoregressive structure.
Four years is not very many, so you might need to treat Year as a
fixed effect (e.g. I would consider that option if the random effects variance
is estimated as zero)
How many sites? How many total observations?
I have to admit that I'm stumped by your apparent model output (i.e.
that there are multiple parameters for disease prevalence when there
should only be one)
Perhaps you could send the results of summary(data1) and/or
str(data1) and summary() of your whole model?
>
> 3) Finally, do you suggest another form of the model that's better etc.?
>
> Fixed effects:
> Estimate Std. Error z value
> Pr(>|z|)
> (Intercept) -1.60267 0.11618 -13.794 <
> 2e-16 ***
> disease prevalence -0.40212 0.15557 -2.585 0.009745 **
> disease prevalence 0.035088231 -1.46452 0.22860 -6.406 1.49e-10
> ***
> disease prevalence 0.064935065 -0.36344 0.30810 -1.180 0.238157
>
> disease prevalence 0.078507945 -2.57479 0.46537 -5.533 3.15e-08
> ***
> disease prevalence 0.120039255 -3.30998 0.71915 -4.603 4.17e-06
> ***
> disease prevalence 0.182623706 -0.14362 0.19899 -0.722 0.470438
>
>
More information about the R-sig-mixed-models
mailing list