Constraint on variance of ordinal variables
Posted on
Fruhling
Joined: 06/09/2010
Forums
Hi,
Why is the mxConstraint command not working anymore?
How else is one to constrain the variances to unity?
Thanks.
Fruhling
# Algebra to compute total variances and standard deviations (diagonal only)
mxAlgebra( expression=A+C+E, name="V" ),
mxMatrix( type="Iden", nrow=nv, ncol=nv, name="I"),
mxAlgebra( expression=solve(sqrt(I*V)), name="sd"),
# Constraint on variance of ordinal variables
mxConstraint( alg1="V", "=", alg2="I", name="Var1"),
Error in mxConstraint(alg1 = "V", "=", alg2 = "I", name = "Var1") :
unused argument(s) (alg1 = "V", alg2 = "I")
Hi. The syntax for
Log in or register to post comments
In reply to Hi. The syntax for by mspiegel
Yes. Please note that we try
Log in or register to post comments
In reply to Yes. Please note that we try by neale
unable to constrain variances of binary variables
equateCLtwinsVarMmodel <- univTwinSatFit
equateCLtwinsVarMmodel <- omxSetParameters( equateCLtwinsVarMab1Model, label="tCL1", free=TRUE, newlabels="tCL")
equateCLtwinsVarMmodel <- omxSetParameters( equateCLtwinsVarMab1Model, label="tCL2", free=TRUE, newlabels="tCL")
equateCLtwinsVarMmodel <- omxSetParameters( equateCLtwinsVarMab1Model, label="CLvar1", free=TRUE, newlabels="VarCL")
equateCLtwinsVarMmodel <- omxSetParameters( equateCLtwinsVarMab1Model, label="CLvar2", free=TRUE, newlabels="VarCL")
Which provides the following estimates -- via expectedMeansCovariances(equateCLtwinsVarMFit):
model:CL, covariance:expCovCL
ab1_1 ab1_2
ab1_1 1.5322235 0.8182838
ab1_2 0.8182838 1.9692279
model:CL, thresholds:expThreCL
ab1_1 ab1_2
[1,] 1.699601 1.699601
Despite the variances having the same label -- via parameterSpecifications(equateCLtwinsVarMmodel):
model:CL, matrix:CholCL
[,1] [,2]
[1,] [VarCL] 0
[2,] [CLcov] [VarCL]
model:CL, matrix:expThreCL
ab1_1 ab1_2
[1,] [tCL] [tCL]
Oddly, when I try to constrain variances across twin pairs, it isn't problematic. That is, I can constrain the variance for twin 1 in one group (e.g., opposite-sex females) with twin 1 in another group (same-sex females), but I am unable to constrain the variance within twin pairs (i.e., twin 1 & twin 2 from a same-sex female pair).
Thanks,
Jarrod
Log in or register to post comments
In reply to unable to constrain variances of binary variables by jarrode28
Because you are using a Cholesky
VarCL 0 * VarCL CLcov
CLcov VarCL 0 VarCL
=
VarCL^2 VarCL*CLcov
VarCL*CLcov VarCL^2+CLcov^2
and VarCL^2 won't equal VarCL^2+CLcov^2 unless CLcov is zero.
You could use non-linear constraint mxConstraint(expCovCL[1,1]==expCovCL[2,2],name="constrainVars") to effect the equality on the expCovCL variances.
Log in or register to post comments
warning when constraint is not being met
Is there a way that optimization can be forced to continue when constraints are not met, unless constraints cannot be satisfied, in which case a specific warning to that effect would be useful.
I'm running an example where upon refitting the model from the solution, slight changes occur in the likelihood for most runs but only by the fifth run or so are the constraints (close to be) satisfied.
Thanks,
Hermine.
Log in or register to post comments