[R-sig-ME] lme or lmer?

Ben Bolker bbolker at gmail.com
Sat Jan 21 16:54:00 CET 2012


Giorgio Arcara <giorgio.arcara at ...> writes:

> I would like to use mixed models in R to analyze EEG data, but I don't  
> know if it is more correct to use lme or lmer.
> My data have the following structure
> 
> Subject	Electrode	 Interval	Trial 	Condition	Ampl
> 1		Fp1		200-300		1	A		3.5
> 1		Fp1		200-300		2	B		4.2
> 1		Fp2		400-600		1	A		6.5
> 1		Fp2		400-600		2	B		3.3
> 2		Fp1		200-300		1	A		2.1
> 2		Fp1		200-300		2	B		-5.4
> 2		Fp2		400-600		1	A		-5.6
> 2		Fp2		400-600		2	B		-3.2

 [snip]

  In general if you *can* use either lme or lmer (i.e. the random effects are
not nested, there is no heteroscedasticity or correlation structure at the
level of residuals ...) then either is OK.  I generally recommend lme in 
these cases (with apologies to Doug Bates) because it is better documented,
although it's slower.

> For sake of simplicity, here I include only 2 Trials but in the real  
> dataset they are many more.
> In this hypothetical dataset Ampl is the depentent variable. Electrode  
> and Interval are two predictors. I expect that levels of Electrode  
> will be highly correlated as well the levels of Interval.

  ?? Meaning that most instances of FP1 have Interval 200-300, most
of Fp2 have 400-500, and there are few 'crossover' instances where you
have FP1 with 400-500 and FP2 with 200-300?  This will in general make
it hard to estimate to distinguish the two effects ... but presumably
you know that.

> My goal is to study if Condition influence Ampl and if interact with  
> Electrode variable and Interval Variable.
> 
> I would fit a model on these data with lmer with the following structure
> 
> mod=lmer(Ampl~Electrode*Interval*Condition+(1+Electrode|Subject) 
> +(1+Interval|Subject))
> If I'm correct the corresponding lme model would be
> 
> mod=lme(Ampl~Electrode*Interval*Condition, random=list(~1+condition| 
> Subject, ~1+Interval|Subject))

  Why not (Electrode+Interval|Subject)?  That (a) avoids a duplicated intercept
term and (b) estimates correlations between the intercept, electrode, and
Interval RE.

> Any suggestion for covariance matrix specification in lme?

  Do you need one other than the default -- i.e. do you expect
any particular correlation structure?




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