[R] Contrast SS

From: Ista Zahn <izahn_at_psych.rochester.edu>
Date: Fri, 28 Nov 2008 11:24:02 -0500

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.


R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 28 Nov 2008 - 16:27:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 28 Nov 2008 - 18:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive