Backing out of parameter space region where expected covariance is non-positive-definite

3 replies [Last post]
Offline
Joined: 07/31/2009

hi,
I think this model should run successfully.

# Fig2.12 from John Loehlin edition 4, p85
require(OpenMx)
# Get the data
names = c("A","C","D")
data=matrix(c(1, .3, .4, .3, 1, .35, .4, .35, 1), nrow=3, byrow=TRUE, dimnames=list(r=names, c=names))

# Get the manifest variable names from the data
manifests = row.names(data)
# Latents (in this case just B)
latents = c("B")

# Describe the model
model = mxModel("prob2-12", type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from = c("B", "C", "D"), arrows=2), # residual variances
mxData(data, type="cov",numObs=100)
)

# Run the model and save the fit
fit = mxRun(model)
# Running prob2-12
# Error: The job for model 'prob2-12' exited abnormally with the error message: Backing out of parameter space region where expected covariance is non-positive-definite.

# Output the summary
summary(fit)
# expecting a->b = .5855; b->c = .5223; b->d = .6831

Offline
Joined: 07/31/2009
No variance of variable "A"

No variance of variable "A" has been specified. Despite the absence of starting values for the parameters, the following modified statement is sufficient to let it run:

mxPath(from = c("A","B", "C", "D"), arrows=2), # residual variances

but the estimates are off per your expectations:

name matrix row col Estimate Std.Error
1 A B A 0.6796807 0.19038822
2 A C B 0.4413833 0.13523748
3 A D B 0.5885115 0.17372490
4 S A A 0.9999998 0.10054987
5 S C C 0.7374998 0.09533513
6 S D D 0.5333327 0.12144355
7 S B B 0.8854357 0.37899839

I don't have Loehlin (er, well, nor his book) in front of me, but perhaps specifications are off?

Offline
Joined: 07/31/2009
Thanks Mike! Diagram is drawn

Thanks Mike!

Diagram is drawn in with the residual variances, but without the variance of A: correct figure now provided :-)

We could helpfully throw an error when there are variables in the model which are not constants but which have no variance.

Also, you can leave variables in the data, but not model any relationships for them. Of course such orphans are legal, but when accompanied by a code green or worse, it might be handy to say "I see varX in the data but not the model"

e.g. where a warning would be helpful

```# Fig2.12 from John Loehlin edition 4
require(OpenMx)
names = c("A","C","D")
data=matrix(c(
1,  .2, .24,
.2,   1, .3,
.24, .3,  1), nrow=3, byrow=TRUE, dimnames=list(r=names, c=names)
)
manifests = row.names(data); latents   = c("B")

model = mxModel("prob2-12", type="RAM",
manifestVars = manifests,
latentVars   = latents,
# mxPath(from = "A", to="B", arrows=1),
mxPath(from = "B", to= c("C", "D"), arrows=1 ),
mxPath(from = c("A", "B", "C", "D"), arrows=2),   # residual variances
mxData(data, type="cov",numObs=100)
)

myOmxGraphviz(mxRun(model), "test.dot"); system("open test.dot")
# A not in the model: Be nice for that to throw a warning```

Offline
Joined: 07/31/2009
Despite the absence of

Despite the absence of starting values for the parameters

RAM type models will use default starting values if none are given for free parameters. They can be changed by modifying options('mxRAMDefaultDouble') and options('mxRAMDefaultSingle'), which are both set to 1 by default.