[R-sig-ME] Nested longitudinal
Ben Bolker
bbolker at gmail.com
Wed Apr 25 00:14:39 CEST 2012
Robert Kushler <kushler at ...> writes:
>
>
> I'm breaking my own rules by offering answers before getting answers to my own
> questions.
Hmmm. I didn't see any outstanding unanswered questions from you
on the list -- did I miss some? Or have you not asked them yet?
> 1) The simple general answer to your basic question is that the "/"
> character is used to represent nested factors, while a "*" is used
> to indicate "crossed" factors that might interact. Your use of "+"
> in the model formula below means you are *assuming* that the factors
> do not interact - and assuming something doesn't make it true.
[snip]
> 4) It seems to me that there will be very strong serial correlation
> in the 15 measurements on an individual subject. Unfortunately lmer
> doesn't include this as a modeling option. Your current syntax does
> one of the following: (a) fits a linear "time effect" with a random
> slope and intercept or (b) if time is a factor you are trying to
> estimate an "unstructured" (sorry, Doug Bates) 15 by 15 matrix.
> Both approaches are problematic here. I suggest you collapse the
> data by time and record y = number of minutes (out of 15) spent in
> light (or dark - doesn't matter) areas, and then use "cbind(y,15-y)"
> as the response. You probably should also try some alternatives to
> the binomial family (e.g., "quasibinomial").
lmer doesn't include it at least in part because it's difficult to
fit into a conditional GLMM framework -- the most sensible way to
define this would be to allow a per-observation random effect (which
would then also make the binomial overdispersed by definition), and
then specify that the individual-level random effects were themselves
temporally correlated.
Usually when you find packages that can incorporate temporal
correlation in a GLMM they either require that you specify the full
statistical model yourself (WinBUGS/JAGS, AD Model Builder), *or* they
are in some sense marginal models (glmmPQL in the MASS package [I
know] and ASREML [I think] allow 'R-side' structures such as temporal
correlation in GLMMs, but they use penalized quasi-likelihood for
estimation, which may under some circumstances be problematic).
For what it's worth you can't use quasi- families in glmer(); you
can either add an individual-level random effect, or use MASS::glmmPQL
if you want quasi- (see http://glmm.wikidot.com/faq for more
discussion of overdispersion in GLMMs).
> Regards, Rob Kushler
>
> On 4/24/2012 12:40 AM, arun wrote:
[snip]
> > A brief introduction about the work: It is a light/dark choice
> > test conducted in insect larvae. The response is binary (0-
> > present in dark area, 1-present in light area) and the experiment
> > is run for 15 min, so there are 15 measurements per individual
> > larva at 1 min intervals. The factors which affect this study are
> > Strain (2 levels-G and S), wavelength of light (4 levels-blue,
> > green, UV, red), and starting response at 0 min (two levels-
> > animal present in dark-D or light-L). This is how I think it is
> > nested. Strain nested inside Wavelength, Subject (individual)
> > nested within strain, Starting response within subject, and time >
> > within Starting response. The data looks like this:
[snip]
> >
> >
> > (fm2<-lmer(Response~Wavelength+Startingresponse+Strain+ time +
> (time|Subject),family=binomial, data=Behavdat))
> >
> > I am not sure how to specify the nested structures
> > within the
> > model.
More information about the R-sig-mixed-models
mailing list