Announcement

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

  • Issue with CSDID command

    Hi, I am having a problem with the csdid command, it will work for years but not for age:

    My dataset:
    id year age treatment_age treatment_year Outcome
    5 1989 43 0
    5 1991 45 53 1999 0
    5 1993 47 53 1999 0
    5 1995 49 53 1999 0
    5 1997 51 53 1999 0
    5 1999 53 53 1999 1
    5 2001 55 53 1999 0
    5 2003 57 53 1999 0
    6 1989 42 1
    6 1991 44 50 1997 0
    6 1993 46 50 1997 1
    6 1995 48 50 1997 0
    6 1997 50 50 1997 1
    6 1999 52 50 1997 1
    6 2001 54 50 1997 1
    6 2003 56 50 1997 0
    Option 1: By year:
    Code:
    csdid Outcome if id == 5 | id == 6, [ivar(id)] time(year) gvar(treatment_year) agg(event)
    Outcome:
    Code:
    No never treated observations found. Using Not yet treated data
    ...xxxxxxxxx
    Difference-in-difference with Multiple Time Periods
    
                                                    Number of obs     =          8
    Outcome model  : regression adjustment
    Treatment model: none
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         Pre_avg |          0  (omitted)
        Post_avg |          1          .        .       .            .           .
             Tm4 |          1          .        .       .            .           .
             Tm2 |         -1          .        .       .            .           .
             Tp0 |          1          .        .       .            .           .
    ------------------------------------------------------------------------------
    Control: Not yet Treated

    Option 2: By age:
    Code:
    csdid Outcome if id == 5 | id == 6, [ivar(id)] time(age) gvar(treatment_age) agg(event)
    Outcome:
    Code:
    No never treated observations found. Using Not yet treated data
    xxxxxxxxxxxxxxxxxxxxxxxxxx                  mean():  3301  subscript invalid
                     aggte():     -  function returned error
                  makerif2():     -  function returned error
                     <istmt>:     -  function returned error
    Surely, I should be getting the same result, irrespective of whether I use age or year in this example. I need to run it by year for my dataset but it always drops all the observations and errors.

    All help is greatly appreciated, many thanks in advance!

  • #2
    Why would you declare year as your time series variable

    Comment


    • #3
      Because the command doesn't appear to work with age

      Comment


      • #4
        The problem is that Year is common to all, Age is not
        Specifically, there are only odd numbers in years . But you have odd and even numbers in age. So , because of that, CSDID is trying to work with a "delta" of 1 instead of 2.
        F

        Comment


        • #5
          FernandoRios thank you so much! this is a very helpful answer and I have fixed the issue with this knowledge! much appreciated!

          Comment


          • #6
            many thanks again, I had a very quick follow up question FernandoRios . If I am using bi-annual data like this, with forced bi-annualised ages. (so age=37 or 38, is new_age=38, etc) I am getting delta of Tp1, Tp2, Tp3 etc in the csdid output, does this delta now reflect 2 year periods or 1 year? and if it is 1 year, how can it be calculating this using bi-annual data?

            Comment


            • #7
              solved it, my treatment variable wasn't bi-annualised

              Comment

              Working...
              X