Sets the value of the given parameter.

setParameterValue(object, ..., lst = NULL, error = "warn")



Distribution or ParameterSet.


named parameters and values to update, see details.


optional list, see details.


character, value to pass to stopwarn.


An R6 object of class ParameterSet.


Parameters can be updated in one of two ways, either by passing the parameters to update as named arguments or as a list with the the list names are parameter IDs and the list values are the respective values to set the parameters. Using a list may be preferred for parameters that take multiple values. See examples. If lst is given then any additional arguments are ignored.

stopwarn either breaks the code with an error if "error" is given or returns NULL with warning otherwise.

R6 Usage

$setParameterValue(..., lst = NULL, error = "warn")

See also

parameters and setParameterValue


ps <- Normal$new()$parameters() ps$setParameterValue(mean = 2, var = 5)$print()
#> id value support description #> 1: mean 2.000000 ℝ Mean - Location Parameter #> 2: var 5.000000 ℝ+ Variance - Squared Scale Parameter #> 3: sd 2.236068 ℝ+ Standard Deviation - Scale Parameter #> 4: prec 0.200000 ℝ+ Precision - Inverse Squared Scale Parameter
ps <- MultivariateNormal$new()$parameters() ps$setParameterValue(lst = list(mean = c(1,1)))$print()
#> id value support description #> 1: mean 1,1 ℝ^2 Vector of means - Location Parameter. #> 2: cov 1,0,0,1 ℝ^4 Covariance matrix - Scale Parameter. #> 3: prec 1,0,0,1 ℝ^4 Precision matrix - Scale Parameter. #> 4: K 2 ℕ+ Number of components