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.

define_tparams(expr, times = NULL, ...)

eval_tparams(x, input_data, rng_params)

Arguments

expr

Expressions used to transform parameters. As with define_rng(), braces should be used so that the result of the last expression within the braces is evaluated. The expression must return a named list with the following possible elements:

  • tpmatrix: The transition probability matrix used to simulate transition probabilities in the economic model. This should either be the output of tpmatrix() or a 3-dimensional array as in tparams_transprobs().

  • utility: The utility values to attach to states and used to simulate quality-adjusted life-years in the economic model. Either a vector (in which case utility is the same in each health state) or a data.table/data.frame/matrix with a column for each (non-death) health state.

  • costs: A named list of costs for each category used to simulate costs in the economic model. Each element of the list must be in the same format as utility.

times

Distinct times denoting the stopping time of time intervals.

...

Additional arguments to pass to the environment used to evaluate expr.

x

An object of class tparams_def.

input_data

An object of class expanded_hesim_data (as in eval_model()) expanded by the distinct times in times.

rng_params

Random samples of the parameters returned by eval_rng().

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.

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().