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

 From "Joseph Coveney" To Subject st: Re: computation of R-squared with a non-linear model Date Wed, 20 May 2009 22:32:18 +0900

```marcel spijkerman wrote:

I estimate a weighted non-linear model of the following form:

y^0.5 = (a1 + a2*X)^0.5 weighted by some other variable z.

Stata reports an adjusted R-squared of 1.000. I suspect this is not correct. How
can compute the correct adjusted R-squared using untransformed variables?

--------------------------------------------------------------------------------

I'm afraid that you've lost me, here:  by "untransformed variables", do you mean
without square-root transformations of the response variable and predictor
expression?  If so, then, after untransforming both sides, wouldn't it be:

regress y X [aweight=z]

Joseph Coveney

clear *
set more off
set obs 500
set seed `=date("2009-05-20", "YMD")'
generate double y = runiform()
generate double X = runiform()
generate double hhd1564_06 = runiform()

generate double sqrt_y = sqrt(y)
nl (sqrt_y = ({a1} + {a2} * X)^0.5) [aweight=hhd1564_06]

clonevar z = hhd1564_06
regress y X [aweight=z]

nl (y = abs({a1} + {a2} * X)) [aweight=hhd1564_06] // abs() redundant, actually

exit

*
*   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/
```