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

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

From   "Nick Cox" <>
To   <>
Subject   RE: st: Validity of R Square with -nl- Regressions
Date   Fri, 20 Jun 2008 13:24:23 +0100

Funny. Maarten sees this definition as "obvious", and I do understand

I was brought up an old-fashioned way with lots of correlation before
regression and still tend to see the definition of R-square as the
square of the correlation between observed and fitted as the "obvious"

No doubt there are now people who see a definition in terms of
likelihood results as the "obvious" one. 


Maarten buis

--- "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:

*   For searches and help try:

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