Learn R Programming

hesim (version 0.4.1)

tparams_transprobs: Transition probabilities

Description

Create a list containing predicted transition probabilities at discrete times. Since the transition probabilities have presumably already been predicted based on covariate values, no input data is required for simulation. The class can be instantiated from either an array, a data.table, a data.frame, or a tpmatrix.

Usage

tparams_transprobs(object, ...)

# S3 method for array tparams_transprobs(object, times = NULL, grp_id = NULL, patient_wt = NULL)

# S3 method for data.table tparams_transprobs(object)

# S3 method for data.frame tparams_transprobs(object)

# S3 method for tpmatrix tparams_transprobs(object, tpmatrix_id)

Arguments

object

An object of the appropriate class.

...

Further arguments passed to or from other methods. Currently unused.

times

An optional numeric vector of distinct times to pass to time_intervals representing time intervals indexed by the 4th dimension of the array. May either be the start or the end of intervals. This argument is not required if there is only one time interval.

grp_id

An optional numeric vector of integers denoting the subgroups. Must be the same length as the 3rd dimension of the array.

patient_wt

An optional numeric vector denoting the weight to apply to each patient within a subgroup. Must be the same length as the 3rd dimension of the array.

tpmatrix_id

An object of class tpmatrix_id.

Value

An object of class tparams_transprobs, which is a list containing value and relevant ID attributes. The element value is an array of predicted transition probability matrices from the probability distribution of the underlying statistical model. Each matrix in value is a prediction for a sample, strategy_id, patient_id, and optionally time_id combination.

Details

The format of object depends on its class:

array

Must be a 4D array of matrices (i.e., a 6D array). The dimensions of the array should be indexed as follows: 1st (sample), 2nd (strategy_id), 3rd (patient_id), 4th (time_id), 5th (rows of transition matrix), and 6th (columns of transition matrix). In other words, an index of [s, k, i, t] represents the transition matrix for the sth sample, kth treatment strategy, ith patient, and tth time interval.

data.table

Must contain the following:

  • ID columns for the parameter sample (sample), treatment strategy (strategy_id), and patient (patient_id). If the number of time intervals is greater than 1 it must also contain the column time_start denoting the starting time of a time interval. A column patient_wt may also be used to denote the weight to apply to each patient.

  • Columns for each element of the transition probability matrix. They should be prefixed with "prob_" and ordered rowwise. For example, the following columns would be used for a 2x2 transition probability matrix: probs_1 (1st row, 1st column), probs_2 (1st row, 2nd column), probs_3 (2nd row, 1st column), and probs_4 (2nd row, 2nd column).

data.frame

Same as data.table.

tpmatrix_id

An object of class tpmatrix_id.

A tparams_transprobs object is also instantiated when creating a cohort discrete time state transition model using define_model().

See Also

define_model(), create_CohortDtstm()