Announcement

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

  • A New Way to Display Average Treatment Effects?

    I've estimated the point-wise ATT for the Basque Country and another for Andalusia (the latter of which didn't happen) for the purposes of illustrating the average treatment on the treated across multiple groups . Here's what my dataset looks like.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int year long id float(diff_ te_lb_ te_ub_) double cf_ float relative_
    1960  1  -.03438833  -.1953089  .12653224 2.0445282709435744 -20
    1961  1  -.02355658 -.18447715  .13736399  2.152734151655955 -19
    1962  1  -.02865201  -.1895726  .13226856 2.3090005505319513 -18
    1963  1 -.029744074 -.19066465   .1311765 2.4607638573767883 -17
    1964  1  -.02255038 -.18347095   .1383702  2.531405006316636 -16
    1965  1 -.016281521  -.1772021  .14463905 2.6009716155877136 -15
    1966  1 -.012197359 -.17311794  .14872321  2.706641776481846 -14
    1967  1  -.00843918 -.16935976   .1524814   2.81078135718358 -13
    1968  1 -.012932718  -.1738533  .14798786 3.0002934334955516 -12
    1969  1 -.015191527  -.1761121  .14572905 3.1942832194807482 -11
    1970  1  .004113104 -.15680747   .1650337 3.3502140978012553 -10
    1971  1   .02254521 -.13837537   .1834658  3.500376832481277  -9
    1972  1   .02206217 -.13885841  .18298274  3.734150540192131  -8
    1973  1   .02058131 -.14033926   .1815019  3.967136555935501  -7
    1974  1  .012615752 -.14830482  .17353633  4.039226459909138  -6
    1975  1  .005070791  -.1558498  .16599137  4.107111349418237  -5
    1976  1   .03186587 -.12905471  .19278644  4.189927782976761  -4
    1977  1   .05910615 -.10181443   .2200267 4.2725846410625605  -3
    1978  1   .03581214 -.12510844   .1967327   4.26938653047782  -2
    1979  1  -.00983881  -.1707594  .15108176  4.236774197482355  -1
    1980  1  -.02959487 -.19051544   .1313257  4.241106003603404   0
    1981  1  -.05222093  -.2131415  .10869964  4.259233584640373   1
    1982  1  -.10053212  -.2614527  .06038845  4.349603722266864   2
    1983  1  -.14992078 -.31084135 .010999796   4.44155152700323   3
    1984  1  -.22045125  -.3813718 -.05953068  4.579134367280071   4
    1985  1  -.29472983  -.4556504 -.13380925 4.7213221830604555   5
    1986  1    -.341294 -.50221455  -.1803734  5.004532966991204   6
    1987  1   -.3892474   -.550168 -.22832684  5.289918410403711   7
    1988  1  -.40747815  -.5683987  -.2465576  5.567075547713477   8
    1989  1   -.4245966 -.58551717 -.26367602  5.842334541980736   9
    1990  1   -.4141477 -.57506824  -.2532271  5.999409006395019  10
    1991  1   -.4092575 -.57017803  -.2483369 6.1584721080892875  11
    1992  1   -.3629807  -.5239012  -.2020601   6.00422603156893  12
    1993  1   -.3195795  -.4805001 -.15865897  5.854497843738046  13
    1994  1   -.3433214   -.504242 -.18240087  5.982138752008685  14
    1995  1  -.41416845 -.57508904  -.2532479  6.134891134169233  15
    1996  1   -.3180507  -.4789713 -.15713017  6.313980460249325  16
    1997  1   -.2487844 -.40970495 -.08786382  6.549769735773069  17
    1960 15   -.1361359  -.7142104   .4419386  4.422054139046871 -15
    1961 15  -.09119137  -.6692659   .4868831  4.665527428561242 -14
    1962 15 -.026339626  -.6044141  .55173486  4.925296877692761 -13
    1963 15  .014555896  -.5635186   .5926304  5.182458913027126 -12
    1964 15   .07142166 -.50665283   .6494961  5.267481288239015 -11
    1965 15   .11950126 -.45857325   .6975757  5.345651964822774 -10
    1966 15   .08382984  -.4942447   .6619043  5.462085760088053  -9
    1967 15   .03725883 -.54081565   .6153333 5.5776369881723316  -8
    1968 15   .04723979 -.53083473   .6253143 5.8049449794814745  -7
    1969 15   .04291496  -.5351595   .6209894  6.038490677286827  -6
    1970 15  -.00709794  -.5851725  .57097656  6.177191953223654  -5
    1971 15  -.03991004  -.6179845  .53816444  6.323543277520671  -4
    1972 15   -.0608741  -.6389486   .5172004   6.61642944086748  -3
    1973 15  -.09864798  -.6767225   .4794265   6.90941658719623  -2
    1974 15   .04347473  -.5345998   .6215492  7.061709349102103  -1
    1975 15   .16644862  -.4116259   .7445231  7.211442921989745   0
    1976 15   -.0929816  -.6710561   .4850929  7.325915119847453   1
    1977 15   -.3465292  -.9246036  .23154534 7.4363605072640775   2
    1978 15   -.6934847  -1.271559 -.11541016   7.48018825423434   3
    1979 15   -.8602158 -1.4382904 -.28214133   7.50003309434947   4
    1980 15   -.9643064 -1.5423808  -.3862318 7.5271453587430734   5
    1981 15  -1.0710608 -1.6491352  -.4929863  7.571846100095137   6
    1982 15  -1.1520205  -1.730095 -.57394594  7.697079224126143   7
    1983 15  -1.2361194  -1.814194  -.6580449  7.831449129410646   8
    1984 15  -1.1913496  -1.769424  -.6132751 7.9528461667912405   9
    1985 15  -1.1498976  -1.727972 -.57182306  8.087058106196034  10
    1986 15  -1.1970768 -1.7751513  -.6190023   8.52926783026902  11
    1987 15  -1.2348768 -1.8129512  -.6568022  8.977665011650162  12
    1988 15  -1.3049086  -1.882983  -.7268341  9.425445391362693  13
    1989 15   -1.367151 -1.9452256  -.7890766  9.876862435179984  14
    1990 15  -1.3596275  -1.937702   -.781553 10.136405666181908  15
    1991 15   -1.359423 -1.9374976  -.7813486 10.384702174920811  16
    1992 15   -1.347874 -1.9259485  -.7697995 10.221766774682099  17
    1993 15   -1.334955 -1.9130293  -.7568803 10.053178433600873  18
    1994 15  -1.3563832 -1.9344577  -.7783087 10.374521162184223  19
    1995 15  -1.2040167  -1.782091  -.6259422 10.644890728379988  20
    1996 15  -1.2256745  -1.803749     -.6476 10.912192190982854  21
    1997 15  -1.1741419 -1.7522163  -.5960674 11.344807658953208  22
    end
    format %ty year
    label values id regionname
    label def regionname 1 "Andalucia", modify
    label def regionname 15 "Pais Vasco", modify
    
    
    preserve
    
    *gcollapse (mean) diff_ te_lb_ te_ub_ if rel > 0, by(id)
    
    decode id, gen(id2)
    
    
    meta set diff_ te_lb_ te_ub_ if rel > = 0, studylabel(id2)
    cls
    meta forestplot, olabel(ATT) ///
      nometashow noohet noohom noosigtest ///
      nogmark nullrefline(lcolor(lime) lpat(dash))
    
    restore
    I figured a nice way to do this would be to take advantage of the meta-analysis feature Stata has, which would allow me to treat each unit as a separate "study" (which arguably it sort of is), and present an average of all the individual ATTs, relative to when each unit's treatment began. I decided a forest plot would be a decent approach for the problem.

    Running the code above, we get a forest plot which displays each of the pointwise treatment effects post-treatment. My only issue here is that suppose I had another treated unit, or more time periods- we can quickly see how such a graph would become unwieldy and difficult to see. My question is, is there a way to do the exact same thing I'm doing here, but collapse the effect size down to one average effect size per study, plotting those effets along with the overall effect size? I'd even be okay with suppressing the list of "studies" entirely and only plot the average effect as well as its confidence intervals.

    If meta-analysis isn't the solution for this problem, perhaps the user-written coefplot would be a viable alternative, where I'd manually calculate the ATT and put the averages and CIs into a matrix?

  • #2
    Found it! I used a combination of meta-analysis and the user written coefplot. New way to present ATTs I guess, especially when we've multiple units.
    Code:
    qui meta set diff_ te_lb_ te_ub_, studylabel(id2)
    
    cls
    
    qui meta summ, random subgroup(id2)
    
    mat A = r(esgroup)
    
    qui levelsof id2, l(names)
    
    mat rownames A = `names' Overall
    
    mat Z = A'
    
    mat rownames Z = ES err LB UB
    
    coefplot (matrix(Z[1])), ci((Z[3] Z[4])) ///
        xli(0, lpat(dash) lcol(red) lwidth(thick)) ///
        scheme(`scheme') ///
        ti("Stacked SCUL") ///
        caption("ATT removes previously treated units.""ATT is calculated via random-effects meta-analysis.")

    Comment

    Working...
    X