Hello. I have a few questions about multilevel modeling using the mixed command and would very much appreciate some guidance. I am using Stata 15.0.
I am working with cross-national survey data that was collected first in 2006 and then again in 2016. I've combined the survey data and added several national level variables. The data is slightly unbalanced since the countries surveyed are slightly different for 2006 and 2016. For the variables below, the ones at the individual level are in lower case and the ones at the national level are in uppercase.
1) How should I structure the multilevel model? I've assumed that individuals nested within countries, which are nested within year years. Does the following look right?
mixed taxattitude sex age education gini sclass TAX || year: || country:
Alternatively, I'm not that interested in year effects, so would it alternatively make sense just to keep the year effect in the fixed effects
portion using year dummies?
mixed taxattitude sex age education gini sclass TAX YEARDUMMY || country:
2) If I use a cross-level interaction, should I include the variable at both the country and year level of the random effects portion like:
mixed taxattitude sex age education gini c.class##c.TAX || year: sclass || year: sclass
3) When using marginsplot to graph a cross-level interative effect, how do the graphs take into account the random effect part of the model? For the fixed portion, my understanding is that that other variables are held at their mean. How would the random portion be treated using the following code?
mixed taxattitude sex age education gini c.class##c.TAX || year: sclass || year: sclass
margins, dydx(sclass) at(taxattitude=(7(10)49)) vsquish
margins, dydx(sclass) at(taxattitude=(7 49.37 )) vsquish
margins, at(taxattitude=(7 49.37 ))
set more off
margins, at(taxattitude=(7(10)49) topbot=(1(1)10))
marginsplot, noci xdimension(topbot) plotdimension(taxattitude, allsimple) legend(subtitle(Tax level on low income earners) rows(2)) recast(line) scheme(s1mono)
4) I have about 23 countries and of those about two are not in the second wave of the survey. Is there a good way to get Stata to handle this level of unbalanced data?
Thank you in advance for any help!
I am working with cross-national survey data that was collected first in 2006 and then again in 2016. I've combined the survey data and added several national level variables. The data is slightly unbalanced since the countries surveyed are slightly different for 2006 and 2016. For the variables below, the ones at the individual level are in lower case and the ones at the national level are in uppercase.
1) How should I structure the multilevel model? I've assumed that individuals nested within countries, which are nested within year years. Does the following look right?
mixed taxattitude sex age education gini sclass TAX || year: || country:
Alternatively, I'm not that interested in year effects, so would it alternatively make sense just to keep the year effect in the fixed effects
portion using year dummies?
mixed taxattitude sex age education gini sclass TAX YEARDUMMY || country:
2) If I use a cross-level interaction, should I include the variable at both the country and year level of the random effects portion like:
mixed taxattitude sex age education gini c.class##c.TAX || year: sclass || year: sclass
3) When using marginsplot to graph a cross-level interative effect, how do the graphs take into account the random effect part of the model? For the fixed portion, my understanding is that that other variables are held at their mean. How would the random portion be treated using the following code?
mixed taxattitude sex age education gini c.class##c.TAX || year: sclass || year: sclass
margins, dydx(sclass) at(taxattitude=(7(10)49)) vsquish
margins, dydx(sclass) at(taxattitude=(7 49.37 )) vsquish
margins, at(taxattitude=(7 49.37 ))
set more off
margins, at(taxattitude=(7(10)49) topbot=(1(1)10))
marginsplot, noci xdimension(topbot) plotdimension(taxattitude, allsimple) legend(subtitle(Tax level on low income earners) rows(2)) recast(line) scheme(s1mono)
4) I have about 23 countries and of those about two are not in the second wave of the survey. Is there a good way to get Stata to handle this level of unbalanced data?
Thank you in advance for any help!
Comment