Hello everyone!
I've opened a thread on my project already a few days ago, and the answer & some colleagues already helped me, so thanks for that.
Actually, there's a new matter.
Again, we're researching into the mental health trajectories of immigrants and natives in Germany over time. For that purpose, we're using unbalanced panel data. We're estimating the within-person-changes with two separate fixed-effects models for immigrants and natives each, with mental health (mh) as outcome and time dummies (2020, 2018, 2016 etc. – survey every two years) as exposure, controlling for age. We want to visualize the results using a combined coefplot.
For that purpose, we created an continuous impact function.
Then we defined a dummy impact function for the years 2004 to 2020.
And then we estimated the two fixed-effect models.
Last, we create the plot.
We have witnessed a significant drop in mental health in 2020 for natives (but not immigrants), but we've also seen that this could be part of a periodic up and down of mental health. It was as low for natives in 2012 and 2004. Our idea was now to take the years 2004-2018, calculate expected values/extrapolations for 2020 and compare that with the actual estimation for 2020 of our fixed-effects models. What could be ways to do that?
Thanks in advance,
Henning
I've opened a thread on my project already a few days ago, and the answer & some colleagues already helped me, so thanks for that.
Actually, there's a new matter.
Again, we're researching into the mental health trajectories of immigrants and natives in Germany over time. For that purpose, we're using unbalanced panel data. We're estimating the within-person-changes with two separate fixed-effects models for immigrants and natives each, with mental health (mh) as outcome and time dummies (2020, 2018, 2016 etc. – survey every two years) as exposure, controlling for age. We want to visualize the results using a combined coefplot.
For that purpose, we created an continuous impact function.
Code:
gen ycov_index = syear - 2020
Code:
recode ycov_index /// (min/-16. = 0 "2004") /// (-14 = 1 "2006") /// (-12 = 2 "2008") /// (-10 = 3 "2010") /// (-8 = 4 "2012") /// (-6 = 5 "2014") /// (-4 = 6 "2016") /// (-2 = 7 "2018") /// (0 = 8 "2020") /// , gen(time_dummies)
And then we estimated the two fixed-effect models.
Code:
xtset pid syear xtreg mh i.time_dummies c.age##c.age if immigrant == 0, fe vce(robust) margins time_dummies, post est store A xtreg mh i.time_dummies c.age#c.age if immigrant == 1, fe vce(robust) margins time_dummies, post est store B
Code:
coefplot /// (A, label(Natives) offset(-0.05) /// msymbol(0) mcolor(black) msize(medlarge) lcolor(black) /// lwidth(medthick) lcolor(black) ciopts(recast(rcap) lcolor(black))) /// (B, label(Immigrants) offset(0.05) /// msymbol(S) mcolor(gs9) /// lwidth(medthick) lcolor(gs9) ciopts(recast(rcap) lcolor(gs9))) /// , title("Comparison of natives and immigrants") /// vertical recast(connected) ytitle("") ylab (51.5 (0.5) 48.5, /// labsize(small) angle(0)) xlab (, labsize(vsmall) angle (0)) /// legend(size(small)) xtitle("Years before Covid-19", /// size(small)) xscale(titlegap(2)) /// graphregion(color(white) fcolor(white) icolor(white))
We have witnessed a significant drop in mental health in 2020 for natives (but not immigrants), but we've also seen that this could be part of a periodic up and down of mental health. It was as low for natives in 2012 and 2004. Our idea was now to take the years 2004-2018, calculate expected values/extrapolations for 2020 and compare that with the actual estimation for 2020 of our fixed-effects models. What could be ways to do that?
Thanks in advance,
Henning
Comment