In addition to dropping or adding parameters, a second common task in modeling is to equate parameters. umx provides a convenience function to equate parameters by setting one or more parameters (the "slave" set) equal to one or more "master" parameters. These parameters are picked out via their labels, and setting two or more parameters to have the same value is accomplished by setting the slave(s) to have the same label(s) as the master parameters, thus constraining them to take the same value during model fitting.
umxEquate(model, master, slave, free = c(TRUE, FALSE, NA), verbose = TRUE,
name = NULL, autoRun = FALSE, comparison = TRUE)
An mxModel
within which to equate parameters
A list of "master" labels to which slave labels will be equated
A list of slave labels which will be updated to match master labels, thus equating the parameters
Should parameter(s) initially be free? (default = TRUE)
Whether to give verbose feedback (default = TRUE)
name for the returned model (optional: Leave empty to leave name unchanged)
Whether to mxRun the model (default TRUE: the estimated model will be returned)
Compare the new model to the old (if updating an existing model: default = TRUE)
- mxModel
note: In addition to using this method to equating parameters, you can also equate one parameter to another by setting its label to the "square bracket" address of the master, e.g. "a[r,c]".
Tip: To find labels of free parameters use umxGetParameters
with free = T
Tip: To find labels by name, use the regex parameter of umxGetParameters
Other Modify or Compare Models: umxAdd1
,
umxDrop1
, umxFixAll
,
umxMI
, umxSetParameters
,
umxUnexplainedCausalNexus
,
umx
# NOT RUN {
require(umx)
data(demoOneFactor)
latents = c("G")
manifests = names(demoOneFactor)
m1 <- mxModel("One Factor", type = "RAM",
manifestVars = manifests, latentVars = latents,
mxPath(from = latents, to = manifests),
mxPath(from = manifests, arrows = 2),
mxPath(from = latents, arrows = 2, free = FALSE, values = 1.0),
mxData(cov(demoOneFactor), type = "cov", numObs = 500)
)
m1 = umxRun(m1, setLabels = TRUE, setValues = TRUE)
# By default, umxEquate just equates master and slave labels
m2 = umxEquate(m1, master = "G_to_x1", slave = "G_to_x2", name = "Eq x1 x2 loadings")
# Set autoRun = TRUE and comparison = TRUE to run and output a comparison
m2 = umxEquate(m1, master = "G_to_x1", slave = "G_to_x2", name = "Eq x1 x2 loadings",
autoRun = TRUE, comparison = TRUE)
# }
Run the code above in your browser using DataLab