[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Daniel Schneider" <daniel.schneider@stanford.edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Nonlinear regression and constraints |

Date |
Tue, 28 Jun 2005 23:49:18 -0700 |

> -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of > Richard Williams > Sent: Tuesday, June 28, 2005 11:23 PM > To: statalist@hsphsun2.harvard.edu > Subject: RE: st: Nonlinear regression and constraints > > > At 10:43 PM 6/28/2005 -0700, Daniel Schneider wrote: > >That might be possible. Let me clarify what I want to do: I want to > >find the best (i.e. with the lowest SS) parameter values which are > >between 0 and 1 (including both), because by definition they > can only > >be between those two values. > > I wonder what happens to your theory/definitions if both > estimated values > are significantly greater than 1! (Has a miracle occurred?) > But suppose > they are - can you then just impose the constraint that both > parameters > equal 1? Maybe there is some cheating here, but if a > parameter is out of > range you could constrain it to be in range. Without going to much into detail: my parameters are percentages. They can only range from 0 to 1. There may be a better solution (i.e. a solution that better fits the data) beyond 1, BUT, as I said, by definition they cannot be above 1 (or below 0). So the best solution that is possible has to be between 0 and 1. My current model gives me values which are both below 0 (I changed the equation a little bit, corrected a minor error, but that doesn't matter for the problem). The problem is that I cannot constrain the parameter at all in -nl- (or, at least I don't know how). I tried -cnsreg- as an alternative, but in that case I need an additional constraint which turns my model into a nonlinear model (because it really is nonlinear, and forcing it to be not non-linear would probably just produce results that are even worse). > > > Also, my impression is that -nl- doesn't need the > constraints option > > > because constraints can be specified using the -nl- > command itself. > > > >Can you tell me how that can be done? > > The Stata 9 Reference Manual entry for -nl- has an example on pp. > 297-298. Simplifying it a bit, the following will cause the > effects of the > 3 RHS vars to be equal: > > . sysuse auto > . nl (mpg = {b0} + {b1}*price + {b1}*weight + {b1}*displacement) > > The reference manual basically says that this can save you > some typing over > doing the same thing in cnsreg. But, I also notice that -nl- > gives you an > R^2 stat, which was the request made in another thread today. Yes it does (in my case this is a nice feature, because I can extend my model and see if additional non-linearity can produce even better results). The approach you showed is basically something I already did in my equation (this is slightly different than in my previous email, but the concept remains the same): nl (diff_diff = {alpha}*X1MX1SQDIVX3 - {beta}*X2MX2SQDIVX3 + ({alpha}+{beta})*X1X2DIVX3) As you can see, I used alpha and beta twice. I could have used gamma instead of alpha+beta and then tried to impose a restriction that it should be equal to alpha+beta (that is what I am doing in -cnsreg-). I just got a new idea, I might try a two-step solution, I can reformulate my equation and start estimating one parameter and then using the result to estimate a second one... I'll give that a try. Thanks! Daniel Schneider * * 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/

**Follow-Ups**:**RE: st: Nonlinear regression and constraints***From:*"Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk>

**Re: st: Nonlinear regression and constraints***From:*"Erik Ø. Sørensen" <sameos@gmail.com>

**RE: st: Nonlinear regression and constraints***From:*Richard Williams <Richard.A.Williams.5@ND.edu>

**References**:**RE: st: Nonlinear regression and constraints***From:*Richard Williams <Richard.A.Williams.5@ND.edu>

- Prev by Date:
**Re: st: re: constraints** - Next by Date:
**Re: st: re: constraints** - Previous by thread:
**RE: st: Nonlinear regression and constraints** - Next by thread:
**RE: st: Nonlinear regression and constraints** - Index(es):

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