Learn R Programming

WARDEN: Workflows for health technology Assessments in R using Discrete EveNts

Introduction

WARDEN is a user-friendly package that facilitates the use of discrete event simulations with or without resource constraints for cost-effectiveness analysis. The package supports a flexible, transparent, practical approach to discrete event simulation while keeping an acceptable performance.

The current version supports:

  • Discrete event simulation models, Markov/semi-Markov models and hybrid models using parallel and non-parallel engines
  • Constrained and unconstrained models (with or without interactivity between patients)
  • Seamlessly integrating data.frames and other objects into the model
  • Delayed execution of the main inputs to facilitate readability of the model
  • Implementation of structural and parameter uncertainty
  • Helper functions to facilitate drawing of time to events and the use of hazard ratios, as well as other functions to facilitate transparency
  • Performing cost-effectiveness and uncertainty analysis

It is recommended that the user checks the vignettes, first the simple Sick-Sicker-Dead model and then the more complex model for early breast cancer. The markov example shows how to run a cohort Markov model while using the same modeling framework. Similarly, a simulation based Markov model could be run. Structural and parametric uncertainty are explored in the corresponding vignette. The IPD vignette shows how WARDEN can be used when individual patient data is available. It is also suggested to check the constrained resources DES example on the website.

Documentation

Have a look at the package home site for more details on documentation and specific tutorials.

For more details on the code, check our Github repository, or our CRAN site.

Installation

WARDEN can now be installed directly from CRAN or this repo via

install.packages("WARDEN") #CRAN version 

# install.packages("devtools")
devtools::install_github("jsanchezalv/WARDEN", ref="main") #github version

Citation

If you use WARDEN, please contact the authors for the most up to date appropriate citation.

WARDEN

Copy Link

Version

Install

install.packages('WARDEN')

Monthly Downloads

349

Version

2.0.6

License

GPL (>= 3)

Maintainer

Javier Sanchez Alvarez

Last Published

July 23rd, 2026

Functions in WARDEN (2.0.6)

add_item2

Define parameters that may be used in model calculations (uses expressions)
disc_ongoing

Calculate discounted costs and qalys between events
discrete_resource_clone

Clone independent discrete resources
.resource_discrete_from_xptr

Creates a discrete resource from an external pointer
pop_and_return_event

Pop and return the next event
extract_psa_result

Extract PSA results from a treatment
extract_from_reactions

Extract all items and events and their interactions from the event reactions list
pick_val_v

Select which values should be applied in the corresponding loop for several values (vector or list).
draw_tte

Draw a time to event from a list of parametric survival functions
new_event

Add events to the queue for a patient
get_event

Get a specific event time
modify_item_seq

Modify the value of existing items
disc_instant_v

Calculate instantaneous discounted costs or qalys for vectors
has_event

Check if a patient has a specific event in the queue
disc_cycle

Cycle discounting
qcond_llogis

Conditional quantile function for loglogistic distribution
qcond_lnorm

Conditional quantile function for lognormal distribution
disc_instant

Calculate instantaneous discounted costs or qalys
disc_ongoing_v

Calculate discounted costs and qalys between events for vectors
disc_cycle_v

Cycle discounting for vectors
qcond_norm

Conditional quantile function for normal distribution
qcond_weibull

Conditional quantile function for weibull distribution
rcond_gompertz_lu

Draw from a conditional Gompertz distribution (lower and upper bound)
luck_adj

Perform luck adjustment
pcond_gompertz

Survival Probaility function for conditional Gompertz distribution (lower bound only)
pick_psa

Helper function to create a list with random draws or whenever a series of functions needs to be called. Can be implemented within pick_val_v.
release_all_if_using

Release multiple discrete resources (using only)
draw_categorical

Draw a categorical index from probabilities
input_block

Build an input block for automatic parameter selection
queue_empty

Check if the event queue is empty
print.resource_discrete

Print method for resource_discrete
qcond_gompertz

Quantile function for conditional Gompertz distribution (lower bound only)
rcond_gompertz

Draw from a conditional Gompertz distribution (lower bound only)
qcond_weibullPH

Conditional quantile function for WeibullPH (flexsurv)
qgamma_mse

Use quantiles from a gamma distribution based on mean and se
modify_event

Modify or add events for a patient
modify_item

Modify the value of existing items
print.warden_results

Print method for warden_results
pop_event

Remove the next event from the queue
qbeta_mse

Draw from a beta distribution based on mean and se (quantile)
release_if_using

Release a discrete resource only if using
rpoisgamma

Draw time to event (tte) from a Poisson or Poisson-Gamma (PG) Mixture/Negative Binomial (NB) Process
shared_decr

Decrement a shared counter
waning_hr

Compute effective hazard ratio with treatment waning
rpoisgamma_rcpp

Draw time to event (tte) from a Poisson or Poisson-Gamma (PG) Mixture/Negative Binomial (NB) Process using C++
with_write_flags_lang

Evaluate a language object with write-tracking via active bindings
release

Release a discrete resource
random_stream

Creates an environment (similar to R6 class) of random uniform numbers to be drawn from
shared_incr

Increment a shared counter
rgamma_mse

Draw from a gamma distribution based on mean and se
rbeta_mse

Draw from a beta distribution based on mean and se
qcond_exp

Conditional quantile function for exponential distribution
rdirichlet_prob

Draw from a dirichlet distribution based on mean transition probabilities and standard errors
qcategorical

Quantile function for categorical distribution
resource_discrete

Create a discrete resource
release_all

Release multiple discrete resources
queue_size

Get the Size of the Event Queue
rdirichlet

Draw from a dirichlet distribution based on number of counts in transition. Adapted from brms::rdirichlet
scale_remaining_time

Scale remaining time to an event by a hazard ratio
replicate_profiles

Replicate profiles data.frame
summary_results_sim

Summary of PSA outputs for a treatment
extract_elements_from_list

Extracts items and events by looking into assignments, modify_event and new_event
queue_create

Create a New Event Queue
remove_event

Remove events for a patient
summary_results_sens

Summary of sensitivity outputs for a treatment
sens_iterator

Create an iterator based on sens of the current iteration within a scenario (DSA)
seize_all

Seize multiple discrete resources atomically
seize

Seize a discrete resource
summary_results_det

Deterministic results for a specific treatment
shared_input

Shared input object
evpi_des

Calculate the Expected Value of Perfect Information (EVPI) for a DES model with a PSA result
next_event_pt

Get the next events in the queue for a specific patient
run_sim_parallel

Run simulations in parallel mode (at the simulation level)
run_sim

Run the simulation
next_event

Get the next events in the queue
validate_model

Validate model inputs before running
qcond_gamma

Conditional quantile function for gamma distribution
qtimecov

Draw time-to-event with time-dependent covariates and luck adjustment
tte.df

Example TTE IPD data
cond_dirichlet

Calculate conditional dirichlet values
add_tte

Define events and the initial event time
add_reactevt

Define the modifications to other events, costs, utilities, or other items affected by the occurrence of the event
ast_as_list

Transform a substituted expression to its Abstract Syntax Tree (AST) as a list
create_indicators

Creates a vector of indicators (0 and 1) for sensitivity/DSA analysis
adj_val

Adjusted Value Calculation
add_item

Define or append model inputs
ceac_des

Calculate the cost-effectiveness acceptability curve (CEAC) for a DES model with a PSA result
cond_mvn

Calculate conditional multivariate normal values