Simulate example multi-state data for a 3-state model using Weibull distributions for each transition. Patients are right censored after 15 years of followup.

sim_mstate3_data(n = 2000, seed = NULL)

Arguments

n

The number of patients to simulate.

seed

An integer to pass to set.seed(). If NULL, then no seed is set.

Value

Returns a data.table with multiple rows for patient. That is, for a given patient there are rows for each possible transition from a given health state. The returned columns are as follows:

from

The health state ID transitioned from.

to

he health state ID transitioned to.

female

1 if female and 0 if male.

age

The age of the patient in years.

patient_id

The patient ID.

final

An indicator equal to 1 if a patient is in their final health state during the simulation and 0 otherwise.

time_start

The time at the start of the interval.

time_stop

The time and the end of the interval.

time

The duration of the interval: time_stop - time_start.

status

1 if time is an observed transition and 0 if there was right censoring.

transition_id

The transition ID representing a unique transition from from to to.

strategy_id

The treatment strategy ID.

strategy_name

The name of the treatment strategy. Either "New or "SOC.

Examples

sim_mstate3_data(n = 3, seed = 101)
#> Error in sim_mstate3_data(n = 3, seed = 101): could not find function "sim_mstate3_data"