Announcement

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

  • Difference in Difference set-up

    Hello all


    I am working with individual-level data, which combines two datasets. My primary outcome measure is General Health, represented by the variable "scghq2_dv." The data spans from 2017 to 2021, with the intervention of COVID-19 occurring in March 2020. I plan to use a Difference-in-Difference (DiD) regression to estimate workers' health outcomes during this period.

    I have set up the sample into three groups to analyse their relative differences. When the COVID-19 lockdowns began, some workers were furloughed or stopped working for various reasons—this group serves as the “control group.” The two “treatment groups” consist of:
    1. Workers who continued working but did so remotely from home received full pay.
    2. Workers who continued working in person also received full pay.
    I’m struggling to properly set up these two treatment groups in my DiD model. I feel like I might be missing a key element in their structure or interpretation.

    Any insights or suggestions on how to approach this would be appreciated!




    Code:
    gen group = .
    replace group = 0 if jbstat == 3 // Control group: Unemployed
    replace group = 1 if wfh == 1 & jbstat == 2 // Treatment group 1: WFH and employed
    replace group = 2 if wfh == 0 & jbstat == 2 // Treatment group 2: Not WFH and employed
    label define group_lbl 0 "Control (Unemployed)" 1 "Treatment 1 (WFH)" 2 "Treatment 2 (Not WFH)"
    label values group group_lbl 
    
    gen post = (nd_monthly >= tm(2020m4))
    gen treated_post = group * post
    
    // Running the DiD regression
    
    xtreg scghq2_dv post##group, vce(cluster pidp)
    Also, when I used -xtdidregress- command, it gave me different results and could not check the parallel trend by - estate trendplots-


    Could anyone help with that?

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long pidp byte scghq2_dv float(int_date nd_monthly wfh) byte jbstat float(group post treated_post)
       22445  2 21115 693 .  2 . 0 .
       29925  0 21053 691 .  2 . 0 .
      333205  0 20978 689 .  2 . 0 .
      732365  9 22029 723 .  8 . 1 .
      732365 12 22062 724 .  8 . 1 .
      732365  7 22091 725 .  8 . 1 .
      732365 12 22182 728 .  8 . 1 .
      732365 12 22245 730 .  8 . 1 .
      732365 12 22311 732 .  8 . 1 .
      732365 12 22363 734 .  8 . 1 .
     1697285  0 20911 687 .  2 . 0 .
     1833965  1 21140 694 .  2 . 0 .
     2270525  9 21267 698 .  6 . 0 .
     2626845  0 21209 696 .  2 . 0 .
     2888645  0 20879 686 .  2 . 0 .
     3667245  8 21005 690 .  2 . 0 .
     4853165  0 21162 695 .  2 . 0 .
    68006127  0 20890 686 .  6 . 0 .
    68006127  0 21260 698 .  3 0 0 0
    68009527  1 20895 686 .  2 . 0 .
    68011567  0 20908 686 .  2 . 0 .
    68014287 12 21320 700 . 97 . 0 .
    68020564 12 20890 686 .  8 . 0 .
    68020564 12 21245 698 .  3 0 0 0
    68021765  6 20969 688 .  2 . 0 .
    68021781  0 20969 688 .  2 . 0 .
    68028567 12 21038 691 .  3 0 0 0
    68028571  0 21038 691 .  2 . 0 .
    68028575  0 20923 687 .  6 . 0 .
    68028575  0 21255 698 .  6 . 0 .
    68029927  0 20880 686 .  6 . 0 .
    68029927  0 21264 698 .  6 . 0 .
    68037407  0 20954 688 .  3 0 0 0
    68037407  0 21238 697 .  2 . 0 .
    68042167  0 20872 685 .  2 . 0 .
    68042171  2 20859 685 .  2 . 0 .
    68044211  0 20933 687 .  1 . 0 .
    68044211  0 21240 697 .  1 . 0 .
    68045571  0 20933 687 .  4 . 0 .
    68045571  0 21233 697 .  4 . 0 .
    68046927  0 20933 687 .  2 . 0 .
    68049647  0 20831 684 .  2 . 0 .
    68049651  0 20834 684 .  2 . 0 .
    68056447 11 20831 684 .  2 . 0 .
    68056451  2 20872 685 .  6 . 0 .
    68056451  6 21220 697 .  6 . 0 .
    68056455  9 20838 684 .  7 . 0 .
    68059171  0 20858 685 .  1 . 0 .
    68059171  2 21222 697 .  1 . 0 .
    68063251  0 20853 685 .  2 . 0 .
    68068019  0 21214 696 .  2 . 0 .
    68086371  0 20901 686 .  8 . 0 .
    68086371  0 21210 696 .  8 . 0 .
    68091127  6 20915 687 .  8 . 0 .
    68091127  4 21284 699 .  8 . 0 .
    68091135 12 20969 688 .  5 . 0 .
    68091135  5 21253 698 .  6 . 0 .
    68102695  1 20895 686 .  2 . 0 .
    68102695  2 21211 696 .  2 . 0 .
    68105407  0 20893 686 .  2 . 0 .
    68105411  1 20893 686 .  1 . 0 .
    68111527  0 20919 687 .  2 . 0 .
    68112207  2 20824 684 .  2 . 0 .
    68116287  0 20878 685 .  2 . 0 .
    68121047  0 20879 686 .  2 . 0 .
    68121055  0 20879 686 .  2 . 0 .
    68131931  9 20832 684 .  2 . 0 .
    68132607  0 20824 684 .  2 . 0 .
    68132611  0 20825 684 .  8 . 0 .
    68132611  0 21193 696 .  4 . 0 .
    68132615  0 20836 684 .  2 . 0 .
    68133289 11 22031 723 .  5 . 1 .
    68133289 11 22064 724 .  5 . 1 .
    68133289  9 22120 726 .  5 . 1 .
    68133289 11 22184 728 .  5 . 1 .
    68133289 11 22245 730 .  2 . 1 .
    68133289 11 22307 732 .  5 . 1 .
    68133289 11 22363 734 .  5 . 1 .
    68134647  0 20887 686 .  3 0 0 0
    68134647  0 21241 697 .  3 0 0 0
    68141447  0 20855 685 .  2 . 0 .
    68141451  3 20855 685 .  1 . 0 .
    68141451  0 21225 697 .  1 . 0 .
    68142127  1 20830 684 .  6 . 0 .
    68142127  0 21202 696 .  6 . 0 .
    68142131  0 20832 684 .  2 . 0 .
    68155047  1 22031 723 .  2 . 1 .
    68155047  0 22062 724 .  2 . 1 .
    68155047  0 22093 725 .  2 . 1 .
    68155047  0 22121 726 .  2 . 1 .
    68155047  0 22182 728 .  2 . 1 .
    68155047  1 22244 730 .  2 . 1 .
    68155059  5 20898 686 .  2 . 0 .
    68155059  8 21268 698 .  2 . 0 .
    68155063  2 20879 686 .  7 . 0 .
    68155063  2 21230 697 .  7 . 0 .
    68157166  0 20923 687 .  2 . 0 .
    68159127  0 20872 685 .  2 . 0 .
    68160493  7 20824 684 . 97 . 0 .
    68163887  9 20853 685 .  2 . 0 .
    end
    format %td int_date
    format %tm nd_monthly
    label values scghq2_dv ca_scghq2_dv
    label values jbstat i_jbstat
    label def i_jbstat 1 "Self employed", modify
    label def i_jbstat 2 "Paid employment(ft/pt)", modify
    label def i_jbstat 3 "Unemployed", modify
    label def i_jbstat 4 "Retired", modify
    label def i_jbstat 5 "On maternity leave", modify
    label def i_jbstat 6 "Family care or home", modify
    label def i_jbstat 7 "Full-time student", modify
    label def i_jbstat 8 "LT sick or disabled", modify
    label def i_jbstat 97 "Doing something else", modify
    label values group group_lbl
    label def group_lbl 0 "Control (Unemployed)", modify

  • #2
    I don't think this is a valid DID case. Everybody was exposed to corona. Unless the argument is that they were exposed less than the control group.... but this statement concerns me

    some workers were furloughed or stopped working for various reasons
    Presumably there's selection into treatment here. The people who worked from home/in person are presumably much different than those who stopped working or were furloughed, so not only do you have arguably everyone being treated, you also have potential selection bias issues the I do not think to can circumnavigate

    Comment

    Working...
    X