Announcement

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

  • why do xtabond and xtabond2 produce different results?

    Dear Statalisters,

    I was trying to use the Stata command xtabond2 to replicate the results from xtabond. But I got different results although the difference is small. anyone have a clue? really appreciated!

    Below is the syntax i used:

    xtabond z_score, nocons lags(1) maxldep(3) vce(robust)

    xtabond2 z_score L.z_score, gmmstyle(z_score, laglimits(2 4)) robust noleveleq

    Are the above two syntaxes supposed to give the same results? I also attached the data for the two syntaxes.

    Anyone have a clue? Many thanks!

    Jian Zhang
    Attached Files

  • #2
    anyone can help? Many thanks!

    Comment


    • #3
      I can replicate your problem. The reason is a different treatment of missing observations, in particular time series' with gaps, between the two commands. If you exclude all students without consecutive observations, you will obtain identical results:

      Code:
      gen c = .
      by student_id: replace c = cond(L.c == ., 1, L.c + 1)
      by student_id: egen mc = max(c)
      by student_id: egen cz = count(z_score)
      gen touse = (mc == cz)
      
      xtabond z_score if touse, nocons lags(1) maxldep(3) vce(robust)
      xtabond2 z_score L.z_score if touse, gmmstyle(z_score, laglimits(2 4)) robust noleveleq
      I was not able to figure out what exactly is done differently by the two commands. If anybody else can provide further insights I would be happy to learn about it.

      The procedure to identify gaps builds on a Stata FAQ answer by Nick Cox and Vince Wiggins.
      https://www.kripfganz.de/stata/

      Comment


      • #4
        Thanks, Sebastian! your reply really helps. You are right that the difference in results is due to the fact that xtabond and xtabond2 treat observations with gaps differently!

        One speculation is that xtabond treats a time series with a gap as two time series for seperate individuals while xtabond2 does not. I tested this speculation. but it turns out not the case. so still don't know why.

        Thanks!

        Comment

        Working...
        X