Package 'msdes'

Title: CE Model
Description: This is the Multiple Sclerosis MS Multiple Technology Appraisal MTA ID6369 Descrete Event Simulation DES Model.
Authors: Ayman Sadek
Maintainer: Ayman Sadek <[email protected]>
License: GPL (>= 3)
Version: 1.0.0
Built: 2026-10-24 15:40:55 UTC
Source: https://github.com/daysNmake/msdes

Help Index


DMT costs by year

Description

A matrix of annual Disease Modifying Therapy DMT costs by year

Usage

df_c_tx

Format

A matrix with 3 rows and 17 columns. Each column contains the costs by treatment:

cost_annual_yr1

Annual DMT costs during 1st year of treatment

cost_annual_yr2

Annual DMT costs during 2nd year of treatment

Source

British National Formulary


Treatment administration costs by year

Description

A matrix of annual treatment administration costs by year

Usage

df_c_tx_admin

Format

A matrix with 3 rows and 17 columns. Each column contains the costs by treatment:

cost_annual_yr1

Annual treatment administration costs during 1st year of treatment

cost_annual_yr2

Annual treatment administration costs during 2nd year of treatment

Source

UoB_TAG analysis (refer to report)


Annual treatment scheduled load factors years 1-5

Description

A matrix of annual treatment scheduled load factors years 1-5

Usage

df_c_tx_load

Format

A matrix with 5 rows and 8 columns. Each column contains the percentage of patients treated/re-treated by by DMT, with the 5 rows repenting the load factors during the first years.

Source

UoB_TAG analysis (refer to report)


Treatment monitoring costs by year

Description

A matrix of annual treatment monitoring costs by year

Usage

df_c_tx_monitor

Format

A matrix with 3 rows and 17 columns. Each column contains the costs by treatment:

cost_annual_yr1

Annual treatment monitoring costs during 1st year of treatment

cost_annual_yr2

Annual treatment monitoring costs during 2nd year of treatment

Source

UoB_TAG analysis (refer to report)


Draw time to Event custom function

Description

draw_tte_new_warden() adds additional capability for the modelling of the UK life tables

Usage

draw_tte_new_warden(
  n_chosen,
  dist,
  coef1 = NULL,
  coef2 = NULL,
  coef3 = NULL,
  hr = 1,
  time = NULL,
  ...,
  beta_tx = 1,
  seed = NULL
)

Arguments

time

should be the start times of the intervals (last is assumed to go to infinity)

dcoef1

should be a vector of log-rates over time intervals

Details

Adaptation of WARDEN::draw_tte() to include piece wise exponential distributions Utilizing hesim::rpwexp()


Generate Global inputs

Description

gen_common_all_inputs() Global input parameters for the model are common to all patients and treatments.

Usage

gen_common_all_inputs()

Arguments

drc

discount rate for costs

drq

discount rate for qalys

reference

The treatment arm specified as the reference for the comparison

Details

Input parameters here that do not change as we loop through treatments for a patient. The input parameters are called from 'gen_inputs()' function or the main analysis script. They are called in with 'WARDEN::add_item()' functions, these are piped with %>% operator. Probabilistic input parameters are specified with 'WARDEN::pick_val_v()' function creating a list of deterministic and probabilistic values


Generate initial events

Description

gen_init_events() WARDEN implementation of initial events

Usage

gen_init_events(RRMS_events)

Details

reaction events run on treatment codes


generate inputs

Description

gen_inputs() generates model inputs from saved data and returns a list with the data required for the model to run.

Usage

gen_inputs(
  drc = drc,
  drq = drq,
  time_horizon = time_horizon,
  p_eid = p_eid,
  jcvtest_cost = jcvtest_cost
)

Arguments

drc

discount rate for costs

drq

discount rate for qalys

time_horizon

the duration of the patients' life in the model

p_eid

proportion pf patients treated with Natalizumab Extended Interval Dosing

jcvtest_cost

JCV test cost assumption

Details

Stored within the function are all the default values of the inputs, some parameters are modifiable by user here as described below. The generated inputs will be called and processed by gen_common_all_inputs() to specify common and gen_common_all_inputs() unique patient inputs, by gen_init_events() to set initial and gen_react_events() reaction events. Parameters called by the model are specified here, they can be modified or new ones can be added.

Value

a list of inputs


Generate reaction events

Description

gen_react_events() WARDEN implementation of reaction events

Usage

gen_react_events(RRMS_events)

Details

reaction events run on treatment codes


Generate Individual inputs

Description

gen_unique_pt_inputs() Individual patient parameters of the model as they are unique patients and history including treatments

Usage

gen_unique_pt_inputs()

Arguments

sex

individual patient sex

n_relapse

number of relapses counter

n_edssinc_evts

number of edss increases counter

Details

These are called for each new patient so sampled from distribution specified for heterogeneous characteristics and may depend on treatment Note that the current treatment is later initialised to trt


Patient counts by EDSS score

Description

A matrix of patient counts stratified by EDSS score.

Usage

m_n_patients_edss

Format

