Page 1 of 1

constraint in MVML model

Posted: Mon Oct 19, 2020 8:19 pm
by guobl
H Chris, George and all listers,
I am playing constraint for MVML model but the following code not working.

use "", clear
constraint drop _all
constraint define 1 [RP1]var(cons_1) = var(cons_2) // equal level 1 variance for both Y variable
constraint define 2 _b(female_1)=_b(female_2) // equal coefficient across equation
runmlwin (written cons female, eq(1)) (csework cons female, eq(2)), ///
level2(school: (cons, eq(1)) (cons, eq(2))) ///
level1(student: (cons, eq(1)) (cons, eq(2))) constraint 1/2 nopause

option constraint incorrectly specified

I know how to set parameters equal if using MLwiN test and interval. any help here please? thanks.

Re: constraint in MVML model

Posted: Tue Oct 20, 2020 9:51 am
by ChrisCharlton
You may just be missing the brackets for the option. For example syntax using constraints see chapter 18 of the MLwiN User's guide replication script: ... d_Data.log.

Re: constraint in MVML model

Posted: Wed Oct 21, 2020 3:45 pm
by guobl
thank you Chris.
to share the tricks playing constraint for MVML model, I noticed when pickup a parameter, we need add equation numbers as suffix. see for example even variable female included only in equation 2, we still need use female_2 when coding constraint. originally I thought the suffix number was because they are included in all equations. because if the model not run, we can't use matrix list e(V) or e(b) get parameter name. hope its useful.