Announcement

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

  • Generating flags for jump within certain interval (period)

    Hi all,


    I have a very broad question, related to estimation method to implement in Stata.
    I would like to generate flag variables (of irregular jumps) based on interval [t-1; t+1].
    For example, if there is a firm that recorded wage as: 1000 at t, 20 at t+1, and 1100 at t+2.
    When looking only wage at t and t+2, the difference is not significant to flag, but we observe that there was a jump due to sudden decrease in t+1.
    Like this example, would there be any reference command/code or method to implement in stata?

    Thanks a lot in advance!



  • #2
    xtset id time
    g dX = abs(ln(X) - ln(l.X))
    g flagX = dX > whateveryouthinkisbig

    Comment


    • #3
      George Ford Thanks a lot.
      I may maybe not fully understood the code - isn't it only looking for t and t-1, instead of t-1 to t+1 ?

      Comment


      • #4
        g dX = abs(ln(f.X) - ln(l.X))

        the dX would locate at t+1.

        to move the location:

        g dX = abs(ln(X) - ln(l2.X))
        g dX = abs(ln(f2.X) - ln(X))

        Comment

        Working...
        X