A matrix with 2 rows and 10 columns. Each column contains the number of patients at that EDSS score:

harrms

distribution of patients

rrms

distribution of patients

Source

AFFIRM baseline


A matrix of patient counts stratified by treatment

Description

A matrix of patient counts stratified by treatment

Usage

m_proportion_ontrtline

Format

A matrix with 4 rows and 8 columns. Each column contains the number of patients on treatment at line of treatment :

alpha_2ndline

distribution of patients on 2nd line treatment

beta_2ndline

distribution of patients on 2nd line treatment

alpha_3rdline

distribution of patients on 3rd line treatment

beta_3rdline

distribution of patients on 3rd line treatment

Source

MS Registry analysis


Natural history treatment dependent variance covariance.

Description

Natural history treatment dependent variance covariance.

Format

A matrix with 3 rows and 3 columns #'

rate

intercept VCV

BaselineWebEDSS

EDSS VCV

DMTNatalizumab

on treatment with Natalizumab VCV

Source

MS Registry analysis


Natural history variance covariance.

Description

Natural history variance covariance.

Format

A matrix with 2 rows and 2 columns #'

rate

intercept VCV

BaselineWebEDSS

EDSS VCV

Source

MS Registry analysis


RunModel as a function

Description

rrmsdesmodel()RRMS DES model run written as a function to be called from Shiny APP

Usage

rrmsdesmodel(n_patients = n_patients, n_samples = n_samples)

Details

For quick deployment, also used in ShinyApp.


SetupModel as a function

Description

rrmsdessetup()RRMS DES model inputs written as a function to be called from Shiny APP

Usage

rrmsdessetup(
  drc = drc,
  drq = drq,
  time_horizon = time_horizon,
  p_eid = p_eid,
  jcvtest_cost = jcvtest_cost
)

Details

For quick deployment, also used in ShinyApp.


Run Sim new

Description

run_sim_new() modified run_sim() function

Usage

run_sim_new(
  arm_list = c("int", "noint"),
  sensitivity_inputs = NULL,
  common_all_inputs = NULL,
  common_pt_inputs = NULL,
  unique_pt_inputs = NULL,
  init_event_list = NULL,
  evt_react_list = evt_react_list,
  util_ongoing_list = NULL,
  util_instant_list = NULL,
  util_cycle_list = NULL,
  cost_ongoing_list = NULL,
  cost_instant_list = NULL,
  cost_cycle_list = NULL,
  other_ongoing_list = NULL,
  other_instant_list = NULL,
  npats = 500,
  n_sim = 1,
  psa_bool = NULL,
  sensitivity_bool = FALSE,
  sensitivity_names = NULL,
  n_sensitivity = 1,
  input_out = character(),
  ipd = 1,
  constrained = FALSE,
  timed_freq = NULL,
  debug = FALSE,
  accum_backwards = FALSE,
  continue_on_error = FALSE,
  seed = NULL,
  save_input_matrix = FALSE
)

Details

This runs the model to allow for extra functionality for VOI analysis Appends input_matrix to results, this contains the paramters sampled per simulation


Summarise Cost-effectiveness results

Description

summarise_ce_results() Function to tabulate the PSA results at willingness to pay (WTP) thresholds

Usage

summarise_ce_results(
  wtp1 = wtp1,
  wtp2 = wtp2,
  total_qalys,
  total_costs,
  reference = "Natalizumab-IV"
)

Arguments

wtp1

set the willingness to pay threshold, NICE default is £25,000

wtp2

set the willingness to pay threshold, NICE default is £35,000

total_qalys

input from the model results: the average total quality adjusted life years per treatment arm

total_costs

input from the model results: the average total costs per treatment arm

reference

The treatment arm specified as the reference for the comparison

Details

Returns the incremental cost and qalys calculates the expected incremental cost effectiveness ratio calculates the expected incremental net benefit ratio returns the probability of treatment arms being cost effective


Summarise Samples

Description

summarise_samples() Function to summarise PSA samples

Usage

summarise_samples(x, n_digits = 2)

Arguments

x

data to be supplied

Details

returns the mean and 95% Credible Intervals


A matrix of excess all cause mortality for MS patients by severity

Description

A matrix of excess all cause mortality for MS patients by severity

Usage

v_smr_severity_harding

Format

A matrix with 3 rows and 10 columns. Each column contains the data by EDSS severity state:

smr

average standard mortality ratio by severity state

sd

standard deviationby severity state

logsd

log standard deviation by severity state

Source

edss<4 (Jick et al), edss>=4 (Harding et al)


Natural history treatment dependent coefficients.

Description

Natural history treatment dependent coefficients.

Format

A named vector with 3 elements containing the formula coefficients: #'

rate

intercept coefficient

BaselineWebEDSS

EDSS coefficient

DMTNatalizumab

on treatment with Natalizumab coefficient

Source

MS Registry analysis


Natural history coefficients.

Description

Natural history coefficients.

Format

A named vector with 2 elements containing the formula coefficients: #'

rate

intercept coefficient

BaselineWebEDSS

EDSS coefficient

Source

MS Registry analysis