Fitting multi-level models to weighted data runmlwin vs mixed
Posted: Mon Aug 26, 2024 3:18 pm
I am fitting multi-level models to weighted data. Running MLwiN via Stata is no problem to handle this, though it is not currently possible to use MCMC estimation as I understand it. Usually comparing un/weighted models in IGLS and MCMC only provides very marginal differences anyway.
I have been asked to do some basic training for colleagues who do not have access to MLwiN, and therefore trying to adapt the syntax I normally use with the mixed command in Stata. However, I am not able to reproduce the results I get with runmlwin when it comes to compute the SE of my random effects.
I am using the European/Global Values Survey, the data are here: https://www.worldvaluessurvey.org/WVSEVSjoint2017.jsp
Below is an extract of the syntax that I am using, for weighted and unweighted models respectively.
Any idea why I am unable to get the same results, and what I am doing wrong?
Thank you for any help you might be able to provide.
Anne
mvdecode d059, mv(-5 -2 -1 = .) // treat missing values
recode d059 (1=4 "S agree") (2=3 "Agree") (3=2 "Disagree") (4=1 "S disagree") (else=.), gen(d059_rev)
label variable d059_rev "Do men make better political leaders than women do?"
***** Unweighted
runmlwin d059_rev ///
cons, ///
level2(cntry: cons, residuals(unw)) ///
level1(id: cons, ) ///
nopause
mixed d059_rev || cntry:, mle
predict unw_0, reffect reses(unw_0se)
***** Weighted
runmlwin d059_rev ///
cons, ///
level2(cntry: cons, residuals(u)) ///
level1(id: cons, weightvar(gwght)) ///
nopause
mixed d059_rev [fweight = gwght] || cntry:, mle
predict u_0, reffects reses (u_0se)
I have been asked to do some basic training for colleagues who do not have access to MLwiN, and therefore trying to adapt the syntax I normally use with the mixed command in Stata. However, I am not able to reproduce the results I get with runmlwin when it comes to compute the SE of my random effects.
I am using the European/Global Values Survey, the data are here: https://www.worldvaluessurvey.org/WVSEVSjoint2017.jsp
Below is an extract of the syntax that I am using, for weighted and unweighted models respectively.
Any idea why I am unable to get the same results, and what I am doing wrong?
Thank you for any help you might be able to provide.
Anne
mvdecode d059, mv(-5 -2 -1 = .) // treat missing values
recode d059 (1=4 "S agree") (2=3 "Agree") (3=2 "Disagree") (4=1 "S disagree") (else=.), gen(d059_rev)
label variable d059_rev "Do men make better political leaders than women do?"
***** Unweighted
runmlwin d059_rev ///
cons, ///
level2(cntry: cons, residuals(unw)) ///
level1(id: cons, ) ///
nopause
mixed d059_rev || cntry:, mle
predict unw_0, reffect reses(unw_0se)
***** Weighted
runmlwin d059_rev ///
cons, ///
level2(cntry: cons, residuals(u)) ///
level1(id: cons, weightvar(gwght)) ///
nopause
mixed d059_rev [fweight = gwght] || cntry:, mle
predict u_0, reffects reses (u_0se)