You are here

non-positive-definite when arrows=2

4 posts / 0 new
Last post
JWiley's picture
Offline
Joined: 03/25/2011 - 07:53
non-positive-definite when arrows=2

Whenever I try to fit models and add covariances with arrows=2, I always have a heck of a time getting the model past the 'expected covariance is non-positive definite' error. Is this normal? I do not have nearly this much trouble with arrows = 1. Here is a little example using a built in dataset:

#

summary(mxRun(m <- mxModel("Example", type = "RAM",
manifestVars = colnames(ability.cov$cov), latentVars = "G",
mxData(ability.cov$cov, type = "cov", numObs = ability.cov$n.obs),
mxPath(from = "G", to = colnames(ability.cov$cov)),
mxPath(from = colnames(ability.cov$cov), arrows = 2),
mxPath(from = "G", arrows = 2, values = 1, free = FALSE))))

summary(mxRun(mxModel(m, mxPath(from = "vocab", to = "reading", arrows = 2, values = 41))))
summary(mxRun(mxModel(m, mxPath(from = "vocab", to = "reading", arrows = 2, values = -.1))))
summary(mxRun(mxModel(m, mxPath(from = "vocab", to = "reading", arrows = 1, values = .4))))
summary(mxRun(mxModel(m, mxPath(from = "vocab", to = "reading", arrows = 1, values = 2))))

#

even knowing (from the second attempt), that one estimate that works well is 41.579037 and setting a starting value of 41, it runs into problems. Is there a reason it seems more sensitive to start values with covariances than just paths?

neale's picture
Offline
Joined: 07/31/2009 - 15:14
arrows=2 adds covariance but not variance

Arrows=2 between two different variables generates covariance between them but not variance within either. Therefore it is quite easy to generate a covariance matrix with larger covariances than variances, which is perforce non-positive definite.

The 41 you choose for a starting value is in some conflict with the value of 0 (which would be treated as .01) for residual variance of each, given in the mxPath(from = colnames(ability.cov$cov), arrows = 2) statement. Supplying values for the residuals (say the variance of each variable) and zero as starting values for the covariance paths would probably help a lot.

JWiley's picture
Offline
Joined: 03/25/2011 - 07:53
Thanks! That makes a lot of

Thanks! That makes a lot of sense and is really helpful. I guess I always just saw the error and never thought about what it meant (i.e., when is a matrix positive definite or not). Is it a bad sign that I'm actually excited to go back and try some of my models and see how much easier it is keeping your comments in mind??

Ryne's picture
Offline
Joined: 07/31/2009 - 15:12
No, it means you're one of

No, it means you're one of us. Welcome!