[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: Re: computation of R-squared with a non-linear model |

Date |
Fri, 22 May 2009 12:14:11 +0100 |

Last sentence should be Even better than pursuing a single figure-of-merit would be to plot observed vs predicted and residuals vs predicted. Nick n.j.cox@durham.ac.uk -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: 22 May 2009 12:06 To: statalist@hsphsun2.harvard.edu Subject: st: RE: Re: computation of R-squared with a non-linear model 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/ * * 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/

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

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

- Prev by Date:
**st: RE: Re: computation of R-squared with a non-linear model** - Next by Date:
**st: Clustering Problem** - Previous by thread:
**st: RE: Re: computation of R-squared with a non-linear model** - Next by thread:
**st: how to identify unique id variables within groups?** - Index(es):

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