[R] Two-factor ANOVA Help

From: Jim Brindle <j_brindle_at_hotmail.com>
Date: Sat 08 Oct 2005 - 22:07:33 EST


Hello,

I am trying to perform a two-factor ANOVA analysis using a blocking design with "Vol" as the response variable. My intent is to have "Rater" treated as the treatment variable and the "Pipe" treated as the blocking variable. I am reading and preparing my dataset using the following three lines of code:

values <- read.table("filename", header=TRUE) attach(values)
values = data.frame(values)

The dataset is the following:

Pipe Rater Volume

1    A       5.129
1    B       5.296
1    C       4.679
1    D       4.776
2    A       8.519
2    B       8.482
2    C       7.659
2    D       7.798 
3    A       13.769
3    B       14.621
3    C       12.418
3    D       13.189

Below there are 2 versions which I've used to run my analysis.

Option #1:

g <- lm(Volume ~ factor(Rater) + factor(Pipe), values) print(anova(g))

Option #2:

Rater <- as.factor(Rater)
Pipe <- as.factor(Pipe)
g <- lm(Volume ~ Rater + Pipe, values)
print(anova(g))

A couple of questions I have are:

  1. I thought that option #1 and option #2 would have given me the same results and they don't appear to. The only difference (to me) is how I have specified the factors used in the model. However, there appears to be something else I am missing and I was just wondering if anyone has any insight as to which is the correct way to code this analysis?
  2. Unless otherwise specified is there a particular reference level that R uses by default - for example in this case, the second treatment level (Rater B)?
  3. Is there a good reference someone can point me to for more insight on the two-factor ANOVA analysis with R?

Thank you kindly in advance,
Jim

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Oct 08 22:11:37 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:39 EST