Learn R Programming

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

688

Version

0.5.5

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

September 18th, 2024

Functions in hesim (0.5.5)

Psm

N-state partitioned survival model
IndivCtstmTrans

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

Check input data argument for create_input_mats
autoplot.stateprobs

Plot state probabilities
as.data.table.tparams_transprobs

Coerce to data.table
as_array3

Convert between 2D tabular objects and 3D arrays
as_pfs_os

Convert multi-state data to PFS and OS data
IndivCtstm

Individual-level continuous time state transition model
cea

Cost-effectiveness analysis
ce

A cost-effectiveness object
apply_rr

Apply relative risks to transition probability matrices
check.id_attributes

Input validation for class objects
CtstmTrans

An R6 base class for continuous time state transition models
costs

Costs object
autoplot.survival

Plot survival curves
bootstrap

Bootstrap a statistical model
create_input_mats

Create input matrices
create_input_mats.formula_list

Create input matrices from formula
create_CohortDtstm

Create CohortDtstm object
create_CohortDtstmTrans

Create CohortDtstmTrans object
create_params

Create a parameter object from a fitted model
create_IndivCtstmTrans

Create IndivCtstmTrans object
define_tparams

Define and evaluate transformed parameter expressions
disprog

Disease progression object
create_lines_dt

Create a data table of treatment lines
define_rng

Define and evaluate random number generation expressions
expmat

Matrix exponential
fast_rgengamma

Random generation for generalized gamma distribution
formula_list

List of formula objects
define_model

Define and evaluate model expression
flexsurvreg_list

List of flexsurvreg objects
expand.hesim_data

Expand hesim_data
get_labels

Get value labels
create_trans_dt

Create a data table of health state transitions
create_object_list

Form a list from ...
expand

Expand object
hesim_data

Data for health economic simulation modeling
create_PsmCurves

Create PsmCurves object
create_StateVals

Create a StateVals object
mom_beta

Method of moments for beta distribution
hesim_survdists

List of survival distributions
icea

Individualized cost-effectiveness analysis
id_attributes

Attributes for ID variables
icer_tbl

ICER table
lm_list

List of lm objects
icer

Incremental cost-effectiveness ratio
multinom3_exdata

Example data for a 3-state multinomial model
params_lm

Parameters of a linear model
multinom_list

List of multinom objects
params_surv_list

Parameters of a list of survival models
input_mats

Input matrices for a statistical model
incr_effect

Incremental treatment effect
plot_ceac

Plot cost-effectiveness acceptability curve
partsurvfit

Partitioned survival regression object
params_surv

Parameters of a survival model
params_mlogit_list

Parameters of a list of multinomial logit models
mom_gamma

Method of moments for gamma distribution
mstate3_exdata

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

Multi-state oncology data for 3-state model
hesim

hesim: Health Economic Simulation Modeling and Decision Analysis
qmatrix.msm

Transition intensity matrix from msm object
qmatrix.matrix

Transition intensity matrix from tabular object
onc3p

Multi-state panel oncology data for 3-state model
normboot

Draw parameters of statistical model from multivariate normal distribution
params_mlogit

Parameters of a multinomial logit model
plot_evpi

Plot expected value of perfect information
plot_ceplane

Plot cost-effectiveness plane
plot_ceaf

Plot cost-effectiveness acceptability frontier
rdirichlet_mat

Random generation for multiple Dirichlet distributions
rcat

Random generation for categorical distribution
params

Parameter object
inlineCxxPlugin

Code to use the hesim package inline. Not directly called by the user.
qalys

Quality-adjusted life-years object
set_labels

Set value labels
stateval_tbl

Table to store state value parameters
rpwexp

Random generation for piecewise exponential distribution
summarize_ce

Summarize costs and effectiveness
qmatrix

Transition intensity matrix
psm4_exdata

Example data for a 4-state partitioned survival model
time_intervals

Time intervals
tparams

Transformed parameter object
sim_ev

Expected values from state probabilities
summary.eval_rng

Summarize eval_rng object
rng_distributions

Random number generation distributions
summary.ce

Summary method for cost-effectiveness object
reexports

Objects exported from other packages
sim_stateprobs

Simulated state probabilities
surv_quantile

Survival quantiles
tparams_mean

Predicted means
survival

Survival object
summary.tparams_mean

Summarize tparams_mean object
summary.params

Summarize parameter objects
tparams_transprobs

Transition probabilities
weibullNMA

Parameterization of the Weibull distribution for network meta-analysis
stateprobs

State probability object
summary.tparams_transprobs

Summarize tparams_transprobs object
sim_stateprobs.survival

Simulate state probabilities from survival curves
tpmatrix_names

Names for elements of a transition probability matrix
uv_rng

Generate variates for univariate distributions
tpmatrix

Transition probability matrix
tpmatrix_id

Transition probability matrix IDs
summary.tpmatrix

Summarize transition probability matrix
CohortDtstm

Cohort discrete time state transition model
absorbing

Absorbing states
PsmCurves

Partitioned survival curves
StateVals

Model for state values
CohortDtstmTrans

Transitions for a cohort discrete time state transition model