Here is a response some time ago from John Fox which
should help.
# Extracting values from various objects.
# From "John Fox" <jfox_at_mcmaster.ca>
# Using an anova
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().
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.
Archive generated by hypermail 2.2.0, at Fri 16 May 2008 - 14:30:42 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.