You are here

Error: NPSOL returned a non-zero status code 3

4 posts / 0 new
Last post
a.ortega's picture
Offline
Joined: 02/05/2011 - 08:55
Error: NPSOL returned a non-zero status code 3
AttachmentSize
Binary Data Script.R7 KB

Hello everyone!
I have prepared a model to estimate genetic and environmental influences (ACE) using a cholesky decomposition with ordinal twin data: 3 phenotypes, 7 categories in each of them. The sample is is divided in 6 groups (and so is the script), according to zygosity and sex: MZ men, DZ men, MZ women, DZ women, DZ man-woman and DZ woman-man. The script including this multivariate threshold model takes about an one and a half hour to be computed, and returns the following error:

"NPSOL returned a non-zero status code 3. The nonlinear constraints and bonuds could not be satisfied. The problem may have no feasible solution."

Any help to interpret the meaning of this error message would be very much appreciated. Is there any possibility to solve it? I have attached the script with the model in case somebody need to have a look.

Thanks a lot in advance!
Regards,
Alfredo

tbrick's picture
Offline
Joined: 07/31/2009 - 15:10
Status code 3 means that

Status code 3 means that you've specified constraints that cannot be met for some reason. Usually, this is because two constraints can never be simultaneously satisfied, or because the only point at which the mxConstraints can be satisfied is outside the bounds of the free parameters. I think that last is what's happening here.

Is nv greater than one in this script?

You constrain the sum of several x %*% t(x) multiplications to be I. If nv (the size of each of these matrices) is greater than one, there are off-diagonal elements of the result which are constrained to be zero (since the off-diagonal elements of I are zero).

This conflicts with the lbound on the lower triangular matrix elements in am, cm, em, af, cf, and ef; off-diagonal elements in those matrices must be above .001. With lower bounds above zero, the result of multiplication by its transpose should have strictly positive values in every element, and no sum of strictly positive values can ever be zero.

To get all off-diagonal elements to equal zero, you will need to change the lower bound for the off-diagonal elements of those original lower triangular matrices. Alternately, redefine your mxConstraints to only constrain the values on the diagonal of Vf or Vm.

a.ortega's picture
Offline
Joined: 02/05/2011 - 08:55
Solved!

Hi!
Thank you Timothy and Michael for your kind help. I understood perfectly the error message with your explanation, and I have been able to solve it rather quickly just with constraining only the values on the diagonal of Vf and Vm (as suggested) by including the following statement in the script:

  • mxMatrix( type="Full", nrow=nv, ncol=nv, free=c(F,T,T,F,F,T,F,F,F), values=c(0,.1,.1,0,0,.1,0,0,0), lbound=-1, ubound=1, name="bm"),
  • mxMatrix( type="Full", nrow=nv, ncol=nv, free=c(F,T,T,F,F,T,F,F,F),, values=c(0,.1,.1,0,0,.1,0,0,0), lbound=-1, ubound=1, name="bf"),

  • mxMatrix( type="Iden", nrow=nv, ncol=nv, name="nvI"),

  • mxMatrix( type="Iden", nrow=2, ncol=2, name="I2"),
  • mxAlgebra( expression=(solve(nvI-bm)) %&% Am+Cm+Em, name="Vm" ),
  • mxAlgebra( expression=(solve(nvI-bf)) %&% Af+Cf+Ef, name="Vf" ),

  • mxConstraint( expression=nvI*Vm==nvI, name="Var1m"),

  • mxConstraint( expression=nvI*Vf==nvI, name="Var1f"),

I also have adapted the calculation of the covariance matrices to avoid farther complications as follows:
+ mxAlgebra( expression= (I2 %x% solve(nvI-bm)) %&% rbind (cbind(Am+Cm+Em , Am+Cm), cbind(Am+Cm , Am+Cm+Em)), name="expCovMZm" ),

These changes in the script have worked rather well. Once more, thank you!
Best regards,
-Alfredo

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Some related helpful advice:

Some related helpful advice: take a look at file checkpointing in OpenMx. It might be useful in restoring the model state if it's running for 1.5 hours and then producing an error.