Announcement

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

  • 2SLS by hand


    Hello
    I have estimated a panel fixed effects with both countries and year fixed effects:
    xtreg y x1 x2 x3 x4 x5 temp01-temp20, robust fe
    My estimation model has two endogenous explanatory variables x1 and x2. I have a potential instrumental variable for x1 (namely z1) and an instrumental variable for x2 (namely z2) furthermore both instrumental variables are time invariant .
    I dont' find any commands in stata for my case (more than one endogenus variables, robust standard errors, fe).
    Can I apply 2SLS by hand, correcting robust standard errors?
    The commands I would use are the ones which follow:
    reg x1 z1 x3 x4 x5 temp01-temp20, robust
    predict ivx1,xb
    reg x2 z2 x3 x4 x5 temp01-temp20, robust
    predict ivz2,xb
    reg y ivz1 ivz2 x3 x4 x5 temp01-temp20, robust
    How can I correct robust standard errors?
    Thanks

  • #2
    xtivreg will allow more than one endogenous variable in the instrument equation.

    xtivreg y x3 x4 (x1 x2 = z1 z2),fe vce(cluster panelvariable)

    Comment


    • #3
      Thanks for replying but xtivreg can't be used if instrumental variables are time invariant. What's more, this command runs first stage regressions by using the whole set of instrumental variables for each endogenous variable (i.e. x1 stata uses both z1 and z2, as well as for x2).

      A

      Comment


      • #4
        1. Since you are estimating a panel data model
        Code:
        xtreg y x1 x2 x3 x4 x5 temp01-temp20, robust fe
        you are supposed to include individual fixed effects (`id') in the first stage as well
        Code:
        reg x1 z1 x3 x4 x5 temp01-temp20 i.id, robust
        2. I guess that the key problem here is whether, in a panel data setup, time-invariant (instrumental) variables are allowed (I am not sure but doubt).

        Ho-Chuan (River) Huang
        Stata 17.0, MP(4)

        Comment


        • #5
          I do not think time-invarint instruments can be used. They would be collinear to the fixed effect.

          Comment


          • #6
            I agree with you, dmaimone. That's why I wanted to replicate 2SLS by hand by using reg in Stata. My problem is the formula to correct the standard errors if I use the robust standard errors.

            Comment


            • #7
              I am not sure whether it is correct your approach. Said differently, you have a panel with an endogenous variable. Since the instrument is time invariant you want to use a Pooled model without taking into account the panel structure of your data and then you want to Plug in the fitted values into the regression.

              Honestly, i think you would fail to take into consideration the heterogeneity emanating from the panel structure. If i were your referee, i would question your approach.

              By the way​​​​, you can use standard reg command with group dummies and adapt what in this post for your needs:

              http://www.stata.com/support/faqs/st...rsive-systems/

              ​​​​

              Comment

              Working...
              X