Learn R Programming

umx (version 1.4.0)

umxEquate: umxEquate

Description

In addition to dropping or adding parameters, a second common task in modelling 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.

Usage

umxEquate(model, master, slave, free = c(TRUE, FALSE, NA), verbose = TRUE, name = NULL, autoRun = getOption("umx_auto_run"), comparison = TRUE)

Arguments

model
An mxModel within which to equate parameters
master
A list of "master" labels to which slave labels will be equated
slave
A list of slave labels which will be updated to match master labels, thus equating the parameters
free
Should parameter(s) initally be free? (default = TRUE)
verbose
Whether to give verbose feedback (default = TRUE)
name
name for the returned model (optional: Leave empty to leave name unchanged)
autoRun
Whether to mxRun the model (default TRUE: the estimated model will be returned)
comparison
Compare the new model to the old (if updating an existing model: default = TRUE)

Value

- mxModel

Details

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

References

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

See Also

Other Modify or Compare Models: umxAdd1, umxDrop1, umxFixAll, umxGetParameters, umxMI, umxSetParameters, umxUnexplainedCausalNexus, umx

Examples

Run this code
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)
m2 = umxEquate(m1, master = "G_to_x1", slave = "G_to_x2", name = "Equate x1 and x2 loadings")
m2 = mxRun(m2) # have to run the model again...
umxCompare(m1, m2) # not good :-)

Run the code above in your browser using DataLab