[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Validity of R Square with -nl- Regressions

From   Maarten buis <>
Subject   Re: st: Validity of R Square with -nl- Regressions
Date   Fri, 20 Jun 2008 10:04:46 +0100 (BST)

--- "Matthias Flueckiger" wrote:
> I'm estimating a function by the -nl- method. The estimates  I get
> for the coefficients seem ok. The same as when I use MATLAB. But
> concerning the R square reported I have my doubts. They are always
> extremly high (>0.99). But when plotting the fitted function against
> the real data, the match does not seem very good (at least not as
> good as the R square suggests). 
> My questions are therefore:
> - is the  r square really the appropriate measure for the fit  for 
> -nl- regressions? If yes is there an explanation why it is so high
> (compared when plotting the curves)

The R square reported by -nl- means what it is supposed to mean: the
proportion of variance explained by the model. It is not some kind of
pseudo-rsquare which can have a very different meaning than the `real'

> - how does Stata calculate the r square, and is there a way I can 
> calculate it 'manually'? (Is it the same formula as with linear
> regressions? Probably not...)

Below I show two ways of computing the R-square: the obvious one: 
R-square = moddel sum of squares / total sum of squares, and a method
discussed here:

*---------- begin example ------------
sysuse auto, clear
nl (mpg = {b0} + {b1}/headroom)
di e(mss)/e(tss)
predict yhat if e(sample)
corr yhat mpg if e(sample)
di r(rho)^2
*----------- end example -------------
(For more on how to use examples I sent to the Statalist, see )

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Sent from Yahoo! Mail.
A Smarter Email
*   For searches and help try:

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