Keith Chamberlain
2006-Jan-12 11:33 UTC
[R] Obtaining the adjusted r-square given the regression
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.lmThat 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.squaredThe 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.
Apparently Analagous Threads
- Obtaining the adjusted r-square given the regression coef ficients
- Obtaining the adjusted r-square given the regression coefficients
- A More efficient method?
- Inverse transform after applying function in frequency domain?
- Matrix question: obtaining the square root of a positive definite matrix?