umxEquate: umxEquate: Equate two or more paths

View source: R/build_run_modify.R

umxEquateR Documentation

umxEquate: Equate two or more paths

Description

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.

Usage

umxEquate(
  model,
  a,
  b,
  newlabels = NULL,
  free = c(TRUE, FALSE, NA),
  verbose = FALSE,
  name = NULL,
  autoRun = FALSE,
  tryHard = c("no", "yes", "ordinal", "search"),
  comparison = TRUE,
  master = NULL,
  slave = NULL
)

Arguments

model

An mxModel() within which to equate parameters listed in "a" with those in "b"

a

one or more labels to equate with those in the "b" set.

b

one or more labels to equate with those in the 'a' set. (if 'newlabels' is NULL, labels will be set to 'a' list).

newlabels

(optional) list of new labels for the equated parameters.

free

Must the parameter(s) initially 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 run the model (default), or just to create it and return without running.

tryHard

Default ('no') uses normal mxRun. "yes" uses mxTryHard. Other options: "ordinal", "search"

comparison

Compare the new model to the old (if updating an existing model: default = TRUE)

master

synonym for 'a'

slave

synonym for 'b'

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 = TRUE

Tip: To find labels by name, use the regex parameter of umxGetParameters()

Value

  • mxModel()

References

See Also

umxModify(), umxCompare()

Other Model Summary and Comparison: umxCompare(), umxMI(), umxReduce(), umxSetParameters(), umxSummary(), umx

Examples

## Not run: 
require(umx)
data(demoOneFactor)
manifests = names(demoOneFactor)
m1 = umxRAM("One Factor", data = demoOneFactor, type = "cov",
	umxPath("G", to = manifests),
	umxPath(var = manifests),
	umxPath(var = "G", fixedAt = 1)
)
# By default, umxEquate just equates master and slave labels: doesn't run model
m2 = umxEquate(m1, a = "G_to_x1", b = "G_to_x2", name = "Eq x1 x2 loadings")

# Set autoRun = TRUE and comparison = TRUE to run and output a comparison
m2 = umxEquate(m1, autoRun = TRUE, comparison = TRUE, name = "Eq_x1_x2",
	     a = "G_to_x1", b = "G_to_x2"
)

# rename the equated paths
m2 = umxEquate(m1, autoRun = TRUE, comparison = TRUE, name = "Eq_x1_x2",
	     a = "G_to_x1", b = "G_to_x2", newlabels = c("equated")
)
parameters(m2)

## End(Not run)

tbates/umx documentation built on April 10, 2024, 8:14 p.m.