This is (I hope) an equivalent code for the version 8.
There are more examples typing -help nl- and in the manuals.
Rodrigo.
/**************** Old *************************/
program define nlfaq2
if "`1'" == "?" { /* if query call ... */
global S_1 "A B C" /* identify parameters */
global A=1 /* and initialize */
global B=1 /* them */
global C=1
exit
}
/* otherwise, calculate function */
replace `1' = exp($A) + $B*$C - 2 in 1
replace `1' = $A/$B + $C^2 - log($B) in 2
replace `1' = $A/($A+$B+$C) - sin($C) in 3
end
clear
set obs 3
gen y=0
replace y=1 in 1
nl faq2 y
/**************** Old *************************/
----- Original Message -----
From: "Quang Nguyen" <quangn@gmail.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, February 07, 2007 10:13 PM
Subject: Re: st: RE: How to solve a system of nonlinear inequalities in
Stata
Dear Nick,
Your suggestion is exactly what I need. Yes, the program works perfect
in Stata 9.
Thanks again and Have A Wonderful Day!
Sincerely yours,
Quang
On 2/7/07, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> -nl- changed in Stata 9 and the FAQ reflects that change.
> So, you will need to get the equivalent Stata 8 code from
> somewhere.
>
> The Statalist FAQ advises signalling if you are using
> an out-of-date Stata; otherwise you may get advice you
> cannot follow up. For example, my comment about Mata
> in this thread does not apply to you until you upgrade.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Quang Nguyen
>
> > Thanks to Rodrigo I found a very nice discussion on how Stata can be
> > used to solve a nonlinear equation system, I replicated the example
> > using Stata version 8. Howver, there was a nerror message when I run
> > the following command:
> >
> > nl faq @ y, parameters(A B C) initial(A 1 B 1 C 1)
> >
> > I look at help for nl in stata, and change the command to:
> >
> > nl faq y, parameters(A B C) initial(A 1 B 1 C 1)
> >
> > There is a message: "option at() required, nlfaq refused
> > query, rc=198"
>
> *
> * 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/
>
*
* 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/
*
* 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/