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 = "A", to="B"), # factor loadings
mxPath(from = "B", to= c("C", "D") ), # factor loadings
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)