Run the IVI-RA individual patient simulation model.

sim_iviRA(tx_seqs, input_data, pars, model_structures, max_months = NULL,
  tx_data = iviRA::treatments, hist = c("naive", "experienced"),
  output = c("data", "summary"), discount_qalys = 0.03,
  discount_cost = 0.03)

Arguments

tx_seqs

Either a vector consisting of a single treatment sequence or a matrix of unique treatment sequences for each patient.

input_data

An object of class 'input_data' returned from get_input_data.

pars

An object of class 'par_sample' returned from sample_pars.

model_structures

An object of class "model_structures" returned from select_model_structures.

max_months

Maximum number of months to run the model for. Default is NULL which implies that the model is simulated over each patient's lifetime.

tx_data

Dataset of treatments with columns names equivalent to iviRA::treatments. The indices of of treatments in tx_seqs are matched against treatments in tx_data$sname by name. Indices of treatment-specific parameter estimates must be in the same order as treatments in tx_data.

hist

Is the patient tDMARD naive or tDMARD experienced?

output

Specifies the format of output returned from the simulation. Options are data and summary. When data is specified, each simulated value (i.e, by model, sampled parameter set, patient, and time-period) is returned in a data.table. If summary is selected, then only summary measures are returned.

discount_qalys

Discount rate for QALYs. Only used when output = "summary"; otherwise, discounts can be applied to the simulated output.

discount_cost

Discount rate for cost variables. Only used when output = "summary"; otherwise, discounts can be applied to the simulated output.

Value

When output = "data" is selected, the simulation returns a data.table with simulated output for every model structure (model), sampled parameter set (sim), patient (id), treatment within a treatment sequence (tx), and time-period (month) is returned. For more details on the output, see the 'data' section below.

However, since all simulated output is returned, the size of the output can be very large and can cause memory management issues. The output = "summary", which only provides summaries of the simulation output, can be useful in the cases. In particular, when output = "summary", the simulation returns three data.tables:

means

A data.table of mean model outcomes by model structure (model) and sampled parameter set (sim). For details on the variables returned see the 'means' section below.

time.means

A data.table of mean model outcomes by model structure (model), sampled parameter set (sim), and month (month). For details on the variables returned see the 'time.means' section below.

out0

Simulated model outcomes during model cycle 0 for each model structure (model), sampled parameter set (sim), patient (id), and treatment within a treatment sequence (tx). For details on the variables returned, see the 'out0' section below.

data

model

Integer denoting a unique model structure corresponding to the row number in model_structures.

sim

Simulation number denoting a randomly sampled parameter set from sample_pars.

id

ID number denoting a simulated patients (e.g., from sample_pop).

month

Month since a simulated patient began the first treatment in a treatment sequence.

tx

Treatment used. Given J total therapies, the first J - 1 therapies match the indices from tx_data. The final tx is always the non-biologic treatment (nbt_ind).

line

Line of treatment in a treatment sequence. First treatment equal to 1, second treatment equal to 2, ...

tx_cycle

Number of model cycles since a patient began taking a given treatment in a treatment sequence. tx_cycle = 1 during the initial 6-month treatment period.

death

Equal to 1 if patient died during the model cycle and 0 otherwise.

age

Age of patient which increases with the model cycles.

ttd

