[R] help_aov

Thanjavur Bragadeesh bragadeesh02 at hotmail.com
Mon Oct 30 23:35:45 CET 2006


Hi,

I am trying to run an analysis of variance using R.
in my data table "x" is a continuous variable lengthof 200 and "p" is a 
categorical variable also of length 200 and p is anyone of three categories 
1,2 or ,3.
if I run
summary(aov(x~p,data=test))
I get
Response: x
             Df  Sum Sq Mean Sq F value    Pr(>F)
p           1  3174.7  3174.7  42.749 5.175e-10 ***
Residuals 198 14704.2    74.3
---
and if I run
summary(aov(x~as.factor(p), data=test)) # I get

Response: x
                    Df  Sum Sq  Mean Sq  F value   Pr(>F)
as.factor(p)      2  3175.7  1587.8   21.275  4.31e-09 ***
Residuals       197  14703.2    74.6


Can anyone kindly explain the difference. How will it affect -correct way to 
run - if it is a two-way anova where I have a second categorical variable 
"sex" - male or female.

Many Thanks


Yours sincerely,

Bragadeesh



More information about the R-help mailing list