Announcement

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

  • Constraining slope in regression

    Hi I'm a beginner in state. I'm trying to run the following regression regress logy logI logh logL, but I would like to constrain the slope of logh to be one. Can someone tell me the command for this? Thanks!

  • #2
    Two ways:

    1. Through constrained regression (cnsreg):
    Code:
    constraint 1 logh = 1
    cnsreg logy logl logh logL, c(1)
    2. Adjusting the equation and transform the data.

    Your model is \(logy = \beta_0 + \beta_1 logl + \beta_2 logh + \beta_3 logL + \epsilon\), and you want to constrain \(\beta_2 = 1\). This means that the constrained model is \(logy = \beta_0 + \beta_1 logl + logh + \beta_3 logL + \epsilon\), which is equivalent to

    \(logy - logh = \beta_0 + \beta_1 logl + \beta_3 logL + \epsilon\)

    Code:
    g lyd = logy - logh
    regress lyd logl logL
    Alfonso Sanchez-Penalver

    Comment


    • #3
      Thanks AlfiSan! I've tried both methods and they both worked well. Using cnsreg, is it possible to constrain the sum of the coefficients on logI and log L to be equal to 1?

      Comment


      • #4
        I figured it out. Using constraint 2 logIL+ logHL=1 , together with your method 2 2. Adjusting the equation and transform the data. I manage to get the results!

        Comment


        • #5
          I'm now running
          . constraint 3 logIL + logHL < 1

          . cnsreg logYL logIL logHL date, c(3)
          (note: constraint number 3 caused error r(111))
          matrix e(Cns) not found
          r(111);


          where logIL=logI-logL, logYL=logY-LogL, logHL=logH-logL, but Stata says there is an error, can I check if the constraint constraint 3 logIL + logHL < 1 is correctly defined? Thanks!

          Comment


          • #6
            Check the following: http://www.stata.com/support/faqs/st...l-constraints/
            Alfonso Sanchez-Penalver

            Comment


            • #7
              This was cross-posted at http://stats.stackexchange.com/quest...training-slope That's allowed, but as the Advice in the FAQ explains, you are asked to be explicit about cross-posting. People don't want to spend time answering if the question has been answered elsewhere.

              Comment


              • #8
                Thanks again AlfiSan! That solves all the problem.

                Sure Nick, I'll remember next time. Sorry about that.

                Comment

                Working...
                X