I am new to OpenMx and trying to resolve a problem with non-positive definite covariance matrix. I have looked at other postings in this forum and it looks like it is a starting value problem although not sure. I have tried several combinations and keep getting the same error. I am listing my code and would appreciate any help.
Thanks
I keep getting the following error:
Running Political Democracy CFA
Error: The job for model 'Political Democracy CFA' exited abnormally with the error message: Backing out of parameter space region where expected covariance is non-positive-definite.
>
-----------------------------------------------------------------------------
Load Library
require(OpenMx)
-----------------------------------------------------------------------------
read Data
polidem.data <- read.csv('POLIDEM.csv')
head(polidem.data)
polidem.cfa <- polidem.data[,c("PRESS60","FREOP60","FREEL60","LEGIS60","PRESS65","FREOP65","FREEL65","LEGIS65")]
-----------------------------------------------------------------------------
manifde60=c("PRESS60","FREOP60","FREEL60","LEGIS60")
manifde65=c("PRESS65","FREOP65","FREEL65","LEGIS65")
manifest=c(manifde60,manifde65)
latents=c("demo60","demo65")
--start model-------
PolidemModel <- mxModel("Political Democracy CFA",
type="RAM",
mxData( observed=cov(polidem.cfa),
type="cov",numObs=75 ),
manifestVars=manifest,
latentVars=latents,
residual variances
mxPath(
from=manifest,
arrows=2,
free=TRUE,
values=c(1,0.8,0.8,0.8,0.8,0.8,0.8,0.8),
labels=c("e1","e2","e3","e4","e5","e6","e7","e8") ),
latent variances for exogenous
mxPath(
from=latents,
arrows=2,
free=TRUE,
values=c(0.6,0.6),
labels=c("varF1","varF2") ),
latent covariance
mxPath(
from="demo60",
to="demo65",
arrows=2,
free=TRUE,
values=c(0.5),
labels=c("covF1F2") ),
error covariance
mxPath(
from="PRESS60",to="PRESS65",
arrows=2,
free=TRUE,
values=c(.5),
labels=c("the15") ),
error covariance
mxPath(
from="FREOP60",to="FREOP65",
arrows=2,
free=TRUE,
values=c(.5),
labels=c("the26") ),
error covariance
mxPath(
from="FREEL60",to="FREEL65",
arrows=2,
free=TRUE,
values=c(.5),
labels=c("the37") ),
error covariance
mxPath(
from="LEGIS60",to="LEGIS65",
arrows=2,
free=TRUE,
values=c(.5),
labels=c("the48") ),
error covariance
mxPath(
from="FREOP60",to="LEGIS60",
arrows=2,
free=TRUE,
values=c(.5),
labels=c("the24") ),
error covariance
mxPath(
from="FREOP65",to="LEGIS65",
arrows=2,
free=TRUE,
values=c(.5),
labels=c("the68") ),
-------------------------------------
factor loadings for demo60 variables
mxPath(
from="demo60",
to=manifde60,
arrows=1,
free=c(FALSE,TRUE,TRUE,TRUE),
values=c(1,0.2,0.2,0.2),
labels=c("l1","l2","l3","l4") ),
factor loadings for demo65 variables
mxPath(
from="demo65",
to=manifde65,
arrows=1,
free=c(FALSE,TRUE,TRUE,TRUE),
values=c(1,0.2,0.2,0.2),
labels=c("l1","l2","l3","l4") )
-----------------------------------------------------------------------------
)
close model
-----------------------------------------------------------------------------
run model
PolidemFit <- mxRun(PolidemModel)
get summary
summary(PolidemFit)
get estmates
PolidemFit@output$estimate