Learn R Programming

hesim (version 0.5.5)

tpmatrix_id: Transition probability matrix IDs

Description

Creates ID variables for each row returned by tpmatrix(). This function is most conveniently used along with tpmatrix() to construct a tparams_transprobs() object.

Usage

tpmatrix_id(object, n_samples)

Value

Returns a tpmatrix_id object that inherits from data.table with the same columns in object repeated n_samples times. That is, to facilitate creation of a tparams_transprobs() object, there is one row for each parameter sample, treatment strategy, patient, and optionally time interval.

Arguments

object

An object of class expanded_hesim_data returned by expand.hesim_data(). This dataset must be expanded by treatment strategies, patients, and optionally time intervals.

n_samples

The number of parameters samples used for the probabilistic sensitivity analysis (PSA).

See Also

tpmatrix(), tparams_transprobs(), expand.hesim_data()

Examples

Run this code
strategies <- data.frame(strategy_id = c(1, 2))
patients <- data.frame(patient_id = seq(1, 3), age = c(65, 50, 75),
                        gender = c("Female", "Female", "Male"))
hesim_dat <- hesim_data(strategies = strategies,
                        patients = patients)
input_data <- expand(hesim_dat, by = c("strategies", "patients"))    
tpmatrix_id(input_data, n_samples = 2)                   

Run the code above in your browser using DataLab