Hi all,
I am working on a project to understand the effect of the Covid-19 pandemic on health behaviours using Understanding Society with a diff-in-diff set up comparing male and female outcomes. Health behaviours (hindex_cutoff) is an index based on six variables (dfruit_simp dvege_simp fvamt_cutoff alchfreq alchbinge metminutesmv_cutoff) where three are asked in Jul 2020 & Jan 2021 and the rest in Sep 2020 & Jan 2021 i.e, there are two treatment periods depending on the variable. I have two questions:
1) I tried to create a variable where 1 = Pre, 2 = July/Sep 2020 and 3 = Jan 2021 but when running the estimations using this index, 2 is omitted. Is there a way around this?
2) Alternatively, I could run the regressions separately for the six variables for each time period but the sample size is changing quite a bit (I have tried experimenting with saving the estimation samples from the smallest available sample per outcome variable and using that but this doesn't seem to work). How can I ensure that the sample size is constant across the outcome variables and time periods?
**Treatment periods
gen July2020 = .
replace July2020 = 1 if wave == 15
replace July2020 = 0 if wave == 9
gen Sep2020 = .
replace Sep2020 = 1 if wave == 16
replace Sep2020 = 0 if wave == 9
gen Jan2021 = .
replace Jan2021 = 1 if wave == 18
replace Jan2021 = 0 if wave == 9
**Treatment vs. "control" groups
gen treatfem = .
replace treatfem = 1 if sex_main == 0
replace treatfem = 0 if sex_main == 1
keep if inlist(wave,9,15,16,17,18,19)
bys pidp: keep if _N == 6
xtreg hindex_cutoff i.treatfem##i.covidindicator i.dimonth_final2 i.dimonth_final3 i.dimonth_final4 i.dimonth_final5 i.dimonth_final6 i.dimonth_final7 i.dimonth_final8 i.dimonth_final9 i.dimonth_final10 ///
i.dimonth_final11 i.dimonth_final12 i.gor_main, fe vce(cluster pidp)
Many thanks
Karen
I am working on a project to understand the effect of the Covid-19 pandemic on health behaviours using Understanding Society with a diff-in-diff set up comparing male and female outcomes. Health behaviours (hindex_cutoff) is an index based on six variables (dfruit_simp dvege_simp fvamt_cutoff alchfreq alchbinge metminutesmv_cutoff) where three are asked in Jul 2020 & Jan 2021 and the rest in Sep 2020 & Jan 2021 i.e, there are two treatment periods depending on the variable. I have two questions:
1) I tried to create a variable where 1 = Pre, 2 = July/Sep 2020 and 3 = Jan 2021 but when running the estimations using this index, 2 is omitted. Is there a way around this?
2) Alternatively, I could run the regressions separately for the six variables for each time period but the sample size is changing quite a bit (I have tried experimenting with saving the estimation samples from the smallest available sample per outcome variable and using that but this doesn't seem to work). How can I ensure that the sample size is constant across the outcome variables and time periods?
**Treatment periods
gen July2020 = .
replace July2020 = 1 if wave == 15
replace July2020 = 0 if wave == 9
gen Sep2020 = .
replace Sep2020 = 1 if wave == 16
replace Sep2020 = 0 if wave == 9
gen Jan2021 = .
replace Jan2021 = 1 if wave == 18
replace Jan2021 = 0 if wave == 9
**Treatment vs. "control" groups
gen treatfem = .
replace treatfem = 1 if sex_main == 0
replace treatfem = 0 if sex_main == 1
keep if inlist(wave,9,15,16,17,18,19)
bys pidp: keep if _N == 6
xtreg hindex_cutoff i.treatfem##i.covidindicator i.dimonth_final2 i.dimonth_final3 i.dimonth_final4 i.dimonth_final5 i.dimonth_final6 i.dimonth_final7 i.dimonth_final8 i.dimonth_final9 i.dimonth_final10 ///
i.dimonth_final11 i.dimonth_final12 i.gor_main, fe vce(cluster pidp)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(hindex_cutoff dfruit_simp dvege_simp alchfreq metminutesmv_cutoff alchbinge treatfem covidindicator imonth_final gor_main) long pidp byte wave float(July2020 Sep2020 Jan2021) . . . . . . 1 . 11 5 76165 17 . . . . . . . . . 1 . 3 5 76165 19 . . . . . . 1 . 1 1 2 9 5 76165 16 . 1 . . 1 0 . . . 1 2 7 5 76165 15 1 . . 1 1 1 1 1 1 1 1 4 5 76165 9 0 0 0 1 1 0 1 1 1 1 3 1 5 76165 18 . . 1 . . . 0 1 1 1 2 9 1 1587125 16 . 1 . . . . . . . 1 . 11 1 1587125 17 . . . 1 1 1 1 1 1 1 3 1 1 1587125 18 . . 1 . 0 0 . . . 1 2 7 1 1587125 15 1 . . 1 1 1 1 0 1 1 1 9 1 1587125 9 0 0 0 . . . . . . 1 . 3 1 1587125 19 . . . . . . . . . 0 . 3 11 4849085 19 . . . . 1 1 . . . 0 2 7 11 4849085 15 1 . . . 1 1 0 . 1 0 3 1 11 4849085 18 . . 1 . . . 0 . 0 0 2 9 11 4849085 16 . 1 . . . . . . . 0 . 11 11 4849085 17 . . . 0 0 0 0 0 1 0 1 4 11 4849085 9 0 0 0 1 0 0 1 1 1 1 3 1 7 68002725 18 . . 1 . . . . . . 1 . 3 7 68002725 19 . . . 0 0 1 1 0 1 1 1 3 7 68002725 9 0 0 0 . . . 0 1 1 1 2 9 7 68002725 16 . 1 . . 0 0 . . . 1 2 7 7 68002725 15 1 . . . . . . . . 1 . 11 7 68002725 17 . . . . 1 1 . . . 1 2 7 1 68008847 15 1 . . . . . . . . 1 . 3 1 68008847 19 . . . 1 1 0 1 0 1 1 1 3 1 68008847 9 0 0 0 . . . . . . 1 . 11 1 68008847 17 . . . . 0 0 1 . 1 1 3 1 1 68008847 18 . . 1 . . . 1 0 1 1 2 9 1 68008847 16 . 1 . . . . . . . 1 . 11 1 68010887 17 . . . . . . 1 . 1 1 2 9 1 68010887 16 . 1 . . . . . . . 1 . 3 1 68010887 19 . . . 1 1 1 1 1 1 1 1 3 1 68010887 9 0 0 0 . 0 1 1 . 1 1 3 1 1 68010887 18 . . 1 . 1 1 . . . 1 2 7 1 68010887 15 1 . . . . . . . . 1 . 11 5 68031967 17 . . . 0 0 1 0 1 1 1 1 3 5 68031967 9 0 0 0 . 0 0 . . . 1 2 7 5 68031967 15 1 . . . . . . . . 1 . 3 5 68031967 19 . . . . . . 0 1 1 1 2 9 5 68031967 16 . 1 . 0 1 0 0 0 1 1 3 1 5 68031967 18 . . 1 . . . 1 1 1 0 2 9 7 68035365 16 . 1 . 1 0 0 1 1 1 0 3 1 7 68035365 18 . . 1 . . . . . . 0 . 3 7 68035365 19 . . . . 1 0 . . . 0 2 7 7 68035365 15 1 . . 1 1 1 1 0 1 0 1 2 7 68035365 9 0 0 0 . . . . . . 0 . 11 7 68035365 17 . . . . . . . . . 0 . 3 1 68035367 19 . . . . 1 1 . . . 0 2 7 1 68035367 15 1 . . end
Karen
Comment