# [R] nlme cross-over and fixed nested

Dieter Menne dieter.menne at menne-biomed.de
Mon May 27 18:35:58 CEST 2002

```Peter,
thanks a lot...

>> I don't think you mean that. One of them wants to have
>> Seq=as.factor(rep(c(2,1),NSubj/2))
>> otherwise patient 1 has two 1st phases, pt.2 has two 2nd phases, etc.

I had done it as you suggested in my earlier life, but I was told by a
statistician from a big pharma company the above definition was the correct
one: each patient only belongs to one "Sequence", either pla/ver or ver/pla.
The argument was that therefore patient should be nested in sequence.

In your definition there is no such nesting (?? Or? I never get this right)

> glu <- transform(glu, first=as.factor((Seq==1)==(Treat=="Pla")))
>>For a balanced design, I'd suggest
>> summary(aov(Glu~Treat*Seq+Error(Patient),data=glu))

>>Or, put differently, it makes little sense to use the Seq variable, as
>>you define it, as a main effect. Rather, you'd want an indicator of
>>whether the current observation is the first or the second one, so

> summary(aov(Glu~Treat*first+Error(Patient),data=glu))

Error: Patient
Df Sum Sq Mean Sq F value Pr(>F)
Treat:first  1  14.96   14.96  0.2739 0.6071
Residuals   18 982.75   54.60

Error: Within
Df Sum Sq Mean Sq F value    Pr(>F)
Treat      1 478.04  478.04 75.9305 7.106e-08 ***
first      1   2.66    2.66  0.4221    0.5241
Residuals 18 113.32    6.30
---

> summary(aov(Glu~Treat*Seq+Error(Patient),data=glu))

Error: Patient
Df Sum Sq Mean Sq F value Pr(>F)
Seq        1  14.96   14.96  0.2739 0.6071
Residuals 18 982.75   54.60

Error: Within
Df Sum Sq Mean Sq F value    Pr(>F)
Treat      1 478.04  478.04 75.9305 7.106e-08 ***
Treat:Seq  1   2.66    2.66  0.4221    0.5241
Residuals 18 113.32    6.30

------------------------------------

But the results are the same in both definitions (Seq, and First)! Or is
this only because of the balancing (in my real world, list are slightly
imbalanced). And, citing the referee: in your aov, there is neither an
indication of nesting. I see that you don't need it for your "First"
definition, but why (as the referee says) should I use it in my "Seq"
definition?

Sorry ... this nesting stuff confuses me. And in an excellent book like
Pinheiro/Bates which I have studied more than once it's not even in the
index (it's in the text, sometimes).

Dieter

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```