[R] Using Anova Sums of Squares

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri Sep 6 20:02:02 CEST 2002


I believe this is a multistratum aov (that is, with an Error term)?
If so, you need to take a look at print.aovlist and summary.aovlist to
learn handle the object.

On Fri, 6 Sep 2002, Maarten Speekenbrink wrote:

> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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