Multivariate MLM with weights, and Wald Test, OR

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
yransome
Posts: 12
Joined: Wed Apr 22, 2015 12:07 pm

Multivariate MLM with weights, and Wald Test, OR

Post by yransome »

Hello runmlwin users,

I have been trying to fit a multilevel multivariate model with two binary outcomes and MLwiN is has been the best program so far. I am investigating the predictors of smoking and alcohol use, and hypothesizing that variable x predicts both equally. I have a few questions I hope the forum can help with please, as I am still learning the syntax. Here is a sample code. Running stat 13 and MlwiN2.32

#1 How does one get the equation names to display in the results window? I would like to perform a wald test to examine the hypothesis that the effect size of variablex on alcohol is the same as the effect size of variable x on smoking. In the stata environment if a command for that might look like test [alcohol]variablex = [smoke]variablex. However, there is an error
/* I even tried copying Dr. Leckie's example where he tested the constant test [RP1]var(cons_1) = [RP1]var(cons_2) and I got an ERROR
[var(cons_1)] not found

/* i now one can call coeflegend when using margins, but im unaware if there is some equivalent in runmlwin*/

# 2 How does one obtain the odds ratios for the multivariate model?, when I typed in OR at the end, I get an ERROR: that Odds Ratios are only available for univariate models.

# 3 I have survey weights and so want to see how my estimates change/stay same when I used them (I already scaled the weights using Sophia's formula). However, when I add the weight, I get this ERROR: Weights are only valid for univariate models estimated using (R)IGLS.
I am aware that MLwiN can handle weights in the stand alone program, however, I am not familiar with its interphase.

# 4, In one model when I added multiple covariates, the variance at leve2 for constant2(smoke) is zero as well as the covariance (whereas it did have an estimate in other models ). My constant2 is now is also not statistically significant, so I am wondering if thats the reason why the variance estimate. Can anyone help me understand this?

/* below is a simple model with covariage centered age, and sex*/
/* I fitted the model before using igls and mlq to get the starting estimates, then fitted it with pql2 and rigls*/

Code: Select all

 runmlwin (alcohol cons cage male2 variablex, eq(1)) (smoke cons cage male2 variablex, eq(2)), ///
   level2(nhood: (cons, eq(1)) (cons, eq(2)))  ///
   level1(pid: (cons, eq(1)) (cons, eq(2)), weightvar(aw1)) ///
   discrete(distribution(binomial binomial) link(probit) denom(cons cons)pql2) ///
   maxiterations (50) nopause rigls initsp fps correlations
ChrisCharlton
Posts: 1354
Joined: Mon Oct 19, 2009 10:34 am

Re: Multivariate MLM with weights, and Wald Test, OR

Post by ChrisCharlton »

#1 You can display the names used in the result matrices within the results with the command:

Code: Select all

ereturn display
alternatively you can check the matrix directly with:

Code: Select all

matrix list e(b)
#2 There is no automatic method currently provided by -runmlwin- to get these values. You would need to extract the values from the matrices e(b) and e(V) and then perform the calculation manually.

#3 Weighting in MLwiN has only been tested with univariate Normal models (see http://www.bristol.ac.uk/cmm/software/s ... ights.html), so we thought it safer to only allow this from -runmlwin-.
yransome
Posts: 12
Joined: Wed Apr 22, 2015 12:07 pm

Re: Multivariate MLM with weights, and Wald Test, OR

Post by yransome »

Thank you Dr. Charlton,
#1 and #2
the ereturn list worked!
Also, I used "logout" with ereturn list to send the output to excel where it was easier to exponentiate the coefficients to ORs.

#3
--Thanks about the weights statement.

#4
-- Any idea why my constant for variance2 is 0?

Regards,
Yusuf
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Multivariate MLM with weights, and Wald Test, OR

Post by GeorgeLeckie »

Dear Yusif,

In terms of #4, there is not anything obviously wrong in how you have specified the model, I suspect the problem lies with your data.

Do stare at the data, especially (1) the number of level-2 units; (2) the number of level-1 units per level-2 unit; and (3) the mean of each response in each level-2 unit (i.e., the mean proportions). Check that all of these are reasonable enough. So check that you have enough clusters, that they are not too dissimilar in size, that you don't have too many clusters where the responses do not vary at all (i.e., all 0s or all 1s) and so on.

I suggest you also simplify your model and gradually build it back up to try to identify what might be the problem. You might for example want to start by fitting each binary response model separately, before trying to fit the joint model. You might also want to start with a two-level variance components model before adding in covariates. As you build up the model, always use previous model estimates as starting values for the more complex model.

I hope this helps

George
Post Reply