Multivariate model with binary and cts utcomes

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
katetilling
Posts: 5
Joined: Fri Nov 11, 2011 2:37 pm

Multivariate model with binary and cts utcomes

Post by katetilling »

We are trying to fit a multivariate model to jointly model 1 discrete (binary) outcome and 1 continuous (repeated measure) outcome.
We can do a multivariate model with two continuous outcomes fine:
runmlwin (score1 cons , eq(1)) (score2 cons, eq(2)) , level2 (id: (cons, reset(none) eq(1)) (cons, eq(
>> 2)) ) level1(visit_unique: (cons, eq(1) )) nopause maxiterations(450)
but are struggling to work out how to tell MLwiN that one outcome is normal and the other binary.

Thanks
Kate
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Multivariate model with binary and cts utcomes

Post by GeorgeLeckie »

Hi Kate,

Thanks for your interesting query. Yes you can use the runmlwin command to fit multilevel mixed response models in MLwiN.

Consider the MLwiN tutorial data set. We can fit a two-level (students nested within schools) mixed response model for normexam (continuous) and binlrt (binary) as follows:

Code: Select all

use http://www.bristol.ac.uk/cmm/media/runmlwin/tutorial, clear

generate binlrt = (standlrt>0)

runmlwin (normexam cons, equation(1)) (binlrt cons, equation(2)), ///
   level2(school: (cons, eq(1)) (cons, eq(2))) ///
   level1(student: (cons, eq(1)) (cons, eq(2))) ///
   discrete(distribution(normal binomial) ///
            link(probit) denominator(cons cons))

Best wishes


George
michaellawton
Posts: 11
Joined: Tue Nov 22, 2011 10:40 pm

Re: Multivariate model with binary and cts utcomes

Post by michaellawton »

I have also been fitting 1 discrete (binary) outcome and 1 continuous (repeated measure) outcome. My program (shown below) was working fine within MLwiN 2.23

Code: Select all

runmlwin (score cons fp1 fp6, equation(1)) (drugbin cons, equation(2)), ///
   level2(patid: (cons fp1 fp6, eq(1)) (cons, eq(2))) ///
   level1(visit_uni: (cons fp1, eq(1))///
   discrete(distribution(normal binomial) ///
            link(probit) denominator(cons cons))

To fit this model I had a separate line for each individuals (multiple) continuous outcomes and another line for their (single) binary outcome. The lines for the continuous outcome had a missing value for the binary outcome (ie. when score has a value drugbin = .) and the lines for the binary outcome had a missing value for the continuous outcome (when drugbin has a value score=.). The visit_uni was a sequential variable over all observations both continuous and binary. fp1 and fp6 are time and log time variables respectively. cons = 1 on every observation

Now that I have moved to MLwiN 2.24 my program no longer works instead I get the following error message:

error while obeying batch file ... at line number 20: DOFF 2"
wrong params.

Hope that you can help me out. Many thanks, Michael
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Multivariate model with binary and cts utcomes

Post by GeorgeLeckie »

Hi Miachel,

If I have understood you email correctly, I don't think you can fit the model that you want to fit in MLwiN.

You have measurement occasions (level 1) nested within individuals (level 2).

You have a continuous response variable measured at level 1.

You have a binary response variable measured at level 2.

Unfortunately, you cannot jointly model responses in MLwiN which are measured at different levels. The only exception to this rule is when all response variables are continuous).

Here is an attempt to give some insight. If you just think about the binary response variable in isolation, you only have one measurement per individual. All you can do with this is to fit a single-level probit model. However, in the model you have set up you have in effect set up a two-level probit. What you really want is to define the binary response to be a single-level model at level-2 of the data hierarchy, but you cannot do this in MLwiN.

You can, however, fit this model in some other software packages including: AML, RealCom and WinBUGS. You cannot fit this model using Stata's inbuilt multilevel modelling commands (xtmixed, xtmelogit, and xtmepoisson). You may be able to fit it with the user-written gllamm command, but I haven't checked this.

However, none of the above explains why you received an error message in MLwiN 2.24, but not in MLwiN 2.23. We would like to get to the bottom of this as it may have implication for other models. Please will you email me a short do-file and data set which will allow me to replicate your error message.

Best wishes

George
Post Reply