Announcement

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

  • Placebo Tests for Synthetic Control Method.

    Hello everyone,

    I am running the synthetic control method on Stata 13 using the codes provided by the authors (website: http://web.stanford.edu/~jhain/synthpage.html) and the help synth command in Stata. I am however unable to perform the placebo tests for the study.

    I have used the following code to run a loop for Abadie et al.'s dataset for their paper titled "Synthetic Control Methods for Comparative Case Studies: Estimating the Effect of California’s Tobacco Control Program", available on (http://web.stanford.edu/~jhain/Paper/ccs.pdf)

    Code:
     
     tempname resmat         forvalues i = 1/4 {         synth cigsale retprice cigsale(1988) cigsale(1980) cigsale(1975) , trunit(`i')  trperiod(1989) xperiod(1980(1)1988) keep(test`i')         matrix `resmat' = nullmat(`resmat') \ e(RMSPE)         local names `"`names' `"`i'"'"'         }         mat colnames `resmat' = "RMSPE"         mat rownames `resmat' = `names'         matlist `resmat' , row("Treated Unit")
    However, after running this loop, I am struggling to make the placebo graph as shown below. Could you please tell me how I might be able to run the placebo tests and produce the graph shown below? I believe this loop will produce synthetic controls for each unit, both treatment and control units and store the files. However, I am unsure on how to proceed after that.

    Click image for larger version

Name:	Placebo .jpg
Views:	1
Size:	120.8 KB
ID:	1303879

    I have tried to follow the steps mentioned in this post but with no success, http://www.stata.com/statalist/archi.../msg00540.html If I am required to combine the results file generated from these, could you please direct me on how to do so. As while trying to merge the files using the time variable it displays an error stating time variable is not unique.

    Any help would be extremely useful.

    Thank you,
    Mridula Duggal

  • #2
    Hi Mridula,

    this is how conducted the placebo analysis. The code is probably not the most efficient solution, but it should work.

    The steps are as follows:

    1. Loop through all units and store the results of synth via the keep option.

    Code:
    * load dataset
    
    use smoking, clear
    
    ** tsset
    
    tsset state year
    
    ** loop through units
    
    forval i=1/39{
    
    qui synth cigsale retprice cigsale(1988) cigsale(1980) cigsale(1975), ///
    xperiod(1980(1)1988) trunit(`i') trperiod(1989) keep(synth_`i', replace)
    }
    *
    2. Now I loop through all saved datasets and create the relevant variables (years and treatment effect). Furthermore, I drop missing observations.

    Code:
    forval i=1/39{
    
    use synth_`i', clear
    
    rename _time years
    
    gen tr_effect_`i' = _Y_treated - _Y_synthetic
    
    keep years tr_effect_`i'
    
    drop if missing(years)
    
    save synth_`i', replace
    }
    3. Now I load the first dataset and merge all the remaining datasets.

    Code:
    use synth_1, clear
    
    forval i=2/39{
    
    qui merge 1:1 years using synth_`i', nogenerate
    }
    4. Now the dataset should consist of 40 variables. One named "years" and 39 variables with the treatment effect of the respective unit. To plot these variables in one graph, I use a solution offered by Nicholas J. Cox (see http://www.stata.com/statalist/archi.../msg01370.html) to plot all the lines with one color. Then I add california (unit = 3) with a different color to the plot.

    Code:
    local lp
    
    forval i=1/39 {
       local lp `lp' line tr_effect_`i' years, lcolor(gs12) ||
    }
    *
    
    * create plot
    
    twoway `lp' || line tr_effect_3 years, ///
    lcolor(orange) legend(off) xline(1989, lpattern(dash))
    You might consider dropping some of the extreme outliers or adjusting the range of the y-axis.

    Comment


    • #3
      Dear Michael,

      Thank you so much for this, it has worked for me. Now to apply it to my own dataset.

      Mridula

      Comment


      • #4
        Dear Michael,

        Would it be possible for you to tell me how I might reduce the range of the y-axis? Alternatively how I might I be able to drop the extreme outliers?

        Thank you,
        Mridula

        Comment

        Working...
        X