Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • About constrained linear regression

    I want to do a linear regression y = ax1+bx2+cx3+dx4+e, while a+b+c+d=1 and a,b,c,d>0. I have tried to use "nl (y = exp({lna})*x1 + exp({lnb})*x2+ exp({lnc})*x3+ exp({lnd})*x4+{e}),nolog" to keep a,b,c,d positive. But how can I correctly add the constraint a+b+c+d=1 into this regression? Can anyone help?
    Thank you very much.

  • #2
    Welcome to Statalist.

    Since I'm not a user of the nl command, I'm reluctant to hazard a recommendation, but since it's been a while with no suggestions, perhaps the following naive idea will elicit (much laughter and) a knowledgeable answer.

    Given the constraint a+b+c+d=1, can you then somehow utilize the identity d = 1-a-b-c to incorporate this constraint into the model on your nl command by expressing {lnd} in terms of the other parameters?

    Added in edit: Aha. Within Stata I reviewed the output of search inequality and while there is much to look at, I followed the link to the 4/15 FAQ on fitting a linear regression with interval constraints. The sixth example discusses fitting a model where the parameters are proportions, which exactly describes your situation. Take a look at it.
    Last edited by William Lisowski; 13 Jun 2017, 09:26.

    Comment


    • #3
      Originally posted by William Lisowski View Post
      Welcome to Statalist.

      Since I'm not a user of the nl command, I'm reluctant to hazard a recommendation, but since it's been a while with no suggestions, perhaps the following naive idea will elicit (much laughter and) a knowledgeable answer.

      Given the constraint a+b+c+d=1, can you then somehow utilize the identity d = 1-a-b-c to incorporate this constraint into the model on your nl command by expressing {lnd} in terms of the other parameters?

      Added in edit: Aha. Within Stata I reviewed the output of search inequality and while there is much to look at, I followed the link to the 4/15 FAQ on fitting a linear regression with interval constraints. The sixth example discusses fitting a model where the parameters are proportions, which exactly describes your situation. Take a look at it.
      Thank you very much for your help! The example is really useful and I have worked out this problem XD

      Comment

      Working...
      X