Hi CE.KA,

Take a look at the following:

# Data
set.seed(123)
x <- rnorm(100)
y <- 2 + 1.5*x + rnorm(100)

# Regression model
reg <- lm(y ~ x)

# The summary
summary(reg)

# Objects present in the summary()
names(summary(reg))

# Extracting the coefficients
summary(reg)$coeff

HTH,
Jorge


On Wed, Oct 21, 2009 at 5:07 AM, CE.KA <> wrote:

>
> Hi R users
>
> I used R to get the results of a linear regression
>
> reg<-lm(y~x)
>
> here are the results:
>
> # Call:
> # lm(formula = donnees$txi7098 ~ donnees$txs7098)
> #
> # Residuals:
> #       Min        1Q    Median        3Q       Max
> # -0.037971 -0.013373 -0.004947  0.010618  0.053235
> #
> # Coefficients:
> #                 Estimate Std. Error t value Pr(>|t|)
> # (Intercept)      0.08547    0.03028   2.822 0.011738 *
> # donnees$txs7098  0.62306    0.12847   4.850 0.000150 ***
> # ---
> # Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> #
> # Residual standard error: 0.02199 on 17 degrees of freedom
> # Multiple R-squared: 0.5805,     Adjusted R-squared: 0.5558
> # F-statistic: 23.52 on 1 and 17 DF,  p-value: 0.0001502
>
> I know how to get  the coefficients as variable
> for exemple:
> reg$coefficients[1]=0.08547 (Estimate )
> reg$coefficients[2]=0.62306 (Estimate )
>
> My question is:
> Is there a way to get the other results of lm as variables?
> -Std. Errors?
> -t value?
> -Pr(>|t|) ?
> -Residual standard error?
> -Multiple R-squared?
> -F-statistic?
>
> Best regards
>
>
> --
> View this message in context:
> http://www.nabble.com/linear-regression%3A-Is-there-a-way-to-get-the-results-of-lm-as-variables-tp25988916p25988916.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]


