Hi, I haven't used OpenMx before, but I started by trying an example from the LISREL book (Joreskog & Sorbom).
I've reproduced the LISREL sample below and my translation to OpenMx based on reading the beginners section in the help. The error message I get is:
"Error: The job for model 'ex6' exited abnormally with the error message: Backing out of parameter space region where expected covariance is non-positive-definite."
I'm probably doing something silly here. Any help much appreciated!
======= lisrel code ========
Stability of Alienation
Observed Variables
ANOMIA67 POWERL67 ANOMIA71 POWERL71 EDUC SEI
Covariance Matrix
11.834
6.947 9.364
6.819 5.091 12.532
4.783 5.028 7.495 9.986
-3.839 -3.889 -3.841 -3.625 9.610
-2.190 -1.883 -2.175 -1.878 3.552 4.503
Sample Size 932
Latent Variables Alien67 Alien71 Ses
Relationships
ANOMIA67 = 1Alien67
POWERL67 = Alien67
ANOMIA71 = 1Alien71
POWERL71 = Alien71
EDUC = 1*Ses
SEI = Ses
Alien67 = Ses
Alien71 = Alien67 Ses
Let the Errors of ANOMIA67 and ANOMIA71 Correlate
Let the Errors of POWERL67 and POWERL71 Correlate
Path Diagram
End of Problem
======= end lisrel code ========
======= openmx code ========
library(OpenMx)
varnames <- c('ANO67', 'POW67', 'ANO71', 'POW71', 'EDUC', 'SEI')
dat <- read.table('ex1-6.cov', header=FALSE, fill=TRUE, col.names=varnames)
mat <- as.matrix(dat)
rownames(mat) <- colnames(mat)
for (i in 1:6) {
for (j in 1:6) {
if (i < j) {
mat[i, j] <- mat[j, i]
}
}
}
manifests <- varnames
latents <- c('Ses', 'Alien67', 'Alien71')
model <- mxModel(name='ex6',
type='RAM',
manifestVars=manifests,
latentVars=latents,
mxPath(from=c('Ses'), to=c('SEI', 'Alien67', 'Alien71'), arrows=1, free=TRUE),
mxPath(from=c('Ses'), to=c('EDUC'), arrows=1, free=FALSE, values=1.0),
mxPath(from=c('Alien67'), to=c('Alien71', 'POW67'), arrows=1, free=TRUE),
mxPath(from=c('Alien67'), to=c('ANO67'), arrows=1, free=FALSE, values=1.0),
mxPath(from=c('Alien71'), to=c('POW71'), arrows=1, free=TRUE),
mxPath(from=c('Alien71'), to=c('ANO71'), arrows=1, free=FALSE, values=1.0),
mxPath(from=c('Alien67', 'Alien71'), arrows=2, free=TRUE),
mxPath(from=c('ANO67'), to=c('ANO71'), arrows=2, free=TRUE),
mxPath(from=c('POW67'), to=c('POW71'), arrows=2, free=TRUE),
mxPath(from=manifests, arrows=2, free=TRUE),
mxData(observed=mat, type='cov', numObs=932)
)
fit <- mxRun(model)
======= end openmx code ========