An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071208/57caf33c/attachment.pl
How to extract numbers from ANOVA tables?
3 messages · Brinkmann, Lars, Brian Ripley, John Fox
On Sat, 8 Dec 2007, Brinkmann, Lars wrote:
I need to extract numbers (eg. estimates, standard errors etc.) summarized in an ANOVA table or summary() table for further calculations. Can somebody help me or refer me to the needed resource on the web?
The Value section of the relevant help page tells you how the values are stored. If you need more details, reading the appropriate print() method will show you where the printed numbers come from (and occasionally they are computed in the print method). For e.g. lm or glm fits coeF(summary(fit)) will extract the coefficients matrix. Had you given an example of what you wanted to extract we could have given you an example of how to do it.
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
PLEASE do!
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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Dear Lars, In addition to looking at the relevant help pages, a nice thing about R is that the objects are there for you to examine. For example:
mod <- lm(mpg ~ ., data=mtcars) av <- anova(mod)
names(av)
[1] "Df" "Sum Sq" "Mean Sq" "F value" "Pr(>F)"
str(av)
Classes 'anova' and 'data.frame': 11 obs. of 5 variables: $ Df : int 1 1 1 1 1 1 1 1 1 1 ... $ Sum Sq : num 817.71 37.59 9.37 16.47 77.48 ... $ Mean Sq: num 817.71 37.59 9.37 16.47 77.48 ... $ F value: num 116.42 5.35 1.33 2.34 11.03 ... $ Pr(>F) : num 5.03e-10 3.09e-02 2.61e-01 1.41e-01 3.24e-03 ... - attr(*, "heading")= chr "Analysis of Variance Table\n" "Response: mpg" Thus, e.g., av$"Sum Sq" returns the sums of squares:
av$"Sum Sq"
[1] 817.7129524 37.5939529 9.3709293 16.4674349 77.4757948 3.9493082 [7] 0.1297687 14.4742372 0.9717105 0.4066688 147.4944300 You could do the same thing with the object returned by summary(). I hope that this helps, John -------------------------------- John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox --------------------------------
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Brinkmann, Lars Sent: Saturday, December 08, 2007 4:09 AM To: r-help at stat.math.ethz.ch Subject: [R] How to extract numbers from ANOVA tables? I need to extract numbers (eg. estimates, standard errors etc.) summarized in an ANOVA table or summary() table for further calculations. Can somebody help me or refer me to the needed resource on the web? [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.