[R] extract f-value from aov object

Kaspar Pflugshaupt pflugshaupt at geobot.umnw.ethz.ch
Mon Mar 18 14:29:26 CET 2002


On 18.3.2002 13:50 Uhr, Rishabh Gupta wrote:

> Hi all,
> I'm using R to perfrom ANOVA on some data using aov(). What
> I would like to know, is there some way that I can extract the f-value
> that I obtain in the function summary(aov(.....)). I am running the
> whole thing in a script and I would like to be able to extract the f
> value after performing ANOVA and use it further in the script. E.g. Is
> there is a dimension name like fit["f_value"] that can be used to
> acces the value.
> 
> Any Help would be greatly appreciated.
> 
> Many Thanks
> 
> Rishabh

Hi,

you should assign the summary to a variable, and then use the names() and
str() functions to find out about its structure. Trying it out here, I find
that after ttt <- summary(aov(rnorm(4) ~ c(1,1,2,2))), I can use
ttt[[1]]$F[1] to get the F value.

If your model is more complicated (e.g. if it contains more than one error
term), the summary structure will be different, too.

Alternatively, look at the summary.aov function to see how the F value is
calculated from the components of the aov object, and do it "by hand".


Hope that helps

Kaspar Pflugshaupt


-- 

Kaspar Pflugshaupt
Geobotanisches Institut
Zuerichbergstr. 38
CH-8044 Zuerich

Tel. ++41 1 632 43 19
Fax  ++41 1 632 12 15

mailto:pflugshaupt at geobot.umnw.ethz.ch
privat:pflugshaupt at mails.ch
http://www.geobot.umnw.ethz.ch

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