[R-sig-ME] GLMM question in lme4
Ben Bolker
bbolker at gmail.com
Thu Apr 11 03:04:11 CEST 2013
Hallman, Tyler <Tyler.Hallman at ...> writes:
>
> To Whom it May Concern,
> I am currently analyzing the data from a toxicity test and I want to
> use a glmm with the lmer function in the lme4 package.
> Experimental Design: I exposed beakers of larval amphibians to
> different concentrations of metals contaminants at different
> temperatures. I'm primarily concerned with the effect of temperature
> on toxicity. I ran the test for 4 days and my response variable is
> proportional data (percent mortality) because I recorded the number
> dead per beaker. I therefore have percent mortality for each beaker
> at 0, 24, 48, 72, and 96 hours. I had 3 replicates of each
> treatment.
> Statistics: I want to incorporate time into the model and need to
> include the autocorrelation due to time (violation of the assumption
> of independence). I also have to account for the response variable
> being proportional with lots of 0's and 1's.
> So far it looks like I have to do something like this:
>
> m1<-lmer(PercentMortality~Time*Concentration*Temperature+(1|BeakerNumber),
> family=binomial)
This is a good start.
(minor) In the current release lmer(...,family=binomial)
automatically calls glmer(), but in future releases you will have to
call glmer() explicitly.
(major) I'm surprised you're not getting warnings about
"non-integer #successes in a binomial glm", if you have more
than one individual per beaker. Take a closer look at the
?glm help page for the format of binomial response variables
(hint: either cbind(n.dead,n.notdead)~... or prop~..., weights=n.exposed)
You might want (Time|BeakerNumber), to allow for different trajectories
through time in each beaker.
These models don't explicitly account for continuous temporal
autocorrelation (e.g. an autoregressive-order-1 (AR1) model would
be the simplest case), but that is actually a little bit tricky
in the GLMM case -- you would probably need to use AD Model Builder
or WinBUGS or some more general tool for that. Given that you
have only 5 time points, and not a gigantic data set, that might
not be a huge problem. You could check the residuals for evidence
of autocorrelation.
However, the models *do* account for the overall correlation of
observations within beakers.
You may also want to add an observation-level random effect
to account for overdispersion.
> I'm not sure if this accounts for the non-independence between times
> though. Do you have any suggestions as to the code I should use for
> this? Any help would be greatly appreciated as I've been having
> trouble finding examples of this type of analysis.
More information about the R-sig-mixed-models
mailing list