Announcement

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

  • DiD with heterogenous treatment effects

    Hello Everyone,

    I have a survey dataset that contains state FIPS, the year of the interview, the year in which a high school personal finance course mandate was implemented in a particular state, and the year in which a respondent in the state graduated from high school. My treatment is a dummy variable that equals 1 if a respondent graduated from high school in the year the policy was implemented in his state or afterwards.

    The data contains annual survey rounds from 2005 to 2020 (with no breaks). The following is the code to run a DiD with heterogeneous treatment time using Stata's
    hdidregress and the error message that followed:
    Code:
     
     . hdidregress twfe (score sex i.income i.racegr) (fin_ed), group(_state) time(yoi)                                                  treatment variable varies at the _state yoi level                                                                                       For example, if state and year are your group() and time() variables and you have individual-level data, all individuals in the      state in a given year should have the same treatment. Your data do not fulfill this requirement.                                  r(198);
    yoi is the year of the interview, fin_ed is the outcome which is equal to 1 if yr18 >= policyr and 0 otherwise. I revised my code by doing the following:
    Code:
     egen cohort = group(_state yr18)
    Code:
     . hdidregress twfe (rfbing sex i.income i.racegr) (fin_ed), group(cohort) time(yoi) note: variable _did_cohort, containing cohort indicators formed by treatment variable fin_ed and group variable cohort, was added to       the dataset. insufficient observations     None of the treated groups are observed before treatment. r(2000);
    yr18 is the year in which the respondent turned 18, which is roughly the age one typically graduates from high school in the US. I also used csdid, but the command just kept running for over 40 minutes with no output. I figured I might be doing something wrong. Below is the code I used
    Code:
     csdid score fin_ed sex i.income i.racegr, time(yr18) gvar(pf_yr) notyet vce(cluster _state)
    Any help with this? Thanks!
Working...
X