Learn R Programming

umx (version 4.20.0)

umxSetParameters: Change or fix parameters (e.g. their values, labels, bounds, ..) in a model.

Description

umxSetParameters is used to alter values, and other parameter properties in an mxModel(). A common use is setting new values and changing parameters from free to false. Note: If you just want to modify and re-run a model, you probably want umxModify().

Usage

umxSetParameters(
  model,
  labels,
  free = NULL,
  values = NULL,
  newlabels = NULL,
  lbound = NULL,
  ubound = NULL,
  indep = FALSE,
  strict = TRUE,
  name = NULL,
  regex = FALSE,
  test = FALSE
)

Value

  • mxModel()

Arguments

model

an mxModel() to set parameters in.

labels

= labels to find

free

= new value for free

values

= new values

newlabels

= newlabels

lbound

= value for lbound

ubound

= value for ubound

indep

= whether to look in indep models

strict

whether to complain if labels not found

name

= new name for the returned model

regex

patterns to match for labels (or if TRUE, use labels as regular expressions)

test

Just show what you would do? (defaults to FALSE)

Details

Using umxSetParameters, you use labels= to select the parameters you want to update. You can set their free/fixed state with free=, and set new values with values = . Likewise for bounds.

umxSetParameters supports pattern matching (regular expressions) to select labels. Set regex= to a regular expression matching the labels you want to select. e.g. "G_to_.*" would match "G_to_anything".

Details Internally, umxSetParameters is equivalent to a call to omxSetParameters where you have the ability to generate a pattern-based label list, and, because this can create duplicate labels, we also call omxAssignFirstParameters() to equate the start values for parameters which now have identical labels.

References

See Also

  • umxModify(), xmuLabel()

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

Examples

Run this code
if (FALSE) {
require(umx)
data(demoOneFactor)
latents  = c("G")
manifests = names(demoOneFactor)
m1 = umxRAM("One Factor", data = mxData(demoOneFactor[1:80,], type = "raw"),
	umxPath(from = latents, to = manifests),
	umxPath(v.m. = manifests),
	umxPath(v1m0 = latents)
)
parameters(m1)
# Match all labels
umxSetParameters(m1, regex = "^", newlabels= "m1_", test = TRUE)
# Change path to x1 to x2, equating these two paths
m2 = umxSetParameters(m1, "G_to_x1", newlabels= "G_to_x2", test = FALSE)
parameters(m2) 

}

Run the code above in your browser using DataLab