Page 1 of 1

Cross-equation constraints

Posted: Wed Mar 18, 2015 5:38 pm
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.

Re: Cross-equation constraints

Posted: Thu Mar 26, 2015 10:55 am
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
------------------------------------------------------------------------------