Announcement

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

  • synth- exclude specific observations from the donor pool

    Good day,

    I am working with the synth command and need to exclude specific countries in specific years from the donor pool as those countries also were exposed to the intervention after a certain time. I attempted adding an if condition, for example "if country_code != X & year<2016". However, I get an error messages stating "if not allowed". Any suggestions?

    Thanks,

    Robert

  • #2
    What i do in this situation is I just preserve my dataset, drop the units I want to drop for theoretical/ statistical reasons and then do my analysis accordingly.

    Note that I believe standard synth allows you to define the donor pool in an option, but to me you're better off just dropping the unwanted units pre-analysis.



    EDIT: Nevermind, I didn't understand. What you're wanting to do is drop previously treated units from the donor pool, right? Because if so, I happen to have just programmed this exact feature for my synthetic LASSO command.

    If that's what you want, I'll post my code here that does that specific procedure.
    Last edited by Jared Greathouse; 28 Jan 2022, 08:03.

    Comment


    • #3
      Thanks much Jared. I have 61 countries and about 10 years of data. 7 countries underwent the treatment, but in different years. If possible I want to keep each country in the donor pool until is went into treatment. I did find the countit option to restrict the donor pool in the command, however it doesn't work with nested models. I also attempted to only eliminate the effected countries for the treated years, however that also gave me an error, I think because the panel becomes unbalanced. So, for now I am dropping all the countries that were treated if not the country I am analyzing. I am interested in your code if you could share it. As a side bar, I would also like the figure to show 95%CIs, but can't figure out how to get synth to do it. Any thoughts? Thanks again.

      Comment


      • #4
        Okay so you do have staggered implementation. This makes things tricky. Note that you yourself can do this, but it must be in your do-file since you don't have my command which automates this.

        Code:
        qui su `time' if `unit' == `treatunit' & `treated' == 1
        
        qui levelsof `unit' if `time' < r(min) & `treated' == 1, l(previous)
        
        loc dropped: word count `previous'
        
            foreach l of loc previous {
        qui    drop if `unit' == `l'
            
            }
        Here it's important to note that my syntax assumes you've a treated variable, = 1 if a unit is treated else 0. synth doesn't allow for this.

        What my code does here, is it grabs the minimum date of the currently treated unit.

        It then IDs any units that are treated before the minimum date of the currently treated unit with levelsof.

        If there are any units which were treated before the current one, it just yoinks them out of the donor pool, and bam, et voila, we've got a clean donor pool

        However, you don't have scul since it's not ready to be released yet. So if I were you, I'd do something like

        Code:
        levelsof treated, l(treated)
        
        foreach x of loc treated
        qui su time_var if panel_var == `x' & treat_var== 1
        
        gl year = r(min)
        
        qui levelsof panel_var if time_var < r(min) & treat_var == 1, l(previous)
        
        loc dropped: word count `previous'
        
            foreach l of loc previous {
        qui    drop if `unit' == `l'
            
            }
        
        synth y x ........ trunit(`x') trdate($year)
        This is about what I would do if I were you. Note that this changes the identifying assumptions a little.

        You don't want to know how long it took me to write this originally, but this seems to be about what you're looking for. If you've got any questions, you know where to find me.

        EDIT: I've also programmed this sort of t-test for post-intervention CIs, but I'm not ready to release the code for that yet since I'm still frankly reading and digesting the paper. CIs and SCMs are really still under development for the entire discipline, so you're honestly better off asking Alberto Abadie or Mattias Cattaneo their views, as this is still really the cutting edge of SCM research and I'm not smart enough to comment on it like they could.
        Last edited by Jared Greathouse; 28 Jan 2022, 11:52.

        Comment


        • #5
          Your are brilliant! I really appreciate the code and your explanation. Have a great weekend.

          Comment

          Working...
          X