linear model - lm (Adjusted R-squared)?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

linear model - lm (Adjusted R-squared)?

Brian Smith
Hi,

Sorry for the naive question, but what exactly does the 'Adjusted R-squared'
coefficient in the summary of linear model adjust for?

Sample code:

> x <- rnorm(15)
> y <- rnorm(15)
> lmr <- lm(y~x)
> summary(lmr)

Call:
lm(formula = y ~ x)

Residuals:
    Min      1Q  Median      3Q     Max
-1.7828 -0.7379 -0.4485  0.7563  2.1570

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.13084    0.28845  -0.454    0.658
x            0.01923    0.25961   0.074    0.942

Residual standard error: 1.106 on 13 degrees of freedom
Multiple R-squared: 0.0004217,    Adjusted R-squared: -0.07647
F-statistic: 0.005485 on 1 and 13 DF,  p-value: 0.942

> cor(x,y)
[1] 0.02053617


- What factors are included in the adjustment?

many thanks!

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: linear model - lm (Adjusted R-squared)?

Erik Iverson-3
See:

http://en.wikipedia.org/wiki/Coefficient_of_determination#Adjusted_R2

and the implementation in summary.lm :

         ans$adj.r.squared <- 1 - (1 - ans$r.squared) * ((n -
             df.int)/rdf)



Brian Smith wrote:

> Hi,
>
> Sorry for the naive question, but what exactly does the 'Adjusted R-squared'
> coefficient in the summary of linear model adjust for?
>
> Sample code:
>
>> x <- rnorm(15)
>> y <- rnorm(15)
>> lmr <- lm(y~x)
>> summary(lmr)
>
> Call:
> lm(formula = y ~ x)
>
> Residuals:
>     Min      1Q  Median      3Q     Max
> -1.7828 -0.7379 -0.4485  0.7563  2.1570
>
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)
> (Intercept) -0.13084    0.28845  -0.454    0.658
> x            0.01923    0.25961   0.074    0.942
>
> Residual standard error: 1.106 on 13 degrees of freedom
> Multiple R-squared: 0.0004217,    Adjusted R-squared: -0.07647
> F-statistic: 0.005485 on 1 and 13 DF,  p-value: 0.942
>
>> cor(x,y)
> [1] 0.02053617
>
>
> - What factors are included in the adjustment?
>
> many thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.