[R-sig-ME] linear mixed model with non-monotonic longitudinal data
bburan at galenea.com
Thu Dec 27 23:31:55 CET 2012
That was very helpful. It didn't occur to me that it was possible to use functions such as poly in the equation. That said, it seems that none of the models (i.e. the ones I mentioned nor the ones you suggested) seem to be a good fit for the data based on the residuals. Since the original model was defined in SPSS (using the genlinmixed function), I want to try to determine the actual model that SPSS uses (they make you step through a GUI to define your model rather than defining an equation like R does). I haven't been able to find any documentation on how the inputs to the genlinmixed command are transformed into a model that I could try to create in R (so I can check it's validity).
Is anyone aware of how SPSS model GENLINMIXED with SUBJECTS=subject_id, REPEATED_MEASURES=time, FIXED_EFFECTS=genotype time genotype*time would translate to a R formula?
From: r-sig-mixed-models-bounces at r-project.org [r-sig-mixed-models-bounces at r-project.org] on behalf of Ben Bolker [bbolker at gmail.com]
Sent: Thursday, December 27, 2012 10:49 AM
To: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] linear mixed model with non-monotonic longitudinal data
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).
R-sig-mixed-models at r-project.org mailing list
More information about the R-sig-mixed-models