Announcement

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

  • Different results between ivreg2 and xtivreg2

    Hi, im trying to use instrumental regression with panel data.

    At first, I use xtivreg2:
    xtset firm year
    xtivreg2 y x1 (x2 = a b), fe robust

    Then, I try to replicate the results, with ivreg2
    ivreg2 y x1 (x2 = a b) i.firm i.year, robust
    ivreg2 y x1 (x2 = a b) i.year, cluster(firm) robust

    But both results are different from xtivreg2, fe
    3 results also have same number of observations, so no singleton is removed
    May I ask which function xtivreg2, fe exactly runs?

  • #2
    See FAQ Advice #12 on the requirement to identify community contributed commands. Here ivreg2 and xtivreg2 are both from SSC.

    But both results are different from xtivreg2, fe
    Yes, you are estimating different models. One has year fixed effects while the other does not.

    Comment


    • #3
      You will help us help you by following the FAQ on asking questions – provide Stata code in code delimiters, readable Stata output, and sample data using dataex. It would be nice for example in this case to be able to replicate your results or at least see what they really are.

      Regarding Andrew's helpful comments, let me just note that the fixed effects is controlling for the panel which is presented as the firm, not the year.

      Being able to replicate your problem is essential. Trying out what I think you did, I got the same results with both estimators.

      Code:
      use https://www.stata-press.com/data/r16/nlswork, clear
      xtset
      keep in 1/5000
      xtivreg ln_w age c.age#c.age not_smsa (tenure = union south), fe
      ivregress 2sls ln_w  c.age#c.age  not_smsa i.idcode (tenure = union south), 
      g agesq=age*age
      xtivreg2 ln_w age age agesq not_smsa (tenure = union south), fe
      xi  i.idcode
      ivreg2  ln_w age agesq   not_smsa _I* (tenure = union south),

      Comment

      Working...
      X