Announcement

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

  • SCM with flexible treatment period

    Hello,

    I would like to run a SCM in a state-year panel using the synth command. In the basic setting synth just allows for a single treatment period (here denoted by "year"). However, I would like to run a loop over each U.S. state using different treatment periods according to particular changes in legislation.

    My code is the following:
    Code:
    egen stat_fps = group(state_fips)
    tsset stat_fps year
    
    forvalues stat_fps = 1(1)51 {
            synth income_gr $x , trunit(`stat_fps') mspeperiod(1985(1)2000) resultsperiod(1985(1)2018) trperiod("year") unitnames(state_name) figure keep(SCM_results_`state') replace
            }
    I also tried synth_runner since it allows for an adjustment of the treatment period. However, from my point of view, synth_runner is not suitable if you want to examine individual effects rather than the average effect over a set of entities.

    I am grateful for any idea of how to implement that loop and account for different treatment periods (trperiod). Thank you very much in advance!

    Best regards,
    Philipp

  • #2
    I am grateful for any idea of how to implement that loop and account for different treatment periods (trperiod). Thank you very much in advance!
    I am not sure I understand the question, but I interpret this to be a nested loop, correct?
    Here's a toy example across all states and varying the treatment period from the years 1989 / 1992.

    Code:
    clear all
    
    use "https://github.com/bquistorff/synth_runner/raw/master/code/ado/smoking.dta"
    
    tsset state year
    levelsof state, local(states)
    
    foreach s in `states' {
        forvalues yr = 1989/1992 {
            synth cigsale beer(1984(1)1988) lnincome retprice age15to24 cigsale(1988) cigsale(1980) cigsale(1975), trunit(`s') trperiod(`yr')
        }
    }
    Note: synth is by Jens Hainmueller and from SSC.
    Last edited by Justin Niakamal; 14 Oct 2020, 19:42.

    Comment


    • #3
      You are right! It is a nested loop. However, I do not want to run a SCM for every year according to your "yr" variable, but only for those years that satisfy a particular condition. Imagine this condition to be a separate dummy variable turning 1 in certain cases and 0 otherwise.

      Do you have an idea how to combine the second loop "yr" variable with a condition and another dummy variable?

      Best regards,
      Philipp

      Comment

      Working...
      X