Announcement

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

  • IV regression with design weights and multiple fixed effects

    Hello everyone,

    I want to run an IV regression with several fixed effects (individual, time, region and region*time FE) and I have to incorporate the design weights of the survey data. xtivreg does not allow for weights so I was using xtivreg2. I tried the following code:

    xtivreg2 worktime (share = log_IV) i.syear i.region i.fe [pweight=phrf], fe (i.fe is a dummy for each pair of region*time FE)

    But I get the following error: "factor-variable operators not allowed".

    I tried to use ivreg2. I got the error: "maxvarr too small" so I set maxvar 120000. I ended up with this:

    ivreg2 worktime (share = log_IV) i.syear i.ror96 i.pid [pweight=phrf] if female==1 & immigrant==0

    But it takes forever and I haven't even included the double FE. Also, I need a command that can give clustered standard errors.

    Does someone know a more efficient way to do this? Thank you!




  • #2
    Install ivreghdfe from SSC and absorb the fixed effects.

    Code:
    ivreghdfe worktime (share = log_IV) i.ror96 [pweight=phrf], absorb(syear pid) cluster(pid)
    Last edited by Andrew Musau; 17 Apr 2023, 09:51.

    Comment


    • #3
      It works perfectly! Thank you so much.

      Comment

      Working...
      X