[R] mixed effects with nlme

Manuel Ato Garcia matogar at um.es
Sat Oct 4 08:18:26 CEST 2003


Dear R users:

 I have some difficulties analizing data with mixed effects NLME and the
last version of R. More concretely, I have a repeated measures design with
a single group and 2 experimental factors (say A and B) and my interest is
to compare additive and nonadditive models. 

   suj  rv    A       B
1   s1   4   a1      b1
2   s1   5   a1      b2
3   s1   7   a1      b3
4   s1   1   a2      b1
5   s1   4   a2      b2
6   s1   2   a2      b3
7   s2   6   a1      b1
8   s2   8   a1      b2
9   s2  10   a1      b3
10  s2   3   a2      b1
11  s2   6   a2      b2
12  s2   6   a2      b3
13  s3   1   a1      b1
14  s3   6   a1      b2
15  s3   5   a1      b3
16  s3   3   a2      b1
17  s3   5   a2      b2
18  s3   4   a2      b3
19  s4   2   a1      b1
20  s4  10   a1      b2
21  s4  12   a1      b3
22  s4   1   a2      b1
23  s4   4   a2      b2
24  s4   7   a2      b3
25  s5   5   a1      b1
26  s5  10   a1      b2
27  s5  10   a1      b3
28  s5   5   a2      b1
29  s5   6   a2      b2
30  s5   5   a2      b3
31  s6   1   a1      b1
32  s6   7   a1      b2
33  s6   8   a1      b3
34  s6   2   a2      b1
35  s6   8   a2      b2
36  s6   7   a2      b3

It is very easy to fit these data with base R function AOV:

NonAdditive model:
 aov(rv ~ A*B + Error(suj+suj/A+suj/B)

Additive model:
 aov(rv ~ A*B + Error(suj)

and also easy with SAS MIXED (I missed some obvious lines):

NonAdditive model
 model vr = A B A*B;
 random suj A*suj B*suj;
 repeated / type=cs subj=suj;

Additive model;
 model vr = A B A*B /ddfm=satterth;
 repeated / type=cs subj=suj;
 
Using LME I do not find any problems to fit the additive model with

 lme(vr~A*B, random=~1|suj, cor=corCompSymm())

but I have found some difficulties fitting the nonadditive model.

 Can anyone help me?
 
 Thanks in advance.

	Manuel Ato
	Dpto. Psic.Básica y Metodología
	Apartado 4021
	30080 MURCIA (Spain)
	e-mail: matogar at um.es




More information about the R-help mailing list