umx (version 1.9.1)

umxLatent: umxLatent: Helper to ease making formative and reflective latent variables

Description

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

Usage

umxLatent(latent = NULL, formedBy = NULL, forms = NULL, data = NULL,
  type = NULL, name = NULL, labelSuffix = "", verbose = TRUE)

Arguments

latent

the name of the latent variable (string)

formedBy

the list of variables forming this latent

forms

the list of variables which this latent forms (leave blank for formedBy)

data

the dataframe being used in this model

type

= \"exogenous|endogenous\"

name

A name for the path NULL

labelSuffix

a suffix string to append to each label

verbose

Default is TRUE as this function does quite a lot

Value

- path list

Details

The following figures show how a reflective and a formative variable look as path diagrams: formative

References

- http://www.github.com/tbates/umx

See Also

Other Core Modelling Functions: plot.MxModel, umxDiagnose, umxMatrix, umxPath, umxRAM, umxReduceACE, umxReduceGxE, umxRun, umxSuperModel, umx

Examples

Run this code
# 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 DataCamp Workspace