Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: FW: RE: Nonlinear Least Squares Problem


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: FW: RE: Nonlinear Least Squares Problem
Date   Mon, 15 Sep 2003 15:11:00 +0100

Dale W. Larson
 
> I am a fairly new Stata user who is trying to do nonlinear 
> least squares.
> 
> I am using Version 7.
> 
> I successfully set up the problem by writing the nlfcn 
> program as a do-file.
> 
> When I try to run the regression, I get a message such as:
> 
>            . nl nonlinear averagem1  
> __000057 not found 
> could not restore sort order because variables were dropped 
> r(111);
> 
> I don't know what __000057 is.  It is not anything I have 
> deliberately created.
> 
> Each time I rerun the regression,  the thing "not found," 
> e.g., __000057 above,
> changes to a different number.
> 
> I have not "dropped" any variables from the data set.

Nick Cox 

> You are seeing references to temporary variable names. 

> The real problem is something wrong with your program 
> or with your call to -nl-. I suspect we need to 
> see your program code to say more. 

Dale sent the code to Statalist (but N.B. no attachments 
please on Statalist: see the FAQ!!!) 

program define nlnonlinear
version 7.0
use Workfile3
if "`1'"=="?" {
global S_1 "B1 B2"
global B1=.5
global B2=.5
exit
}
replace `1'= (rgdp1^$B1)*(rgdp2^$B2)
end
*End of program.  Ready to do nonliner regression.

I was able to get sensible results out of 
a relative of this by 

1 chopping the "use Workfile3" statement 
and doing the equivalent of that in Stata itself 

2 putting this program in -nlnonlinear.ado-. 

Nick 
n.j.cox@durham.ac.uk 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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