Page 1 of 3

runmlwin error

Posted: Fri Jan 30, 2015 11:12 pm
by ali482002
Hi
I am trying to fit a two level ordinal model with runmlwin. Using the stata, I imputed level-1 missing variables(multiple imputation). Now, I get the "mi estimate: command not supported" error as I try the following syntax. Why this happened and is there any solution?

mi est, saving(miest) cmdoc: runmlwin V_outcome5 V_SEXID cons, level2( TheKey: cons) level1( V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(3)) nopause

I also tried the above syntax without mi est, again I got " type mismatch" error.

runmlwin V_outcome5 V_SEXID cons, level2( TheKey: cons) level1( V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(3)) nopause

I appreciate your advises
Best, Ali

Re: runmlwin error

Posted: Sat Jan 31, 2015 4:39 am
by GeorgeLeckie
Dear Ali,

Let's focus on the more fundamental problem of your "type mismatch" error. Its not immediately obvious what the source of this error is, so lease will you run the following two commands and then copy and paste the entire resulting Stata Results window output including any error messages for us.

Many thanks

George

Code: Select all

. tabulate V_outcome5, miss
. runmlwin V_outcome5 cons, level1(V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(3)) nopause

Re: runmlwin error

Posted: Sat Jan 31, 2015 5:07 am
by ali482002
Hi Dear George

I did what you asked me;

tabulate V_outcome5,miss

Code: Select all

 V_outcome5 |      Freq.     Percent        Cum.
------------+-----------------------------------
  No injury |     19,067       91.51       91.51
    Injured  |      1,610         7.73       99.23
       Dead  |        142          0.68       99.91
          .     |          18          0.09      100.00
-----------------------------------------------
      Total |     20,837      100.00
. runmlwin V_outcome5 cons, level1(V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategor
> y(3)) nopause

type mismatch
r(109);

Re: runmlwin error

Posted: Sat Jan 31, 2015 5:13 am
by GeorgeLeckie
Apologies, I didn't realise that you had value labels attached, try ...

Code: Select all

. tabulate V_outcome5, miss nolabel

Re: runmlwin error

Posted: Sat Jan 31, 2015 5:15 am
by ali482002

Code: Select all

. tabulate V_outcome5, miss nolabel

 V_outcome5 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     19,067       91.51       91.51
          2 |      1,610        7.73       99.23
          3 |        142        0.68       99.91
          . |         18        0.09      100.00
------------+-----------------------------------
      Total |     20,837      100.00

Re: runmlwin error

Posted: Sat Jan 31, 2015 5:30 am
by GeorgeLeckie
Strange, I had assumed the problem was that you did not have a response category coded "3", which is required as you choose to omit "basecategory(3)". One thing you could try is dropping observations with missing values before you fit the model as we have seen rare instances previously where runmlwin gets thrown by missing values.

So try...

Code: Select all

. drop if V_outcome5>=.
. runmlwin V_outcome5 cons, level1(V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(3)) nopause
By the way, more generally, I do note that your third category "dead" is very rare in your data and that might pose problems down the line when you start to specify more complex models.

Re: runmlwin error

Posted: Sat Jan 31, 2015 5:34 am
by ali482002
Yes, the third category is rare.
drop if V_outcome5>=.
(18 observations deleted)

. runmlwin V_outcome5 cons, level1(V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategor
> y(3)) nopause

type mismatch

Re: runmlwin error

Posted: Sat Jan 31, 2015 5:48 am
by GeorgeLeckie
I'm afraid it is still not obvious why you get the error you do. As you can see when I replicate your data I do not get any error...

COMMANDS

Code: Select all

. clear
. set obs  20819
. generate V_id = _n
. generate V_outcome5 = .
. replace V_outcome5 = 1 in 1/19067
. replace V_outcome5 = 2 in 19068/20678
. replace V_outcome5 = 3 in 20678/20819
. tabulate V_outcome5
. generate cons = 1
. runmlwin V_outcome5 cons, level1(V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(3)) nopause
. exit
OUTPUT

Code: Select all

. clear

. set obs  20819
obs was 0, now 20819

. generate V_id = _n

. generate V_outcome5 = .

. replace V_outcome5 = 1 in 1/19067
(19067 real changes made)

. replace V_outcome5 = 2 in 19068/20678
(1611 real changes made)

. replace V_outcome5 = 3 in 20678/20819
(142 real changes made)

. tabulate V_outcome5

 V_outcome5 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     19,067       91.58       91.58
          2 |      1,610        7.73       99.32
          3 |        142        0.68      100.00
------------+-----------------------------------
      Total |     20,819      100.00

. generate cons = 1

. runmlwin V_outcome5 cons, level1(V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecategory(3
> )) nopause
 
MLwiN 2.32 multilevel model                     Number of obs      =     20819
Ordered multinomial logit response model
Estimation algorithm: IGLS, MQL1

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3
           2 | 1 2 vs. 3
----------------------------------

Run time (seconds)   =      14.59
Number of iterations =          7
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |   2.387202   .0249644    95.62   0.000     2.338272    2.436131
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |   4.980548   .0830331    59.98   0.000     4.817807     5.14329
------------------------------------------------------------------------------
Please can you confirm that the above commands work on your computer?

Re: runmlwin error

Posted: Sat Jan 31, 2015 7:08 am
by ali482002
Hi Dear George

This is my computer outputs, but yet I have problem with "runmlwin command"

clear

. . set obs 20819
obs was 0, now 20819

. . generate V_id = _n

. . generate V_outcome5 = .
(20819 missing values generated)

. . replace V_outcome5 = 1 in 1/19067
(19067 real changes made)

. . replace V_outcome5 = 2 in 19068/20678
(1611 real changes made)

. . replace V_outcome5 = 3 in 20678/20819
(142 real changes made)

. . tabulate V_outcome5

V_outcome5 | Freq. Percent Cum.
------------+-----------------------------------
1 | 19,067 91.58 91.58
2 | 1,610 7.73 99.32
3 | 142 0.68 100.00
------------+-----------------------------------
Total | 20,819 100.00

.
. . generate cons = 1

.
. . runmlwin V_outcome5 cons, level1(V_id:) discrete(dist(multinomial) link(ologit) denom(cons) basecateg
> ory(3)) nopause

type mismatch
r(109);

Re: runmlwin error

Posted: Sat Jan 31, 2015 7:22 am
by ali482002
Dear George
I am wonder if I installed runmlwin properly on my computer. Although I installed it base on mnual several times and got "successful installation" message. How can I check that installation is correct?
Regards