# NOT RUN {
library(umx)
data(demoOneFactor)
latents = c("G")
manifests = names(demoOneFactor) # x1-5
theData = cov(demoOneFactor)
m1 = mxModel("reflective", type = "RAM",
manifestVars = manifests,
latentVars = latents,
# Factor loadings
umxLatent("G", forms = manifests, type = "exogenous", data = theData),
mxData(theData, type = "cov", numObs = nrow(demoOneFactor))
)
m1 = umxRun(m1, setValues = TRUE, setLabels = TRUE); umxSummary(m1, show="std")
plot(m1)
m2 = mxModel("formative", type = "RAM",
manifestVars = manifests,
latentVars = latents,
# Factor loadings
umxLatent("G", formedBy = manifests, data = theData),
mxData(theData, type = "cov", numObs = nrow(demoOneFactor))
)
m2 = umxRun(m2, setValues = TRUE, setLabels = TRUE);
umxSummary(m2, show = "std")
plot(m2)
# }
Run the code above in your browser using DataLab