Learn R Programming

⚠️There's a newer version (0.5.5) of this package.Take me there.

Health economic simulation modeling

Overview

hesim is a modular and computationally efficient R package for health economic simulation modeling and decision analysis that provides a general framework for integrating statistical analyses with economic evaluation. The package supports cohort discrete time state transition models (DTSTMs), N-state partitioned survival models (PSMs), and individual-level continuous time state transition models (CTSTMs), encompassing both Markov (time-homogeneous and time-inhomogeneous) and semi-Markov processes. It heavily utilizes Rcpp and data.table, making individual-level simulation, probabilistic sensitivity analysis (PSA), and incorporation of patient heterogeneity fast.

Features of the current version can be summarized as follows:

  • Cohort DTSTMs, individual-level CTSTMs, and N-state PSMs that encompass Markov and semi-Markov processes
  • Options to build models directly from fitted statistical models or by defining them in terms of expressions
  • Parameter estimates from either an R based model or from an external source
  • Convenience functions for sampling model parameters from parametric distributions or via bootstrapping
  • Parameter uncertainty propagated with PSA
  • Modeling patient heterogeneity
  • Performing cost-effectiveness analyses and representing decision uncertainty from PSAs
  • Simulation code written in C++ to boost performance

Installation

You can install the current release from CRAN or the most up to date development version from GitHub.

# Install from CRAN:
install.packages("hesim")

# Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("hesim-dev/hesim")

Getting started

There are two good places to start:

  1. The Introduction to hesim article provides a quick introduction.

  2. Our preprint describes the package (including mathematical details) more thoroughly.

You might also want to explore our example analyses which can be found in the preprint and web articles. They are summarized in the table below, with some drawn from the Decision Modeling for Health Economic Evaluation textbook. Key areas of focus are the (i) statistical models of disease progression (in terms of the baseline risk and relative treatment effects) and (ii) the available data (either individual patient data (IPD) or aggregate-level data).

Baseline risk

Treatment effect

Citing hesim

If you use hesim, please cite as follows:

  Devin Incerti and Jeroen P Jansen (2021). hesim: Health Economic
  Simulation Modeling and Decision Analysis. arXiv:2102.09437
  [stat.AP], URL https://arxiv.org/abs/2102.09437.

