[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Re: computation of R-squared with a non-linear model |

Date |
Fri, 22 May 2009 12:05:57 +0100 |

I support this general idea. For another statement, see How can I get an R-squared value when a Stata command does not supply one? http://www.stata.com/support/faqs/stat/rsquared.html Even better than pursuing a single figure-of-merit would be to plot observed vs predicted residuals vs predicted. Nick n.j.cox@durham.ac.uk Paul Seed There is a simple way to compute R-squared for any regression model, if you do not believe the value given by Stata: Calculate the predicted values and carry out your own correlation. Using the auto data set: **** Start Stata code ***** sysuse auto regress weight price predict pred_w su weight pred_w corr weight pred_w di "R-squared = " r(rho)*r(rho) **** End Stata code ***** Both ways giver a value of 0.2901023 In general, the use of weights and adjusted R-squared makes things more complicated, and the last two lines could be changed to allow for them; but neither will alter a correltion of 1.0. If Marcel Spijkerman uses this approach, he may find a) Marcel is right - the second R-squared is different from the first. (He does not say, but I assume that both the adjusted and unadjusted R-squared are 1.0). b) Martin Buis is right - the model has failed to converge, and the predicted values are mostly or completely undefined. c) Stata is right - both methods give R-squared = 1.0 d) Something else I haven't though to. I'd be interested to know which. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: RE: RE: Re: computation of R-squared with a non-linear model***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: Re: computation of R-squared with a non-linear model***From:*Paul Seed <paul.seed@kcl.ac.uk>

- Prev by Date:
**st: 3nd Nordic and Baltic Stata Users Group meeting 2009 first announcement and call for presentations** - Next by Date:
**st: RE: RE: Re: computation of R-squared with a non-linear model** - Previous by thread:
**RE: st: Re: computation of R-squared with a non-linear model** - Next by thread:
**st: RE: RE: Re: computation of R-squared with a non-linear model** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |