[R] Linear mixed effects models

Nathan Weisz Nathan.Weisz at uni-konstanz.de
Fri Feb 21 16:13:02 CET 2003

Hi everyone,

I'm a newbie to R and to linear mixed effects modeling, so please have mercy
Just wanted to check, whether what I'm doing is alright.

I've collected data concerning tonotopic organization of the auditory cortex
in humans, and I have approximately 1400-1800 data/time points per person
(13 in total). Observations were made how the focus of neuronal activity
changed spatially while processing of a frequency-modulated tone.

Regression analysis was performed for each individual using orthogonal
polynomials ...
regtemp <- lm(tempmat[,j] ~ poly(tempmat[,1],degree=i))
... up to degree = 5.

Based on the median (i.e. over all individuals) adjusted R-square, it could
be seen that a linear approach yielded about .5 adj-R2, adding a quadratic
term increased R2 to about .7 (adding further terms didn't increase adj-R2
in a significant manner).

SO: the next step is to apply a linear mixed effects model of the kind:
        y ~ x + x^2
My data.frame looks something like this:

   Latency medlat Subject
1    124.1     NA       1
2    125.6     NA       1
306   573.9  -3.83       1
307   575.3  -3.83       1
3000  1859.7  -6.04       2
3001  1861.2  -6.04       2
3002  1862.6  -6.03       2
..... etc. until subject 13

I.e. medlat is the dependent variable, latency my independent variable,
subject is the grouping variable (however I didn't group specifically before
calling lme --> was this wrong?).

There are 23686 observations in total, and depending on the subject some NA.
Following function call was used:
dummy.lme <- lme(medlat ~ poly(Latency, degree = 2), data = dummy,
+ random = ~ Latency | Subject, na.action = na.omit)

- Is this approach o.k., or have you lost all your hair already?
- Can one of the lme-experts see if there's something overtly wrong with my
lme-call (especially the fixed and random term)
- I wanted to see how the fits look like for every individual. Using
plot(dummy.lme), I thought this should yield a trellis plot, with each
individual in a separate plot (and fitted line). However it didn't (it was
just a big mess). Any hints?

Thanks for your patience and all the best,



Nathan Weisz
Institute for Clinical Psychology and
Behavioral Neuroscience
University of Konstanz
P.O. Box D25
D - 78467 Konstanz

Tel: +49 (0)7531 88- 4612
Fax: +49 (0)7531 88- 2891
E-mail: Nathan.Weisz at uni-konstanz.de


More information about the R-help mailing list