An object of class survival stores survival probabilities. It is typically returned by Psm$sim_survival() or PsmCurves$survival(); however, it can also be constructed "manually" from existing data using the survival() function as described below. The latter option is useful if survival modeling has been performed by an R package other than those that integrate with hesim ( currently flexsurv). In this case a simulation model can still be developed by using sim_stateprobs.survival() to compute simulated state probabilities and then simulating quality-adjusted life-years and costs in a typical fashion.

survival(
data,
sample = "sample",
strategy_id = "strategy_id",
patient_id = "patient_id",
grp_id = "grp_id",
curve = "curve",
t = "t",
survival = "survival"
)

## Arguments

data

A tabular object that can be coerced to a data.table with as.data.table().

sample

The name of the column corresponding to sample.

strategy_id

The name of the column corresponding to strategy_id.

patient_id

The name of the column corresponding to patient_id.

grp_id

The name of the column corresponding to grp_id.

curve

The name of the column corresponding to curve.

t

The name of the column corresponding to t.

survival

The name of the column corresponding to survival.

## Value

An object of class survival that inherits from data.table and contains the following columns:

sample

A random sample from the PSA.

strategy_id

The treatment strategy ID.

patient_id

The patient ID.

grp_id

The subgroup ID.

curve

One of the N-1 survival curves in an N-state partitioned survival model. Each curve corresponds to unique endpoint.

t

The time at which a survival probability is computed.

survival

The probability of surviving to time t.

The object also contains a size attribute that contains the elements n_samples, n_strategies, n_patients, n_states, and n_times denoting the number of samples, treatment strategies, patients, health states, and times.

survival objects are returned by methods in the Psm and PsmCurves classes. An example in which a survival object is constructed "manually" (presumably from a preexisting survival model fit using software other than flexsurv) is provided in the documentation to sim_stateprobs.survival().