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

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

From   "Nick Cox" <>
To   <>
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

Even better than pursuing a single figure-of-merit would be to plot
observed vs predicted residuals vs predicted. 


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:

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