Re: [R] ANCOVA in S-plus/R?

From: Richard M. Heiberger <>
Date: Sat 03 Jun 2006 - 05:59:30 EST

To get the ANCOVA table you need to look at the anova() function.

The variables T and L must be factors to get the multi-degree-of-freedom anova tables you are looking for.

Order matters. You get the same residual, but the sequential sums of squares differ.

bt.aov <- aov(E ~ B + T)
gives you the (t-1)df test of common intercept vs variable intercept. This is equivalent to comparing the adjusted means.

tb.aov <- aov(E ~ T + B)
gives you the 1df test of 0 slope (ordinary ANOVA) vs non-zero common slope.

lm() and aov() are essentially the same program. The default output is different.

When you bring in the blocking effect of hospital, you will most likely want that sequentially first.

lbt.aov <- aov(E ~ L + B + T)

If you want to test for interaction with the hospital effect, you can use <- aov(E ~ L * (B + T))
anova( mailing list PLEASE do read the posting guide! Received on Sat Jun 03 06:06:05 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 03 Jun 2006 - 06:10:30 EST.

Mailing list information is available at Please read the posting guide before posting to the list.