Error message: ...Constraint matrix is invalid...

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
michaellawton
Posts: 11
Joined: Tue Nov 22, 2011 10:40 pm

Error message: ...Constraint matrix is invalid...

Post by michaellawton »

Hello

I had a multilevel growth curve model programed in runmlwin on my desktop using MLwiN 2.23. The program included constraints such as:

constraint define 1 [RP2]var(cons) = 0.259
constraint define 2 ...

runmlwin ... constraint(1/4)

The program worked fine, however I am now trying to run the same program on a laptop using MLwiN 2.24 and I get the following error message

"Row 1 of the constraint matrix is invalid as it involves both fixed part and random part parameters"

Any help on how to fix this would be greatly appreciated. Many thanks, Michael
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Error message: ...Constraint matrix is invalid...

Post by GeorgeLeckie »

Hi Michael,

In the latest release of runmlwin we made runmlwin backwards compatible with Stata versions 9 and 10. However, a bug crept in relating to the constraints.

We have now fixed the bug for the next SSC release.

Michael, I will email you the fix. If anyone else would like the fix then please contact me by replying to this post.

Below is a rather contrived example where we constrain the the random part parameters of a linear growth curve model to be specific values. The example shows what the runmlwin output should look like after you have applied the fix.

Code: Select all

. use "http://www.stata-press.com/data/mlmus2/asian.dta", clear

. 
. gen cons = 1

. 
. gen age2 = age^2

. 
. runmlwin weight cons age age2, ///
>         level2(id: cons age) ///
>         level1(occ: cons) ///
>         nopause
 
MLwiN 2.24 multilevel model                     Number of obs      =       198
Normal response model
Estimation algorithm: IGLS

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
             id |       68          1        2.9          5
-----------------------------------------------------------

Run time (seconds)   =       1.58
Number of iterations =          7
Log likelihood       = -258.07785
Deviance             =   516.1557
------------------------------------------------------------------------------
      weight |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        cons |   3.494518   .1372489    25.46   0.000     3.225515     3.76352
         age |   7.704002   .2394275    32.18   0.000     7.234733    8.173271
        age2 |  -1.660475   .0885319   -18.76   0.000    -1.833994   -1.486955
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: id                  |
                   var(cons) |   .4040045   .1412488      .1271619    .6808471
               cov(cons,age) |    .088273   .0812774     -.0710279    .2475738
                    var(age) |   .2539857   .0858503      .0857222    .4222493
-----------------------------+------------------------------------------------
Level 1: occ                 |
                   var(cons) |    .331641   .0532307      .2273107    .4359712
------------------------------------------------------------------------------

. 
. constraint define 1 [RP2]var(cons)      = 0.5   

. constraint define 2 [RP2]cov(cons\age)  = 0.1   

. constraint define 3 [RP2]var(age)       = 0.25  

. constraint define 4 [RP1]var(cons)      = 0.3   

.         
. runmlwin weight cons age age2, ///
>         level2(id: cons age) ///
>         level1(occ: cons) ///
>         constraints(1/4) nopause
 
 ( 1)  [RP2]var(cons) = .5
 ( 2)  [RP2]cov(cons\age) = .1
 ( 3)  [RP2]var(age) = .25
 ( 4)  [RP1]var(cons) = .3
MLwiN 2.24 multilevel model                     Number of obs      =       198
Normal response model
Estimation algorithm: IGLS

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
             id |       68          1        2.9          5
-----------------------------------------------------------

Run time (seconds)   =       1.37
Number of iterations =          2
Log likelihood       = -258.49789
Deviance             =  516.99579
------------------------------------------------------------------------------
      weight |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        cons |   3.489141   .1388873    25.12   0.000     3.216926    3.761355
         age |   7.713635   .2307907    33.42   0.000     7.261294    8.165977
        age2 |  -1.663078   .0850955   -19.54   0.000    -1.829862   -1.496294
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: id                  |
                   var(cons) |         .5   6.32e-09            .5          .5
               cov(cons,age) |         .1   2.85e-09            .1          .1
                    var(age) |        .25   1.64e-09           .25         .25
-----------------------------+------------------------------------------------
Level 1: occ                 |
                   var(cons) |         .3   6.37e-09            .3          .3
------------------------------------------------------------------------------

Best wishes

George
Post Reply