[R] Treatment-Contrast Interactions
Lorin Hochstein
lorin at cs.umd.edu
Mon Feb 21 23:40:05 CET 2005
Peter Dalgaard wrote:
>Lorin Hochstein <lorin at cs.umd.edu> writes:
>
>
>
>>I'd like to understand this approach as well, but I can't reproduce my
>>results using se.contrast. In particular, I get the same standard
>>error even though I tried to use different contrasts:
>>
>> > c1 <- c(1,-1)[A]*c(1,-1,0)[B]
>> > c2 <- c(1,-1)[A]*c(1,0,-1)[B]
>> > c3 <- c(1,-1)[A]*c(0,1,-1)[B]
>> > se.contrast(fit, as.matrix(c1))
>>Contrast 1
>> 14.24547
>> > se.contrast(fit,as.matrix(c2))
>>Contrast 1
>> 14.24547
>> > se.contrast(fit,as.matrix(c3))
>>Contrast 1
>> 14.24547
>>
>>
>
>They could well _be_ the same if the design is balanced...
>
>
Hmmm... One of my problems is that I don't know how to interpret the
output of se.contrast.
Here's my example again.
> score <- c(12, 8,10, 6, 8, 4,
10,12, 8, 6,10,14,
9, 7, 9, 5,11,12,
7,13, 9, 9, 5,11,
8, 7, 3, 8,12,10,
13,14,19, 9,16,14)
> n <- 6
> A <- gl(2,3*n,labels=c("a1","a2"))
> B <- rep(gl(3,n,labels=c("b1","b2","b3")),2)
> contrasts(B) <- c(1,-1,0)
> fit <- aov(score~A*B)
> summary(fit, split=list(B=1:2), expand.split = T)
Df Sum Sq Mean Sq F value Pr(>F)
A 1 18.778 18.778 2.2208 0.146606
B 2 62.000 31.000 3.6662 0.037629 *
B: C1 1 1.500 1.500 0.1774 0.676621
B: C2 1 60.500 60.500 7.1551 0.011986 *
A:B 2 81.556 40.778 4.8226 0.015274 *
A:B: C1 1 13.500 13.500 1.5966 0.216119 # <---
A:B: C2 1 68.056 68.056 8.0486 0.008085 **
Residuals 30 253.667 8.456
What I'm really looking for is that F value that's labelled A:B: C1,
1.5966 in this case. (I'm not sure what to call this term, AB interaction?)
I thought that it might be possible to use se.contrast to compute this
(or at least, to get the numerator so that I could compute the F value
once I had the mean square error of the residuals), but I'm not sure how
to specify the contrast, and I don't know the relationship between the
"standard error" output by se.contrast and the "mean square error" which
is the fourth column of the output above.
Lorin
More information about the R-help
mailing list