Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[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" <>
To   <>
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}))


[] 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.)

[] 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 (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

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

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index