Daphne Renault
2008-May-16 13:12 UTC
[R] How to extract estimates, Std. Error, t Value and Pr(>|t|) from summary
[This email is either empty or too large to be displayed at this time]
John Kane
2008-May-16 13:32 UTC
[R] How to extract estimates, Std. Error, t Value and Pr(>|t|) from summary
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(). =====================================================--- Daphne Renault <daphne.renault at yahoo.com> wrote: __________________________________________________________________ [[elided Yahoo spam]]
Yasir Kaheil
2008-May-16 13:35 UTC
[R] How to extract estimates, Std. Error, t Value and Pr(>|t|) from summary
> dat<-array(runif(30),c(15,2)); > dat<-data.frame(x=dat[,1],y=dat[,2]); > linm<-lm(y~x,data=dat); > linm.s<-summary(linm); > attributes(linm.s) #to see all attributes of the summary$names [1] "call" "terms" "residuals" "coefficients" [5] "aliased" "sigma" "df" "r.squared" [9] "adj.r.squared" "fstatistic" "cov.unscaled" $class [1] "summary.lm"> linm.s$coefficients # that's the variable you're looking for, right?Estimate Std. Error t value Pr(>|t|) (Intercept) 0.6132455 0.1907463 3.214980 0.006769529 x -0.3648345 0.3134967 -1.163759 0.265436835 thanks y Daphne Renault wrote:> > > ______________________________________________ > 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. > >----- Yasir H. Kaheil Catchment Research Facility The University of Western Ontario -- View this message in context: http://www.nabble.com/How-to-extract-estimates%2C-Std.-Error%2C-t-Value-and-Pr%28%3E%7Ct%7C%29-from-summary-tp17274673p17274850.html Sent from the R help mailing list archive at Nabble.com.