Announcement

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

  • constraining parameters in the nlsur command

    Hello!

    I am trying to estimate a Linear expenditure system with the nlsur command. I want to have a constraint on the beta-parameters so they sum to 1. With 2 parameters I do it like in the code but I don't know how to do it when I add another equation Y4 that will estimate b2, b3 and b4 with the constraint: b2+b3+b4 = 1
    With two parameters I do like this:
    Code:
     . nlsur (Y2=P2*{g2}+{b2}*(M-P3*{g3})) (Y3=P3*{g3}+(1-{b2})*(M-P2*{g2}))
    How do I constrain with more than 2 parameters? b2+b3+b4 = 1
    ​​​​​​​
    Code:
     . nlsur (Y2=P2*{g2}+{b2}*(M-(P3*{g3}+P4*{g4}))) (Y3=P3*{g3}+{b3}*(M-(P2*{g2}+P4*{g4}))) (Y4=P4*{g4}+{b4}*(M-(P3*{g3}+P2*{g2})))
    Thank you in advance!

  • #2
    I did not quite understand the details of your post, and somebody might come back with a better answer.

    But the general way to impose a single constraint such as b2+b3+b4 = 1 is to express one parameter in terms of the others, and to always use this expression in the place of the said parameter.

    E.g., if you have b2+b3+b4 = 1, you use b2 and b3 as usual, but then you substitute (1 - b2 - b3) everywhere in the place of b4.

    Comment


    • #3
      Thank you for the help!

      Oh it actually worked when you have more than two parameters aswell, perfect!
      Do you know if there is a way to impose another constraint that doesn't allow the parameters to take negative values since they are supposed to represent a share?

      Comment


      • #4
        For imposing inequality constraints, you can look up this FAQ here:

        https://www.stata.com/support/faqs/s...l-constraints/

        Comment

        Working...
        X