[R] anova

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Aug 4 18:17:57 CEST 2003

"Anna  H. Pryor" <anna at ptolemy.arc.nasa.gov> writes:

> I looked at the Introduction to R and am still confused.  Would it be possible 
> to ask a question in which I have three vectors and I want to perform an 
> anova on them.  Say A,B, and C.  Is there a standard form that I could use in 
> lm to get a model that I could use in anova?  Do I need to know more about my 
> problem?
> I really appreciate any help in this.

There are many forms of anova. The type you describe, I presume, is
data from three separate groups, aka one-way ANOVA. You need to first
force your data into the parallel-vector layout like this

  y <- c(A,B,C)
  group <- factor(rep(1:3,c(7,9,13))) # provided there are 7 elements
                                      # in A, 9 in B and 13 in C

and then 


or, for some more options, consider


   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-help mailing list