Hello,
We're trying to run a joint model with two response variables. For one response, we need to fix some of the covariances between level 2 random effects to zero. In mlwin, this model runs fine and everything looks nice.
In runmlwin, I can't get it to set the covariances to zero. I tried the same syntax as I would use in a single response model, i.e.:
matrix a = (1,1,1,0,0,1)
sort id num
runmlwin (kcal cons s1_07 s1_7_max source childcomp evalid2 evalid3 ///
male males1_07 males1_7_max, eq(1)) (bmi cons , eq(2)), ///
level2(id: (cons s1_07 s1_7_max, eq(1) reset(none)) (cons , reset(none) eq(2)) ) level1(seq: (cons agewk source, reset(none) elements(a) eq(1)))
It completely ignored this and estimated all terms of the covariance matrix.
So I tried using constraints:
constraint define 1 [RP1]cov(cons_1\source_1) = 0
constraint define 2 [RP1]cov(source_1\agewk_1) = 0
sort id num
runmlwin (kcal cons s1_07 s1_7_max source childcomp evalid2 evalid3 ///
male males1_07 males1_7_max, eq(1)) (bmi cons , eq(2)), ///
level2(id: (cons s1_07 s1_7_max, eq(1) reset(none)) (cons , reset(none) eq(2)) ) level1(seq: (cons agewk source, reset(none) eq(1))) constraints(1/2) maxiter(100)
In this model, the covariances were NEARLY zero, but not quite! And having them estimated causes problems, as the model cannot then estimate the variance of the level 1 random effect for one term (source).
Any ideas on how to fix these covariances to zero?
Many thanks,
Laura
constraints in joint model
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: constraints in joint model
Hi Laura,
Here is a somewhat artificial example of what you are after, Note that reset() and elements() are options that apply to the whole level. They are not equation specific options within each level. So you only need to specify them once.
Best wishes
George
Here is a somewhat artificial example of what you are after, Note that reset() and elements() are options that apply to the whole level. They are not equation specific options within each level. So you only need to specify them once.
Code: Select all
. use http://www.bristol.ac.uk/cmm/media/runmlwin/tutorial, clear
. matrix a = (1,1,1,0,0,1)
. runmlwin ///
> (normexam cons girl vrband, eq(1)) ///
> (standlrt cons girl vrband, eq(2)) ///
> , ///
> level2(school: ///
> (cons, eq(1)) ///
> (cons, eq(2)) ///
> ) ///
> level1(student: ///
> (cons vrband, eq(1)) ///
> (cons, eq(2)) ///
> , elements(a) ///
> ) nopause
MLwiN 2.26 multilevel model Number of obs = 4059
Multivariate response model
Estimation algorithm: IGLS
-----------------------------------------------------------
| No. of Observations per Group
Level Variable | Groups Minimum Average Maximum
----------------+------------------------------------------
school | 65 2 62.4 198
-----------------------------------------------------------
Run time (seconds) = 6.86
Number of iterations = 5
Log likelihood = -9086.1338
Deviance = 18172.268
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
normexam |
cons_1 | 1.375687 .059028 23.31 0.000 1.259994 1.49138
girl_1 | .187321 .0336435 5.57 0.000 .1213811 .253261
vrband_1 | -.8016609 .0200792 -39.93 0.000 -.8410153 -.7623065
-------------+----------------------------------------------------------------
standlrt |
cons_2 | 1.949292 .0427322 45.62 0.000 1.865539 2.033046
girl_2 | .0559293 .0272636 2.05 0.040 .0024936 .109365
vrband_2 | -1.077162 .0175952 -61.22 0.000 -1.111648 -1.042677
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: school |
var(cons_1) | .0951694 .0188035 .0583152 .1320236
cov(cons_1,cons_2) | .0250439 .0076361 .0100774 .0400103
var(cons_2) | .0207908 .0051307 .0107347 .0308469
-----------------------------+------------------------------------------------
Level 1: student |
var(cons_1) | .5739033 .0991005 .3796699 .7681366
cov(cons_1,vrband_1) | .0054021 .0554558 -.1032893 .1140935
var(vrband_1) | .0024659 .0291387 -.0546448 .0595767
var(cons_2) | .4741683 .0106074 .4533782 .4949585
------------------------------------------------------------------------------
George
Re: constraints in joint model
Thanks George, all working fine now!
L
L