Time to treatment discontinuation following the initial 6 month treatment period (i.e., after tx_cycle=1. Measured in terms of model cycles (e.g. ttd = 2 if treatment will discontinue in 1 year given 6-months cycles). ttd is measured at the end of each cycle. Patients switch treatments during the cycle in which ttd becomes negative and HAQ rebounds during the cycle.

acr

Simulated ACR response during the initial 6-month period for a new treatment Constant within tx. Categories are 0 (ACR < 20), 1 (ACR 20-50), 2 (ACR 50-70), and 3 (ACR 70+).

eular

Simulated EULAR response during the initial 6-month period for a new treatment Constant within tx. Categories are 0 (no EULAR response), 1 (moderate EULAR response), and 2 (good EULAR response).

das28

Disease Activity Score 28 (DAS28).

sdai

Simplified Disease Activity Index (SDAI).

cdai

Clinical Disease Activity Index (CDAI).

haq

HAQ score. Restricted to range between 0 and 3.

ttsi

Time to serious infection. Like ttd, measured in terms of model cycles. ttsi is measured at the end of each cycle.

si

Equal to 1 if treatment discontinuation was caused by a serious infection and 0 otherwise.

yrlen

Length of a model cycle in years. Equal to 0.5 given 6-month cycles.

tx_cost

Treatment costs after discounts and rebates.

hosp_cost

Hospitalization costs.

mgmt_cost

General management costs.

si_cost

Costs due to serious infections.

prod_loss

Productivity loss (i.e., lost earnings).

utility

Simulated utility score.

qalys

Quality-adjusted life-years (QALYs).

means

model

Integer denoting a unique model structure corresponding to the row number in model_structures.

sim

Simulation number denoting a randomly sampled parameter set from sample_pars.

lys

Life-years.

dlys

Discounted life-years.

lys_infusion

Total life-years with a treatment administered by infusion.

lys_injection

Total life-years with a treatment administered by injection.

lys_oral

Total life-years with a treatment administered orally.

dhaq

Change in HAQ from baseline (i.e., month 0) to final model cycle.

si

Number of serious infections.

qalys

Quality-adjusted life-years (QALYs).

dqalys

Discounted QALYs.

tx_cost

Treatment costs.

dtx_cost

Discounted treatment costs.

hosp_days

Hospital days.

hosp_cost

Hospital costs.

dhosp_cost

Discounted hospital costs.

mgmt_cost

General management costs.

dmgmt_cost

Discounted general management costs.

si_cost

Costs due to serious infections.

dsi_cost

Discounted costs due to serious infections.

prod_loss

Productivity loss (i.e., lost earnings).

dprod_loss

Discounted productivity loss.

dhc_cost

Discounted formal healthcare sector costs.

dtot_cost

Discounted total (formal healthcare sector + productivity losses) costs.

yrs_since_approval

Weighted mean of the number of years since approval of all treatments in a treatment sequence, with weights for a given treatment equal to the number of months a simulated patient used that treatment.

dqalys_ann

Annualized discounted QALYs. Assumes that QALYs accrue at a constant annual rate and are calculated over the maximum number of years that each simulated patient could survive during the model.

dhc_cost_ann

Annualized discounted formal healthcare sector costs. Calculated in the same way as dqalys_ann.

dprod_loss_ann

Annualized discounted productivity losses. Calculated in the same way as dqalys_ann.

time.means

model

Integer denoting a unique model structure corresponding to the row number in model_structures.

sim

Simulation number denoting a randomly sampled parameter set from sample_pars.

month

Month since a simulated patient began the first treatment in a treatment sequence.

alive

Number of simulated patients alive.

qalys

Quality-adjusted life-years.

haq

HAQ score. Restricted to range between 0 and 3.

tx_cost

Treatment costs.

hosp_cost

Hospital costs.

mgmt_cost

General management costs.

si_cost

Costs due to serious infections.

prod_loss

Productivity loss (i.e., lost earnings).

out0

model

Integer denoting a unique model structure corresponding to the row number in model_structures.

sim

Simulation number denoting a randomly sampled parameter set from sample_pars.

id

ID number denoting a simulated patients (e.g., from sample_pop).

tx

Treatment used. Given J total therapies, the first J - 1 therapies match the indices from

acr

Simulated ACR response during the initial 6-month period for a new treatment Constant within tx. Categories are 0 (ACR < 20), 1 (ACR 20-50), 2 (ACR 50-70), and 3 (ACR 70+).

eular

Simulated EULAR response during the initial 6-month period for a new treatment Constant within tx. Categories are 0 (no EULAR response), 1 (moderate EULAR response), and 2 (good EULAR response).

ttd

Time to treatment discontinuation. Measured in terms of model cycles (e.g. ttd = 2 if treatment will discontinue in 1 year given 6-months cycles). ttd is measured at the end of each cycle. Patients switch treatments during the cycle in which ttd becomes negative and HAQ rebounds during the cycle.

ttsi

Time to serious infection. Like ttd, measured in terms of model cycles. ttsi is measured at the end of each cycle.

Examples

pop <- sample_pop(n = 10, type = "homog") tx.seq <- c("adamtx", "cdmards") mod.structs <- select_model_structures(tx_ihaq = c("acr-haq", "acr-eular-haq"), tx_iswitch = c("acr-switch", "acr-eular-switch"), cdmards_haq_model = c("lcgm", "linear"), ttd_cause = c("all", "si"), ttd_dist = c("gengamma", "exponential"), utility_model = c("mixture", "wailoo")) input.dat <- get_input_data(pop = pop) parsamp <- sample_pars(n = 10, input_dat = input.dat) sim.out <- sim_iviRA(tx_seqs = tx.seq, input_data = input.dat, pars = parsamp, model_structures = mod.structs, output = "data") head(sim.out)
#> model sim id month tx line tx_cycle death age ttd acr eular das28 sdai cdai #> 1: 1 1 1 6 4 1 1 0 55.0 0 0 NA NA NA NA #> 2: 1 1 1 12 1 2 1 0 55.5 0 0 NA NA NA NA #> 3: 1 1 1 18 21 3 1 0 56.0 NA 0 NA NA NA NA #> 4: 1 1 1 24 21 3 2 0 56.5 NA 0 NA NA NA NA #> 5: 1 1 1 30 21 3 3 0 57.0 NA 0 NA NA NA NA #> 6: 1 1 1 36 21 3 4 0 57.5 NA 0 NA NA NA NA #> haq ttsi si yrlen tx_cost hosp_days hosp_cost mgmt_cost si_cost #> 1: 1.500000 53.39888 0 0.5 26321.5389 0.6110033 635.4826 207.0549 0 #> 2: 1.500000 51.40948 0 0.5 110.3382 0.6110033 635.4826 207.0549 0 #> 3: 1.500000 NA 0 0.5 0.0000 0.6110033 635.4826 207.0549 0 #> 4: 1.507758 NA 0 0.5 0.0000 0.6110033 635.4826 207.0549 0 #> 5: 1.541003 NA 0 0.5 0.0000 0.6110033 635.4826 207.0549 0 #> 6: 1.553528 NA 0 0.5 0.0000 0.6110033 635.4826 207.0549 0 #> prod_loss utility qalys #> 1: 3550.941 0.6203959 0.3101979 #> 2: 3550.941 1.0000000 0.5000000 #> 3: 3550.941 0.7079691 0.3539845 #> 4: 3569.306 0.7208181 0.3604091 #> 5: 3648.006 0.6509538 0.3254769 #> 6: 3677.657 0.6343574 0.3171787