Cross-equation constraints

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
fonnyyyy
Posts: 13
Joined: Mon Jun 16, 2014 8:54 am

Cross-equation constraints

Post by fonnyyyy »

Short question; I am currently fitting multiprocess models without covariates. eq(1) leave stands for whether or not a certain person (id) is on parental leave at a certain point in time (pp_id). eq(2) event stands for whether or not a second birth occurs for a certain person (id) at a certain point in time (pp_id).

The code below results in a constant for both equations, variances of both constants at the id-level, and covariances between constant 1 and constant 2 at both level 1 and level 2. Can anyone give me advice on how to set up a constraint to fix the covariance of the constants at the pp_id level (level 1) to be zero?

global MLwiN_path C:\Program Files (x86)\MLwiN v2.32\i386\mlwin.exe
sort id pp_id
runmlwin (leave cons , eq(1)) /*
*/ (event cons , eq(2))/*
*/ ,level2 (id: cons) level1 (pp_id: cons) discrete(distribution(binomial binomial) link(probit) denom(cons cons)) maxiterations(1000) /*
*/ mlwinsettings(size(500000) levels(5) columns(1500) variables(300))
Thanking you in advance,
J.
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Cross-equation constraints

Post by ChrisCharlton »

You should be able to do this by using the diagonal option at level-1 to remove the covariance parameter from the model. Below is an example demonstrating this with the tutorial dataset:

Code: Select all

use http://www.bristol.ac.uk/cmm/media/runmlwin/tutorial, clear
generate binexam = (normexam>0)
generate binlrt = (standlrt>0)

// Model with covariance
runmlwin (binexam cons, equation(1)) (binlrt cons, equation(2)), level1(student:) discrete(distribution(binomial binomial) link(probit) denominator(cons cons)) nosort nopause

MLwiN 2.33 multilevel model                     Number of obs      =      4059
Multivariate response model
Estimation algorithm: IGLS, MQL1

Run time (seconds)   =       3.94
Number of iterations =          4
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
binexam      |
      cons_1 |   .0305734   .0196754     1.55   0.120    -.0079898    .0691365
-------------+----------------------------------------------------------------
binlrt       |
      cons_2 |   .0379884   .0196772     1.93   0.054    -.0005783    .0765551
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 1: student             |
                var(bcons_1) |          1   2.50e-18             1           1
        cov(bcons_1,bcons_2) |   .4191396   .0119239      .3957692    .4425099
                var(bcons_2) |          1   2.45e-18             1           1
------------------------------------------------------------------------------

// Model with covariance removed:
runmlwin (binexam cons, equation(1)) (binlrt cons, equation(2)), level1(student:, diagonal) discrete(distribution(binomial binomial) link(probit) denominator(cons cons)) nosort nopause

MLwiN 2.33 multilevel model                     Number of obs      =      4059
Multivariate response model
Estimation algorithm: IGLS, MQL1

Run time (seconds)   =       2.67
Number of iterations =          4
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
binexam      |
      cons_1 |   .0305734   .0196754     1.55   0.120    -.0079898    .0691365
-------------+----------------------------------------------------------------
binlrt       |
      cons_2 |   .0379884   .0196772     1.93   0.054    -.0005783    .0765551
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 1: student             |
                var(bcons_1) |          1          0             1           1
                var(bcons_2) |          1          0             1           1
------------------------------------------------------------------------------

Post Reply