Helper to ease the creation of latent variables including formative and reflective variables (see below) For formative variables, the manifests define (form) the latent. This function takes care of intercorrelating manifests for formatives, and fixing variances correctly
umxLatent(latent = NULL, formedBy = NULL, forms = NULL, data = NULL,
type = NULL, name = NULL, labelSuffix = "", verbose = TRUE)
the name of the latent variable (string)
the list of variables forming this latent
the list of variables which this latent forms (leave blank for formedBy)
the dataframe being used in this model
= \"exogenous|endogenous\"
A name for the path NULL
a suffix string to append to each label
Default is TRUE as this function does quite a lot
- path list
The following figures show how a reflective and a formative variable look as path diagrams:
formative
Other Core Modelling Functions: plot.MxModel
,
umxDiagnose
, umxMatrix
,
umxPath
, umxRAM
,
umxReduce
, umxRun
,
umx
# 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