Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: RE: coefficients constraint in nlsur and nl does not work
From
"Brian P. Poi" <[email protected]>
To
<[email protected]>
To
[email protected]
Subject
RE: st: RE: coefficients constraint in nlsur and nl does not work
Date
Thu, 18 Nov 2010 20:18:09 -0500
Dear all,
May I ask a question about non linear least square estimations.
I am trying to estimate following NLS with coefficient constraint:
nlsur( y1 =(A)*({bg: $sita_pc}+{mc})/({mc}-{ef: $s_pc2}+{bg:
$sita_pc})) (y2 = {ef: $s_pc2}/({bg: $sita_pc}+{mc}))
...
From: [email protected]
[mailto:[email protected]] On Behalf Of Brian P. Poi
Sent: Wednesday, November 17, 2010 9:07 PM
> --------------
>
> Mariko,
>
> When you specify a linear combination with -nlsur-, you should only
> specify the variables once. To refer to the linear combination again
> in your function, you specify just the name and colon, not the
> variables that go along with it. I think your syntax should be
>
> . nlsur (y1 =(A)*({bg: $sita_pc}+{mc})/({mc}-{ef: $s_pc2} + {bg:}))
> ///
> (y2 = {ef:}/({bg:}+{mc}))
>
>
> (Arguably -nlsur- should probably exit with an error if you try and
> define a linear combination twice, but it didn't in your case.)
>
>
From: [email protected]
[mailto:[email protected]] On Behalf Of ?????
Sent: Wednesday, November 17, 2010 9:43 PM
Dear Mr.Poi,
Thank you for your kind guidance.
I did try it again according to your suggestion, then Stat says "too few
variables specified".
But , is it in this case? I could not understand.
Mariko
-------------------------------------
Mariko (et al.),
I completely misspoke yesterday. -gmm- allows you to refer back to
previously declared linear combinations like I described (see p. 582 of [R]
gmm), but -nlsur- (and -nl-) do not have this capability. For the latter
two commands, the only way to refer back to a linear combination is to
specify each of the parameters individually, like this:
. sysuse auto
. nlsur (mpg = {xb:gear_ratio turn} + {c}) ///
(head = {xb_gear_ratio}*gear_ratio + {xb_turn}*turn + {d})
Page 1183 of [R] nl discusses how parameters are named in linear
combinations.
In your original example, you had used global macros to store the variable
lists in the linear combinations. There is no easy way to refer back to the
linear combination without explicitly using the variable names rather than a
global macro holding them.
Sorry for the confusion.
-- Brian Poi
-- [email protected]
*
* 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/