[R] Using Anova Sums of Squares
Maarten Speekenbrink
mspeekenbrink at fmg.uva.nl
Fri Sep 6 10:04:24 CEST 2002
Dear all,
I'm trying to access the Sums of Squares resulting from a summary(aov(....)) so I can use them in a function. Is there an easy way to access these?
The structure of a summary.aov object is something like this:
> str(summary(fhc.aov))
List of 5
$ Error: PPNR :List of 1
..$ :Classes anova and `data.frame': 1 obs. of 5 variables:
.. ..$ Df : num 70
.. ..$ Sum Sq : num 70.7
.. ..$ Mean Sq: num 1.01
.. ..$ F value: num NA
.. ..$ Pr(>F) : num NA
..- attr(*, "class")= chr [1:2] "summary.aov" "listof"
$ Error: PPNR:CONSENS:List of 1
..$ :Classes anova and `data.frame': 2 obs. of 5 variables:
.. ..$ Df : num [1:2] 1 70
.. ..$ Sum Sq : num [1:2] 0.254 70.746
.. ..$ Mean Sq: num [1:2] 0.254 1.011
.. ..$ F value: num [1:2] 0.251 NA
.. ..$ Pr(>F) : num [1:2] 0.618 NA
..- attr(*, "class")= chr [1:2] "summary.aov" "listof"
...etc.
but calling summary(fhc.aov)[2]$"Sum Sq" or anything like it (i.e. summary(fhc.aov)[2][2] or summary(fhc.aov)[2][1][2]) results in a Na. The only way I've been able to get it is by unlist(summary(fhc.aov)[2]), which does result in a list with the right number of elements, but this is not very handy for indexing... Of course I could recompute the Sums of Squares, but since summary(aov(...)) already gives them, I would rather get them from there. Thanks for your help,
Maarten Speekenbrink
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list