Hello,
I have a problem when defining constraint in a multigroup SEM using constraint define.
Taking the example 23 in Stata SEM Reference manual, say we want to constrain the first factor loading in group 1 to be equal to the first factor loading in group 2, we would write:
This command works fine and Stata displays in particular:
which is the constraint we defined in the path notation.
However, if we run :
We have this error :
For specific reasons, I would like to use the constraint command rather than having to constrain coefficients in the path notation.
I believe the constraint is well defined because Stata doesn't ignore it, but I do not understand why I get the error message, whereas defining constraints for intercepts or error variance (using constraint define), there is no error message and the SEM is estimated as expected.
Thank you,
I have a problem when defining constraint in a multigroup SEM using constraint define.
Taking the example 23 in Stata SEM Reference manual, say we want to constrain the first factor loading in group 1 to be equal to the first factor loading in group 2, we would write:
Code:
use http://www.stata-press.com/data/r15/sem_2fmmby sem (1:Peer -> peerrel1@f ) (2:Peer -> peerrel1@f ) (Peer -> peerrel2 peerrel3 peerrel4) (Par -> parrel1 parrel2 parrel3 parrel4), group(grade) ginvariant(none) mean(Peer@0) mean(Par@0) var(Peer@1) var(Par@1)
Code:
( 1) [peerrel1]1bn.grade#c.Peer - [peerrel1]2.grade#c.Peer = 0
However, if we run :
Code:
constraint 1 [peerrel1]1.grade#Peer = [peerrel1]2.grade#Peer sem (Peer -> peerrel1 peerrel2 peerrel3 peerrel4) (Par -> parrel1 parrel2 parrel3 parrel4), group(grade) ginvariant(none) constraint (1)
Code:
_sem_build__attach_cns(): 3204 gytree[1,2] found where scalar required _sem_build__merge_options(): - function returned error _sem_build__params(): - function returned error _sem_build(): - function returned error _sem_parse(): - function returned error st_sem_parse_and_build(): - function returned error <istmt>: - function returned error
I believe the constraint is well defined because Stata doesn't ignore it, but I do not understand why I get the error message, whereas defining constraints for intercepts or error variance (using constraint define), there is no error message and the SEM is estimated as expected.
Thank you,