[R-sig-ME] linear mixed model with non-monotonic longitudinal data

Ben Bolker bbolker at gmail.com
Thu Dec 27 16:49:59 CET 2012

Brad Buran <bburan at ...> writes:

>  I'm attempting to fit a linear mixed model to my dataset.  This
> data is the measure of stimulus-evoked power as a function of time.
> We have 32 subjects from two populations (broken down by genotype).
> The stimulus-evoked power is sampled at a high rate (one data-point
> every 5 msec) and reflects the "longitudinal" or "within-subjects"
> measure in my study.
> Right now I've defined the model as:
> power ~ genotype * time + (1|subject_id)
> I understand that one must also test additional models such as:
> power ~ genotype * time + (time|subject_id)
> power ~ genotype * time + (1|subject_id) + (0+time|subject_id)
> However, power is not a linear function of time (i.e. it is
> non-monotonic).  Power rapidly increases over a few hundred
> milliseconds to a peak value then gradually declines afterwards.  In
> this situation, would it be inappropriate to use time for
> determining a slope for the random effect?
> I'm actually not even sure whether a linear mixed model is
> appropriate for this type of data (considering the power response is
> non-monotonic with respect to time).  However, this is how the
> original analysis was set up by a predecessor and I am currently
> trying to determine the validity of this approach.  Thanks, Brad

  Hard to answer completely in general.  The simplest approach
would probably be to make the response a quadratic function of
time; there are a few slightly complicating issues (whether to
use a boneheaded approach such as (genotype * (time + I(time^2))) or
to use poly(time,2) , which constructs orthogonal polynomials
by default, and how to get the time*subject interactions specified
correctly), but it's pretty easy and if it looks like it fits
your data well I might be satisfied with it.
  You could also fit generalized additive mixed
models (see the mgcv and gamm4 packages), again I'm not 100%
sure how to incorporate the time*subject interactions.  
  The bottom line is that linear models are actually pretty
flexible for modeling continuous, not necessarily linear,
responses (the assumption is that the model is a linear function
of the parameters, not necessarily that (e.g.) power is
a linear function of time).
  Ben Bolker

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