define_tparams {hesim} | R Documentation |
Define and evaluate transformed parameter expressions
Description
Transformed parameter expressions are used to transform the parameter
values sampled with eval_rng()
as a function of input data
(treatment strategies and patients) and time
intervals. These functions are used when evaluating an object of class
model_def
defined using define_model()
. The transformed parameters
are ultimately converted into tparams objects and used to simulate outcomes with an
economic model.
Usage
define_tparams(expr, times = NULL, ...)
eval_tparams(x, input_data, rng_params)
Arguments
expr |
Expressions used to transform parameters. As with
|
times |
Distinct times denoting the stopping time of time intervals. |
... |
Additional arguments to pass to the environment used to evaluate
|
x |
An object of class |
input_data |
An object of class expanded_hesim_data (as
in |
rng_params |
Random samples of the parameters returned by |
Details
define_tparams()
is evaluated when creating economic models as a
function of model_def
objects defined with define_model()
. Operations
are "vectorized" in the sense that they are performed for each unique combination
of input_data
and params
. expr
is evaluated in an environment including
each variable from input_data
, all elements of rng_params
, and a variable
time
containing the values from times
. The time
variable can be used
to create models where parameters vary as a function of time.
eval_tparams()
is not exported and is only meant for use within eval_model()
.
Value
define_tparams()
returns an object of class tparams_def
,
which is a list containing the unevaluated "transformation" expressions
passed to expr
, times
, and any additional arguments passed to
...
. eval_tparams()
evaluates the tparams_def
object
and should return a list of transformed parameter objects.