A BibTeX entry for LaTeX users is

  @Misc{incerti2021hesim,
    author = {Devin Incerti and Jeroen P. Jansen},
    title = {hesim: Health Economic Simulation Modeling and Decision Analysis},
    year = {2021},
    eprint = {2102.09437},
    archiveprefix = {arXiv},
    primaryclass = {stat.AP},
    url = {https://arxiv.org/abs/2102.09437},
  }

Copy Link

Version

Install

install.packages('hesim')

Monthly Downloads

511

Version

0.5.4

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Devin Incerti

Last Published

February 12th, 2024

Functions in hesim (0.5.4)

apply_rr

Apply relative risks to transition probability matrices
PsmCurves

Partitioned survival curves
StateVals

Model for state values
CohortDtstmTrans

Transitions for a cohort discrete time state transition model
Psm

N-state partitioned survival model
IndivCtstm

Individual-level continuous time state transition model
IndivCtstmTrans

Transitions for an individual-level continuous time state transition model
absorbing

Absorbing states
CtstmTrans

An R6 base class for continuous time state transition models
CohortDtstm

Cohort discrete time state transition model
bootstrap

Bootstrap a statistical model
autoplot.survival

Plot survival curves
as.data.table.tparams_transprobs

Coerce to data.table
as_array3

Convert between 2D tabular objects and 3D arrays
cea

Cost-effectiveness analysis
as_pfs_os

Convert multi-state data to PFS and OS data
autoplot.stateprobs

Plot state probabilities
ce

A cost-effectiveness object
check_input_data

Check input data argument for create_input_mats
check.id_attributes

Input validation for class objects
create_object_list

Form a list from ...
create_PsmCurves

Create PsmCurves object
create_StateVals

Create a StateVals object
create_IndivCtstmTrans

Create IndivCtstmTrans object
create_CohortDtstmTrans

Create CohortDtstmTrans object
create_lines_dt

Create a data table of treatment lines
costs

Costs object
create_CohortDtstm

Create CohortDtstm object
create_input_mats

Create input matrices
create_input_mats.formula_list

Create input matrices from formula
disprog

Disease progression object
define_tparams

Define and evaluate transformed parameter expressions
expand.hesim_data

Expand hesim_data
expand

Expand object
define_model

Define and evaluate model expression
define_rng

Define and evaluate random number generation expressions
icer_tbl

ICER table
expmat

Matrix exponential
create_trans_dt

Create a data table of health state transitions
get_labels

Get value labels
hesim_data

Data for health economic simulation modeling
icea

Individualized cost-effectiveness analysis
formula_list

List of formula objects
fast_rgengamma

Random generation for generalized gamma distribution
create_params

Create a parameter object from a fitted model
flexsurvreg_list

List of flexsurvreg objects
hesim_survdists

List of survival distributions
lm_list

List of lm objects
hesim

hesim: Health Economic Simulation Modeling and Decision Analysis
id_attributes

Attributes for ID variables
multinom_list

List of multinom objects
multinom3_exdata

Example data for a 3-state multinomial model
mom_gamma

Method of moments for gamma distribution
normboot

Draw parameters of statistical model from multivariate normal distribution
icer

Incremental cost-effectiveness ratio
mstate3_exdata

Example data for a reversible 3-state multi-state model
plot_ceac

Plot cost-effectiveness acceptability curve
mom_beta

Method of moments for beta distribution
plot_ceaf

Plot cost-effectiveness acceptability frontier
params_surv

Parameters of a survival model
params_mlogit_list

Parameters of a list of multinomial logit models
params_lm

Parameters of a linear model
incr_effect

Incremental treatment effect
input_mats

Input matrices for a statistical model
params_mlogit

Parameters of a multinomial logit model
rdirichlet_mat

Random generation for multiple Dirichlet distributions
params

Parameter object
reexports

Objects exported from other packages
onc3p

Multi-state panel oncology data for 3-state model
qmatrix.msm

Transition intensity matrix from msm object
rcat

Random generation for categorical distribution
qmatrix.matrix

Transition intensity matrix from tabular object
qmatrix

Transition intensity matrix
sim_stateprobs

Simulated state probabilities
qalys

Quality-adjusted life-years object
sim_stateprobs.survival

Simulate state probabilities from survival curves
rng_distributions

Random number generation distributions
rpwexp

Random generation for piecewise exponential distribution
psm4_exdata

Example data for a 4-state partitioned survival model
summary.ce

Summary method for cost-effectiveness object
summarize_ce

Summarize costs and effectiveness
plot_ceplane

Plot cost-effectiveness plane
stateval_tbl

Table to store state value parameters
stateprobs

State probability object
params_surv_list

Parameters of a list of survival models
onc3

Multi-state oncology data for 3-state model
partsurvfit

Partitioned survival regression object
summary.tparams_mean

Summarize tparams_mean object
summary.params

Summarize parameter objects
summary.eval_rng

Summarize eval_rng object
summary.tparams_transprobs

Summarize tparams_transprobs object
surv_quantile

Survival quantiles
summary.tpmatrix

Summarize transition probability matrix
survival

Survival object
time_intervals

Time intervals
set_labels

Set value labels
tpmatrix_id

Transition probability matrix IDs
tparams

Transformed parameter object
tparams_mean

Predicted means
plot_evpi

Plot expected value of perfect information
sim_ev

Expected values from state probabilities
tpmatrix

Transition probability matrix
uv_rng

Generate variates for univariate distributions
tparams_transprobs

Transition probabilities
weibullNMA

Parameterization of the Weibull distribution for network meta-analysis
tpmatrix_names

Names for elements of a transition probability matrix