View source: R/build_run_modify.R
umxSetParameters | R Documentation |
umxSetParameters
is used to alter values, and other parameter properties in an OpenMx::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()
.
umxSetParameters(
model,
labels,
free = NULL,
values = NULL,
newlabels = NULL,
lbound = NULL,
ubound = NULL,
indep = FALSE,
strict = TRUE,
name = NULL,
regex = FALSE,
test = FALSE
)
model |
an |
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) |
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 OpenMx::omxAssignFirstParameters()
to equate the start values for parameters which now have identical labels.
OpenMx::mxModel()
umxModify()
, xmuLabel()
Other Model Summary and Comparison:
umx
,
umxCompare()
,
umxEquate()
,
umxMI()
,
umxReduce()
,
umxSummary()
## Not run:
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)
m2 = umxRun(m2) # umxSetParameters does not re-run he model, so make sure you do!
parameters(m2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.