Hi all,
I am trying to plot quadratic age trends for a mental health variable (variable name: reurod) for 11 countries using marignscontplot. I estimate the age trends in one regression using interactions between age terms and country indicators. When doing so using OLS everything works fine:
where ragey is the age variable in years and d_country an indicator variable for the 11 countries in my sample.
I would also like to do this based on a fixed effects regression using smth like:
However, the above code for marginscontplot produces empty plots that only show labels along the x-axis. I believe the issue is caused by the fact that xtreg does not estimate effects for the time-invariant d_country indicator variables, only for the interaction terms with age.
I tried running a simplified regression that does not estimate the indicator variables themselves (in line with recommendations from this post):
but this yields an r(111) error in marginscontplot as:
Is there a way to plot the quadratic age trend for each country based on a fixed regression, preferably using using marginscontplot?
Thanks!
I am trying to plot quadratic age trends for a mental health variable (variable name: reurod) for 11 countries using marignscontplot. I estimate the age trends in one regression using interactions between age terms and country indicators. When doing so using OLS everything works fine:
Code:
reg reurod c.ragey##i.d_country c.ragey##c.ragey##i.d_country marginscontplot ragey d_country, ci at1(50(1)70) at2(1(1)11) plotopts(ycommon)
I would also like to do this based on a fixed effects regression using smth like:
Code:
xtreg reurod c.ragey##i.d_country c.ragey##c.ragey##i.d_country, fe vce(cluster nmergeid) marginscontplot ragey d_country, ci at1(50(1)70) at2(1(1)11) plotopts(ycommon)
I tried running a simplified regression that does not estimate the indicator variables themselves (in line with recommendations from this post):
Code:
xtreg reurod ragey c.ragey#i.d_country c.ragey#c.ragey#i.d_country, fe vce(cluster nmergeid) marginscontplot ragey d_country, ci at1(50(1)70) at2(1(1)11) plotopts(ycommon)
neither d_country nor i.d_country are in the model
Thanks!