Announcement

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

  • Interpretation of Bacon Decomposition Graph - bacondecomp

    I'm using the command
    Code:
    bacondecomp
    available via ssc install and trying to follow the discussion here: Bacon decomposition | DiD (asjadnaqvi.github.io).

    However, the command seems to have changed in a way that I either don't understand or is incorrect. Consider the following setup:
    Code:
    clear
    local units = 3
    local start = 1
    local end   = 10
    
    local time = `end' - `start' + 1
    local obsv = `units' * `time'
    set obs `obsv'
    
    egen id       = seq(), b(`time')  
    egen t        = seq(), f(`start') t(`end')     
    
    sort  id t
    xtset id t
    
    lab var id "Panel variable"
    lab var t  "Time  variable"
    
    gen D = 0
    replace D = 1 if id==2 & t>=5
    replace D = 1 if id==3 & t>=8
    lab var D "Treated"
    
    gen Y = 0
    replace Y = D * 2 if id==2 & t>=5
    replace Y = D * 4 if id==3 & t>=8
    
    lab var Y "Outcome variable"
    
    gsort id t
    twoway ///
        (connected Y t if id==1) ///
        (connected Y t if id==2) ///
        (connected Y t if id==3) ///
            ,    ///
            xline(4.5 7.5) ///
            xlabel(1(1)10) ///
            legend(pos(6) order(1 "id=1 (never treated)" 2 "id=2 (early treated)" ///
                3 "id=3 (late treated)")) name(raw, replace)
    which gives the following graph:
    Click image for larger version

Name:	image_34627.png
Views:	2
Size:	68.1 KB
ID:	1751538
    Running the command
    Code:
    bacondecomp Y D, ddetail gropt(title("Detail") name(detail, replace) legend(pos(6)))
    gives the following figure:
    Click image for larger version

Name:	bd.PNG
Views:	1
Size:	53.9 KB
ID:	1751539
    and the following table:

    HTML Code:
    +---------------------------------------------------+
    Beta   TotalWeight 
    ----------------------+----------------------------
    Early_v_Late             2   .1818181841 
    Late_v_Early             4   .1363636317 
    Never_v_timing   2.933333323   .6818181841 
    +---------------------------------------------------+

    I (think) I understand the points themselves, but the labeling confuses me.
    1. The top left circle is the 2X2 estimate from the late treated v. early control (point estimate: 4, weight: .136)
    2. The bottom left triangle is the 2X2 estimate from the early treated v. late control (point estimate: 2, weight: .18)
    3. The top right x is the 2X2 estimate from the late treated v. never treated (point estimate: 4)
    4. The bottom right x is the early treated v. never treated (point estimate: 2)
      • The combined weight of (3) and (4) is .68.
    My questions:
    1. Is the above interpretation correct?
    2. If so, the legend doesn't seem to correspond to what is shown in the figure. I.e., I would think the bottom left triangle should be a circle and the two x's should be triangles.
    3. What is "within" supposed to represent?
    Attached Files

  • #2
    As a follow up to the above, dropping the "ddetail" option gives the following:
    Click image for larger version

Name:	baseline.PNG
Views:	1
Size:	58.8 KB
ID:	1751653

    where the left panel is without the "ddetail" option and and right panel is with it (i.e., same as in the original post). Here, things seem perfectly in-line with my expectations.
    • The two triangles represent the late treated v. never treated (top) and early treated v. never treated (bottom).
    • The circle is the weighted average of the two timing groups.
    The "ddetail" option splits this into two points, but (I think) then mislabels some of the points. Just posting in case (1) someone else runs into the same issue, and/or (2) someone can confirm that there is an error in "detail" option for the -bacondecomp- command or point to where I'm making a mistake.

    Comment


    • #3
      In case anyone runs into this issue in the future, you can instead use -estat bdecomp- after -xtdidregress-, which gives the correctly labeled decomposition. Specifically,
      Code:
      xtdidregress (Y) (D), group(id) time(t)
      estat bdecomp, graph
      produces the following figure:
      Click image for larger version

Name:	bdecomp.PNG
Views:	1
Size:	59.6 KB
ID:	1751832

      Comment


      • #4
        Hi David! I ran into the same issue. All units in my dataset are treated eventually, but I want to use Bacon Decompose to see the weight. I was expecting to see early vs late, then late vs. early. But this Stata package bacondecomp only has "timing group". I search around and find this ddtiming command from Thomas, this is what i want!

        Goldring, T. (2019). ddtiming: Stata module to perform a Goodman-Bacon decomposition of difference-in-differences estimation. https://github.com/tgoldring/ddtiming

        net get ddtiming, from(https://raw.githubusercontent.com/tg...dtiming/master)

        Hope this help!

        Comment

        Working...
        X