[R] Extracting values from linear models

Heather Maughan hmaughan at u.arizona.edu
Thu Feb 17 23:12:41 CET 2005


Hello:

I want to use values from the output of linear models done using permuted
data to construct a random distribution.  The problem I am having is the
extraction of a value, say the p-value or the regression coefficient, from
the summary of a linear model. When summarizing a linear model I get this:

Call:
lm(formula = fitness ~ mm)

Residuals:
     Min       1Q   Median       3Q      Max
-0.57369 -0.17551 -0.01602  0.15723  0.68844

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept)  1.783440   0.074052  24.084  < 2e-16 ***
mm          -0.004272   0.001456  -2.933  0.00662 **
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

Residual standard error: 0.3261 on 28 degrees of freedom
Multiple R-Squared: 0.2351,    Adjusted R-squared: 0.2077
F-statistic: 8.604 on 1 and 28 DF,  p-value: 0.006621

How do I pick out the p-value, or the R-squared using R code?

Thanks,
Heather
-- 
Heather Maughan
Department of Ecology and Evolutionary Biology
Biosciences West 310
University of Arizona
Tucson, AZ  85701
Phone: 520-626-5108
Fax: 520-621-9190
hmaughan at u.arizona.edu




More information about the R-help mailing list