[R-sig-ME] mixed effects model glmer

Thierry Onkelinx thierry.onkelinx at inbo.be
Thu Sep 24 09:44:00 CEST 2015


Adding a random effect is equivalent to a compound symmetry
correlation structure. Since you have only 4 years, it would be too
bad compared to an AR1 correlation structure.

If you really need correlated random effects, then you can have a look
at the INLA package. Not on CRAN but on www.r-inla.org.
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey


2015-09-23 22:41 GMT+02:00 Ben Bolker <bbolker op gmail.com>:
> On Wed, Sep 23, 2015 at 2:36 PM, M West <westm490 op 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
>>
>>
>
> _______________________________________________
> R-sig-mixed-models op r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



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