Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: How is the R2 for nonlinear least squares obtained? |

Date |
Tue, 5 Jun 2012 13:22:36 -0700 |

The formula is no different from the linear case - all you need are the response variable and the model residuals: ************************************************ webuse production, clear nl (lnoutput = {b0} - 1/{rho=1}*ln({delta=0.5}*capital^(-1*{rho}) /// + (1-{delta})*labor^(-1*{rho}))) predict e, resid mat accum mA = lnoutput e, nocons dev di "R-squared: " 1-mA[2,2]/mA[1,1] ************************************************ You can work out the algebra for whether the expression you give is equivalent - my guess is, it is. T On Tue, Jun 5, 2012 at 1:08 PM, Zoe Kuehn <zoe.kuehn@gmail.com> wrote: > Hi > I am using STATA's nl command for estimating a nonlinear CES function. But > the R2 that STATA reports does not correspond to the R2 I calculate when > transferring the data to excel. However, it turns out to be exactly equal > to a measure called "Cos^2", i.e. the square of the cosine of the angle > between Y and its predictor (Cos^2=(sum(y*y_hat)^2/(sum(y^2)*sum(y_hat^2)). > Does somebody know if that is mere coicidence, or if this is the way STATA > calculates the R2 for Nonlinear least squares? If this is the way STATA > calculates the R2 for the nl command does anybody know the reason for it? > Thank you! > Best > Zoe > > * > * 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/ -- Tirthankar Chakravarty tchakravarty@ucsd.edu tirthankar.chakravarty@gmail.com * * 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: How is the R2 for nonlinear least squares obtained?***From:*Zoe Kuehn <zoe.kuehn@gmail.com>

- Prev by Date:
**st: Job posting - Empirical Research Librarian - Yale Law School** - Next by Date:
**Re: st: nldecompose and svy subpopulation** - Previous by thread:
**st: How is the R2 for nonlinear least squares obtained?** - Next by thread:
**st: keep only one observation** - Index(es):