Announcement

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

  • Propensity score matching under a DID setup

    Hi everyone,

    I'm in need of some advice relating to using propensity score matching (PSM) in a difference-in-differences event study framework. I'm trying to examine the effect of a car industry closure on worker outcomes. I have an unbalanced panel from 2010-2022, and information on some worker characteristics in 2010 (age, education, occupation) and employment-related outcomes (salary, occupations, welfare benefits) in each year over the whole time period. To identify effects I am comparing the outcomes of those who worked in the car industry in 2010 (treatment), with those who worked in the construction and other manufacturing excluding car manufacturing (control). I want to use PSM to match treatment and control workers, using information on their age, education, and occupation in 2010, and estimate effects for each year, from 2011-2022, with 2010 used as the base year.

    I'm currently using the user-contributed psmatch2 command for this purpose (Leuven & Sianesi). I'm aware that there are different matching methods to choose from (I have currently used the "ties" option which may not be the best), but my question at this point is on the general procedure of using this command to suit my setup. Below is an example of what I have done so far, where I first run psmatch2 on the treatment indicator variable and the matching variables and retain observations for which the generated "_weight" variable is not missing or zero, and then reshape the data to match my setup and run the regressions with the variable "_weight" included as weights. However I'm unsure if this approach is correct and wanted to double check.

    I unfortunately can't share any data due to privacy reasons, but below is a snippet of the code I have used so far. Please let me know if this seems correct or not. Thank you very much.


    Code:
    set seed 123
    psmatch2 treatment occ age educ, ties
    drop if (_weight==0|_weight==.)
    
    reshape long salary, i(id)
    rename _j time
    
    gen year=2010 if time==1
    replace year=2011 if time==2
    replace year=2012 if time==3
    replace year=2013 if time==4
    replace year=2014 if time==5
    
    gen period10=(year==2010)
    gen period11=(year==2011)
    gen period12=(year==2012)
    gen period13=(year==2013)
    gen period14=(year==2014)
    
    gen treat10=period10*treatment
    gen treat11=period11*treatment
    gen treat12=period12*treatment
    gen treat13=period13*treatment
    gen treat14=period14*treatment
    
    xtreg salary i.year treat11 treat12 treat13 treat14 [aw=_weight], fe i(id) r

  • #2
    Your question is a considerable distance from what I ever do, but I have secondary comments on your code, which could be shortened by noticing repetitive patterns and by making use of loops.

    Code:
    gen year=2010 if time==1
    replace year=2011 if time==2
    replace year=2012 if time==3
    replace year=2013 if time==4
    replace year=2014 if time==5
    That looks like

    Code:
    gen year = time + 2009

    Ten commands to indicate a bundle of indicator variables could be reduced to
    a loop:

    Code:
    forval t = 10/14 {
          gen period`t' = year == 20`t'
          gen treat`t' = period`r' * treatment
    }

    Comment


    • #3
      I'll address the propensity score weighting, not from the perspective of whether it was done correctly, but rather to argue that it should not be done at all.

      Your description of your data and the code you show both confirm that the variables age, educ, and occ are time-invariant within person. In fact, they are the values of those variables for the person in year 2010. Because they are time invariant, if you run -xtreg salary i.year age educ occ, fe- (perhaps i.age, i.educ and i.occ if they are discrete variables) then, being time invariant, age, educ and occ will be omitted from the model. But the big bonus that fixed effects regression provides is that their effects are automatically adjusted for without you having to do anything to make that happen. In fact, fixed effects regressions automatically adjust for the effects of all time-invariant variables, including variables you haven't measured or even thought of.

      Since the purpose of propensity score weighting (or matching) is to adjust for potentially confounding variables, it serves no purpose here, because -xtreg- will, as I just noted, already does this adjustment. And, in fact, the adjustment provided by fixed-effects regression is "perfect" in the sense that if the effects of age, educ, and occ on salary are, in fact, linear*, then their effects are exactly zeroed out in the fixed effects model. So I would just skip the propensity score work altogether.

      *The linearity of effects assumption may be a stretch in many cases, but if the variables are categorical and you don't include any interaction terms in the model, then the linearity assumption is automatically true.

      Comment


      • #4
        Thanks very much Nick and Clyde, for the coding and methodological comments. My initial understanding was that the fixed effects control for confounding factors within the individual (or group in this context), but not between groups, and as such, some form of matching is still needed to ensure that the treatment and control groups are well-matched and comparable to each other. But from your explanation, I gather that the fixed effects also account for between-group confounders?

        Comment


        • #5
          But from your explanation, I gather that the fixed effects also account for between-group confounders?
          Yes, that's right. It accounts for them and zeroes out their effects. What it does not do is estimate those effects. If you are interested in estimating/identifying between-group effects then you simply can't do that at all in a fixed-effects model. But for eliminating their confounding, which is what I understand your goal to be, the fixed-effects model is ideal.

          Comment


          • #6
            Thank you. I'm actually wanting to both eliminate confounding between the two groups and then estimate the effect of treatment (plant closures) on differences in outcomes (e.g., salary) for the treatment group compared to the control, relative to the base year (first year of the sample), for each subsequent year.

            Comment


            • #7
              Yes, of course. Let me recommend that you use the modern approach to interaction terms in regressions:
              Code:
              xtset id year
              xtreg salary i.treatment##i.year, fe vce(cluster id)
              The term i.treatment##i.year is Stata's implementation of factor-variable notation. See -help fvvarlist- for details and refinements of the basic approach. In addition to saving you the error-prone trouble of creating your own interaction variables, it will also enable you to use the -margins- command afterwards to see key results of your analysis. The -margins- command is somewhat complicated, and rather than starting with its -help- file, I recommend you learn how to use it from the excellent Richard Williams' https://www3.nd.edu/~rwilliam/stats/Margins01.pdf.

              Finally, if you are still relatively new to interaction models, I recommend another Richard Williams tract: https://www3.nd.edu/~rwilliam/stats2/l53.pdf.

              Comment

              Working...
              X