OpenMx script - error message

1 reply [Last post]
Simo's picture
Offline
Joined: 07/25/2010

Hi there,

I am new to OpenMx and trying to fit a factor model. The main part of the script used is shown below:

> manifests <-names(hetcor_T)
> latents <-c("F1","F2","F3","F4")
> twofactorModel<-mxModel(name = "Four Factor Model Path Specification",type="RAM",manifestVars = manifests, latentVars = manifests,
+ mxData(observed=cov(hetcor_T),type="cov",numObs=709),
+ # residual variances
+ mxPath(from= manifests, arrows=2), # latent variances and covariance
+ mxPath(from= latents, arrows=2), # factor loadings for business performance measure variables
+ mxPath(
+ from=c("F1"),
+ to=c("a6e","a6f","a6g","a6h"),
+ arrows=1,
+ all =TRUE,
+ free = TRUE,
+ values=c(1),
+ labels=c("d1","d2","d3","d4")
+ ), #factor loadings for the external environmental factor variables
+ mxPath(
+ from=c("F2"),
+ to=c("a9aa","a9ab","a9ac","a9ad"),
+ arrows=1,
+ free= TRUE,
+ all = TRUE,
+ values=c(1),
+ labels=c("d5","d6","d7","d8")
+ ), #factor loadings for the competitive strategies variables
+ mxPath(
+ from=c("F3"),
+ to=c("a5aa","a5ab","a5ac","a5ad"),
+ arrows=1,
+ free=TRUE,
+ all = TRUE,
+ values=c(1),
+ labels=c("dl5","dl6","d17","d18")
+ ), #factor loadings for the manufacturing strategies variables
+ mxPath(
+ from=c("F4"),
+ to=c("b4a","b4b","b4c","b4d"),
+ arrows=1,
+ free=TRUE,
+ all = TRUE,
+ values=c(1),
+ labels=c("s26","s27","d28","d29")
+ )
+

However when I run this script, I get an error message which reads:
"Error: The following variables cannot be both latent and manifest: 'a6e', 'a6f', 'a6g', 'a6h', 'a5aa', 'a5ab', 'a5ac', 'a5ad', 'b4a', 'b4b', 'b4c', 'b4d', 'a9aa', 'a9ab', 'a9ac', 'a9ad' "

I do not understand where I have treated these as latent variables rather than as manifests.

Any help would be greatly appreciated.

Thanks

Simo

mspiegel's picture
Offline
Joined: 07/31/2009
The third line of your script

The third line of your script is:

mxModel(name = "Four Factor Model Path Specification",type="RAM",manifestVars = manifests, latentVars = manifests,

I think you meant:

mxModel(name = "Four Factor Model Path Specification",type="RAM",manifestVars = manifests, latentVars = latents,