Constraint on variance of ordinal variables

5 replies [Last post]
Fruhling's picture
Offline
Joined: 06/09/2010

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")

Hermine's picture
Offline
Joined: 07/31/2009
warning when constraint is not being met

This is a new but related comment. The constraint on the variances in binary/ordinal model is essential to the models. However, OpenMx will produce results - granted with a code RED - when constraints are not satisfied, which makes them useless (in my opinion).

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.

mspiegel's picture
Offline
Joined: 07/31/2009
Hi. The syntax for

Hi. The syntax for mxConstraint() has changed. See http://openmx.psyc.virginia.edu/2010/04/openmx-030-read-me

neale's picture
Offline
Joined: 07/31/2009
Yes. Please note that we try

Yes. Please note that we try to avoid changes that render previous scripts inoperable. There is a small license for us to do so while the software is in beta. In August, when version 1.0 is due to be released, the syntax will be fixed and backward compatibility will be maintained in future releases.

jarrode28's picture
Offline
Joined: 03/01/2010
unable to constrain variances of binary variables

Has there been a solution to this problem? I seem to be having this problem with the newer functions when constraining a saturated model:

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

neale's picture
Offline
Joined: 07/31/2009
Because you are using a Cholesky

The variances are not equated because the Cholesky matrix is being multiplied by its transpose to form the expected:

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.