Announcement

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

  • Triple Difference Parallel Trends Graph Generate Differences

    Hi all,

    The data:

    Code:
    input float(yearmonth treat_state count_month_state treat_occ) long id
    680 0 12387 0     493
    680 0 12387 0     496
    648 1  6552 1   37842
    648 0  6552 1   68297
    665 1 11667 0  200528
    676 0  9796 0  256276
    680 0 12387 0  496181
    676 1  9796 0  681437
    669 0  8433 1  688739
    657 0  8207 0  707497
    680 0 12387 0  709666
    678 1 11448 0  719384
    656 0 11036 0  804811
    672 0  8245 0  816226
    680 0 12387 1  890642
    673 1  7935 1  901675
    676 1  9796 1  903240
    667 0 13634 0  924489
    653 0  9321 0  931963
    665 0 11667 0  934059
    677 0 12275 1  934083
    645 0  5610 0  936798
    649 0  5169 0  984263
    format %tm yearmonth
    count_month_state was created by
    Code:
    bys yearmonth treat_state: egen count_month_state=count(id)

    I would like to run a triple difference, but first I would like to show parallel trends visually. One state is treated, and one occupation is treated. I would like to show, in a twoway line graph, the difference in "count_month_state" between occupations (i.e. the number of id in the treated occupation less the number of id in the untreated occupation) within the treated state and within the untreated state, for each month.

    So at the end of the day, what I would like is two lines on a graph. The y-axis should be the count; number of id. The x-axis should be time (yearmonth).

    The first line should show, for each month and for the treated state, the difference in the count of id between the treated occupation and the untreated occupation.

    The second line should show, for each month and for the untreated states, the difference in the count of id between the treated occupation and the untreated occupation.

    How can I generate those two variables, corresponding to the difference that I want to plot?

    Apologies if this is unclear or has been answered before.

    Please let me know if any additional information is needed or if I've have made a mistake up to here.
Working...
X