This function store the values in the environment and update
their values in the closed form expression of y
. However, if the parameter
is not directly used by the closed form expression, user should override
this method to correctly set the parameter.
Arguments
- prm_name
List or Vector. Parameter character names.
- prm_val
List or Vector. Parameter values.
Examples
# Instantiate
x <- rand_uniform()
e <- rand_normal()
test <- vi_model(prm = list(a = 1, x = x, e = e),
prm_type = list(a = "o", x = "r", e = "r"),
formula = y ~ 1 + a * x + x^2 + e,
null_formula = y ~ x,
alt_formula = y ~ x + I(x^2))
test
#>
#> ── <VI_MODEL object>
#> y = 1 + a * x + x^2 + e
#> - x: <RAND_UNIFORM object>
#> [a: 0, b: 1]
#> - e: <RAND_NORMAL object>
#> [mu: 0, sigma: 1]
#> Parameters:
#> - a: 1
test$set_prm("a", 2)
test
#>
#> ── <VI_MODEL object>
#> y = 1 + a * x + x^2 + e
#> - x: <RAND_UNIFORM object>
#> [a: 0, b: 1]
#> - e: <RAND_NORMAL object>
#> [mu: 0, sigma: 1]
#> Parameters:
#> - a: 2