Announcement

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

  • Calculating F-statistic after constrained regression

    I have run this unconstrained regression
    *Model: lcost=ß_1+ß_2loutput+ ß_3plabor+ ß_4lcapital+ß_5lpfuel

    and would like to set the restriction : R = (0, 0, 1, 1, 1) to test hypothesis P labor + βP capital + βP fuel = 1
    I defined matrices for R and r
    Code:
    matrix R_c = (0,0,1,1,1)
    gen r=1
    I need to test the null hypothesis of homogeneity based on the F ratio formula using SSR for restricted and unrestricted regression (F-stat=(SSRrestr. − SSRunres./#r)/SSRunres /(n-k)) or based on multiplying the matrices of restriction and coefficients Rß to use the other formula to manually calculate F-stat

    How best to do this?
    I used this code below but apparently there is an error
    Code:
    reg lcost loutput lplabor lcapital lpfuel
    constraint 3 _b[lpfuel]=_b[lplabor]=_b[lcapital]=1
    
     cnsreg lcost loutput lplabor lcapital lpfuel, constraints(3)
    Last edited by Hend She; 31 Oct 2021, 14:25.

  • #2
    The problem is that you have used illegal syntax in your -constraint- command. You cannot have a series of coefficients separated by =. You can only specify a single equation at a time in defining a -constraint-

    Change your code to:
    Code:
    constraint 3 lpfuel = lplabor
    constraint 4 lplabor = lcapital
    
    cnsreg lcost loutput lplabor lcapital lpfuel, constraints(3 4)

    Comment


    • #3
      I see! Many thanks, then I have to incorporate the =1 in a separate constraint, so this should be, if I am not mistaken
      Code:
       constraint 3 lpfuel = 1
      constraint 4 lplabor = 1
      constraint 4 lcapital= 1
      But how to make sure as well that the ß1 & ß2 coefficients will be set to zero to fulfill the restriction matrix?
      Last edited by Hend She; 31 Oct 2021, 15:06.

      Comment


      • #4
        Closer, but not quite right.

        First, the constraints must appear on separate lines.
        Second, you cannot have two contraints both called 4.

        Finally, the best way to constrain the first two coefficients to zero (I forgot about that part in my earlier response) is to simply omit those variables from the model. So we have:

        Code:
        constraint 3 lpfuel = 1
        constraint 4 lplabor = 1
        constraint 5 lcapital = 1
        
        cnsreg lcost lplabor lcapital lpfuel, constraints(3 4 5) noconstant
        That said, I don't think this approach corresponds to your stated goal "to test hypothesis P labor + βP capital + βP fuel = 1." Testing that hypothesis does not correspond to that constraint at all. That hypothesis does not require that any of the coefficients take on a value of 1: it requires that the sum of those three coefficients be one. And neither does it entail constraining the other variables' coefficients (including the constant) to zero. So if your intent corresponds to this stated goal, the code would be very different:

        Code:
        constraint 3 lpfuel + lplabor + lcapital = 1
        
        cnsreg lcost loutput lpfuel lplabor lpcapital, constraint(3)

        So, you need to be clear on what it is you are trying to accomplish here, a test of a single hypothesis that the coefficients of labor, capital, and fuel sum to 1, or a composite hypothesis that all three of them are equal to 1 and that all others (including the constant term) are zero.

        Comment

        Working...
        X