[R] Contrast SS
Ista Zahn
izahn at psych.rochester.edu
Fri Nov 28 17:24:02 CET 2008
Hi all,
Hopefully this is an easy question and I've overlooked something
simple. I want to present specific contrasts in an ANOVA table. I can
of course get the significance tests with summary.lm, but my adviser
wants the results in ANOVA format. Here is a minimal example:
> x <- factor(c(rep("condition.1", 5), rep("condition.2", 5), rep("condition.3", 5)))
> y <- rnorm(15)
I know there are all kinds of built-in contrasts, but I specifically
want to contrast groups 1 and two with group 3, and I'm more
comfortable setting them by hand:
> contrasts(x) <- matrix(c(-1,-1,2, -1,1,0), 3,2)
> m.1 <- lm(y ~ x)
I can test the contrasts with
> summary(m.1)
but the results are not formatted in an ANOVA table. I can format the
results in an ANOVA table
> anova(m.1)
but this doesn't give me results for the contrast.
Any help is greatly appreciated.
-Ista
More information about the R-help
mailing list