Obtaining the adjusted r-square given the regression

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Obtaining the adjusted r-square given the regression

Keith Chamberlain
Hi people,
 I want to obtain the adjusted r-square given a set of coefficients (without
the intercept), and I don't know if there is a function that does it.
Exist????????????????

Dear Alexandra,

Without knowing what routine you were using that returned an R-Square value
too you, it is a little difficult to tell. I am not able to comment on your
routine, but I'll try to give a satisfactory response to your first
question.

Assuming that you used lm() for your linear regression, then all you need to
do is see the help page for the lm() summary method, which explains how to
get at the values in the summary. In your console type the following:

>?summary.lm

That help page describes how to get at the values in the summary, and
provides an example with getting the full correlation value (whereas the one
printed is in a 'pretty' form). I assume the other ones can be accessed
similarly, including the adjusted R^2. Your code might look something like
the following:

# Where object is the result of a call to lm()
>summary(object)$adj.r.squared

The help also has a demonstration for how to exclude the intercept, where
you simply add a -1 term too the end of your formula.

There may still be an accessor function available, which I do not know about
(BUT am certainly interested in if anyone has feedback).

In the future, it would help people on the list decode your function when it
too is printed in a readable form. The layout of your function in your
message may have become garbled when it was stripped of all of its HTML
information. If the code was formatted in a readable way when you sent the
message, then that's what happened. If that is the case try composing your
message in plain text to begin with.

I hope this helps.

Rgds,
KeithC.

______________________________________________
[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