Fitting multi-level models to weighted data runmlwin vs mixed

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
alhumbert
Posts: 1
Joined: Mon Aug 26, 2024 3:09 pm

Fitting multi-level models to weighted data runmlwin vs mixed

Post by alhumbert »

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)
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Fitting multi-level models to weighted data runmlwin vs mixed

Post by ChrisCharlton »

The most likely reason for this is that by default MLwiN applies an adjustment to the calculated variances to take into account sampling variability. This setting can be changed via the Model>Residuals window, or via the RTYPE command, however runmlwin does not currently have a way to set this. If you were to remove the nopause option and calculate the residual variance/SE within MLwiN with the adjustment turned off then you should find that they match the values calculated by the Stata mixed command.
florencepugh
Posts: 3
Joined: Wed Sep 27, 2023 1:07 am

Re: Fitting multi-level models to weighted data runmlwin vs mixed

Post by florencepugh »

Could the discrepancy in standard errors of the random effects between runmlwin and mixed be due to differences in how each command handles survey weights at different levels of the model?
Chill Guy Clicker
jessipinkman
Posts: 1
Joined: Tue Feb 11, 2025 7:47 am

Re: Fitting multi-level models to weighted data runmlwin vs mixed

Post by jessipinkman »

Yes, the discrepancy in standard errors of the random effects between runmlwin and mixed could be due to differences in how each command handles survey weights at different levels. Different software and commands may apply weights differently to account for clustering, stratification, or unequal probabilities of selection, leading to variations in estimated standard errors.
EmmaAlva
Posts: 2
Joined: Sat Mar 23, 2024 3:51 am

Re: Fitting multi-level models to weighted data runmlwin vs mixed

Post by EmmaAlva »

This configuration can be modified through the Model>Residuals window or by using the RTYPE command; however, runmlwin does not currently support adjusting this setting tiny fishing
Post Reply