Dear Rodrigo,
What a beautiful job! Yes, your program runs perfectly in Stata 8.2.
Thank you so much for your suggestion to the website as well as your
valauble time in revising the codes. I highly appreciate it.
I would like to ask you, Nick, and others a related question. I have
the syetm of equations as follows:
a*ln(x) +b*sin(y)=1
a*ln(b*x) + b*y**3 = 3
where a, b are the two variables in the data:
id a b
1 1.5 3
2 2 5.1
3 3.5 7
Now, I would like to find x and y for each individual. One way I can
do is change the values of a and b within the program. However, it
may have more elegant way of doing it. It would be great if you could
give me some suggestion.
Thanks so much and Have A Wonderful day!
Sincerely yours,
Quang
On 2/7/07, Rodrigo A. Alfaro <ralfaro76@hotmail.com> wrote:
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/
*
* 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/