R in Health Decision Sciences

From Wikiversity
Jump to: navigation, search


Health decision sciences (HDS) is the field of study that involves improving the quality of decisions in the presence of uncertainty in the healthcare setting. HDS has the goal to allocate limited healthcare resources optimally. Since these health care decisions have substantial consequences it is important to communicate the uncertainties and trade-offs related to these decisions with all health-care professionals and (health) policy makers. HDS combines information from multiple disciplines, like epidemiology, health economics, biostatistics and computer science. HDS estimates the consequences of all the actions considered[1].

The most commonly used mathematical models in HDS are[2] decision trees [3], Markov models[4], and microsimulation[5].

R is a programming language that has been mostly used for statistical programming across many academic disciplines such as statistics and engineering. R has gained significant popularity in Health Decision Sciences over the past decade[6]. A key characteristic of R is its vast number of packages that can extend the functionality of the programming language.

Academic groups promoting the use of R in HDS[edit]

At the 37th Annual North American Meeting of the Society for Medical Decision Making (SMDM) in St. Louis, MO, USA, a group of researchers and students created the Decision Analysis in R for Technologies in Health (DARTH) workgroup. The group is an international endeavor comprised of members with shared interests and a significant experience modeling in R from the University of Minnesota, the University of Pittsburgh, The Hospital for Sick Children, University of Toronto, and Erasmus University of Rotterdam. As part of DARTH’s agenda, they develop tutorials on how to implement decision-analytic models using R.

Good coding practices[edit]

The workgroup on Github[edit]

Link to Github files will follow soon.

Overview table[edit]

Overview table of the R packages
Category Type Package name Description
Model design Markov Models matrixStats Functions that Apply to Rows and Columns of Matrices (and to Vectors). High-performing functions operating on rows and columns of matrices.
DTMCPack Suite of functions related to discrete-time discrete-state Markov Chains:  Functions for simulating and determining the properties of finite, discrete-time, discrete state Markov chains.
markovchain Easy Handling Discrete Time Markov chains:  Functions to create and analyze discrete time Markov chains.
heemod Health Economic Evaluation Modelling: Functions for Markov models for health economic evaluation, model comparison, sensitivity and probabilistic analysis.
MDP MDPtoolbox Markov Decision Processes toolbox: Functions related to the resolution of discrete-time Markov Decision Processes: finite horizon, value iteration, policy iteration, and linear programming algorithms.
Microsimulation/Agent-based models MILC MIcrosimulation Lung Cancer (MILC) model:  A continuous time microsimulation model example for predicting patient outcomes and describing the natural history of lung cancer.
RNetLogo Interface for Netlogo in R:An interface to access NetLogo from R. NetLogo is a multi-agent programmable modeling environment available at https://ccl.northwestern.edu/netlogo/
microsimulation The package provides several approaches for microsimulation and event-based, discrete event simulation.
Probabilistic modeling and Bayesian hierarchical models R2WinBUGS, R2OpenBUGS, R2jags,rstan,


Integrate WinBUGS, OpenBUGS, JAGS and Stan with R: These packages make it possible to call a BUGS model, summarize inferences and convergence in a table and graph, and save the simulations in arrays for easy access in R.
Dynamic transmission models (Compartmental Models) deSolve Differential equation solver:  Functions to numerically solve a system of first-order ordinary or partial differential equations.
GillespieSSA and adaptivetau Gillespie's Stochastic Simulation Algorithm (SSA):Several functions for stochastic simulation algorithms for generating simulated trajectories of finite population continuous-time model.
EpiModel Mathematical Modeling of Infectious Disease: Building mathematical models of infectious disease, including deterministic compartmental models, stochastic agent-based, and stochastic network models.
statnet Software Tools for the Statistical Analysis of Network Data: Functions for modeling, analyzing and visualizing network data.
Parameter estimation Analysis of patient-level or aggregate data survival Survival Analysis: Survival analysis functions, including Kaplan-Meier, multi-state curves and Cox models.
flexsurv Flexible Parametric Survival and Multi-State Models: Flexible parametric models for time-to-event data, including spline models.
msm Multi-State Markov and Hidden Markov Models in Continuous Time: Functions for fitting continuous-time Markov and hidden Markov multi-state models to longitudinal data.
mstate Data Preparation, Estimation and Prediction in Multi-State Models: Functions for data preparation, descriptives, hazard prediction in multistate models.
SemiMarkov Multi-States Semi-Markov Models: Functions for fitting multi-state semi-Markov models to longitudinal data.
TPmsm Estimation of Transition Probabilities in Multistate Models: estimate transition probabilities for illness-death or three-state progressive disease model.
HMM Hidden Markov Models: Functions to setup, apply and make inference with discrete time and discrete space Hidden Markov Models.
depmixS4 Dependent Mixture Models - Hidden Markov Models of GLMs and Other Distributions in S4:Functions to model dependent mixture models (mixed continuous or categorical time series data).
lm and glm Fitting (generalized) linear models: Used to perform (generalized) linear fit or regression analyses.
nlme Linear and Nonlinear Mixed Effects Models: random-effect regression models.
lme4 Linear Mixed-Effects Models.
gee Generalized Estimation Equation Solver: Generalized Estimation Equation Solver.
AER Applied Econometrics with R: Accompanies the book “Applied Econometrics with R”, Springer-Verlag, New York. {{ISBN|978-0-387-77316-2}}.
ipw Estimate Inverse Probability Weights: Functions to estimate the probability to receive the observed treatment, based on individual characteristics.
Meta-analysis and evidence synthesis RISmed A set of tools to extract bibliographic content from the National Center for Biotechnology Information (NCBI) database directly.
meta, metafor, rmeta Meta-Analysis Package for R: A, such as fixed-, random-, and mixed-effects models.
mvmeta Multivariate and Univariate Meta-Analysis and Meta-Regression: Collection of functions to perform fixed and random-effects multivariate and univariate meta-analysis and meta-regression.
netmeta Network Meta-Analysis using Frequentist Methods: network meta-analysis (frequentist).
gemtc Network Meta-Analysis Using Bayesian Methods: network meta-analysis (Bayesian).
Direct analyses of public datasets HMDHFDPlus Read the data from the Human Fertility Database (HFD) and Human Fertility Databas (HFD) from the web into an R session as data.frame objects.
demography Forecasting mortality, fertility, migration and population data: Human Mortality Database (HMD); Functions for demographic analysis including lifetable calculations.
SEER2R Reading and writing Surveillance, Epidemiology, and End Results (SEER) datasets.
Calibration/optimization optimx A Replacement and Extension of the optim(). optimization capabilities in R for multiple parameters.
stats package (optim function) Direct search algorithm (e.g., Nelder-Mead, quasi-Newton and conjugate-gradient).
neldermead R port of the Scilab neldermead module: Provides several direct search optimization algorithms based on the simplex method.
genalg R Based Genetic Algorithm optimization.
DEoptim Implements the differential evolution algorithm for global optimization of a real-valued function of a real-valued parameter vector.
GenSA R Functions for Generalized Simulated Annealing searches for global minimum in a non-linear system.
Bayesian calibration MHadaptive General Markov Chain Monte Carlo for Bayesian Inference using adaptive Metropolis-Hastings sampling:
mcmc Makrov Chain Monte Carlo: Simulates continuous distributions of random vectors using Markov chain Monte Carlo (MCMC).
MCMCpack Markov Chain Monte Carlo (MCMC) Package: Contains functions to perform Bayesian inference using posterior simulation for a number of statistical models.
INLA Used to solve solve models using Integrated nested Laplace approximation (INLA) which is a new approach to statistical inference for latent Gaussian Markov random field (GMRF)
Probabilistic sampling from independent or joint distributions core R (e.g., stats) Standard distributions, such as univariate distributions and commonly used multivariate distributions.
Model analysis and outputs Probabilistic Analyses MASS Multivariate normal distributions; Functions and datasets to support Venables and Ripley, "Modern Applied Statistics with S" (4th edition, 2002).
lca Density function and random generation for Dirichlet distribution with parameter vector alpha.
mvtnorm Computes multivariate normal and t probabilities, quantiles, random deviates and densities.
dirichlet Functions to compute the density of or generate random deviates from the Dirichlet distribution.
lhs Latin Hypercube Samples: Provides a number of methods for using Latin Hypercube Samples.
lattice Trellis Graphics for R:A powerful and elegant high-level data visualization system inspired by Trellis graphics.
BCEA Bayesian Cost Effectiveness Analysis: Conducts many post-simulation probabilistic analyses from a probabilistic sensitivity analysis dataset.
Value of information analysis foreach Provides Foreach Looping Construct for R:extension of the standard for function to compute over multiple threads and increase speed of computation.
parallel Parallel computation in R: makes it possible to run multiple computational threads in parallel.
Graphical outputs ggplot2 An Implementation of the Grammar of Graphics: Widely used plotting package that combines base and lattice graphics: conditioning and shared axes are handled automatically.
data.tree Methods to create and plot hierarchical data structures.


  1. "Decision making in Health and Medicine. Integrating Evidence and values". M.G.M.Hunink, M.C. Weinstein, E.Wittenberg. M.F.Drummond, J.S. Pliskin, J.B.Wong, P.P.Glasziou. Second edition. Cambridge University Press. 2014
  2. Roberts M, Russell LB, Paltiel AD, Chambers M, McEwan P, Krahn M. "Conceptualizing a model: A report of the ISPOR-SMDM modeling good research practices task force-2". Med Decis Making. 2012;32(15):678–89.
  3. Detsky AS, Naglie G, Krahn MD, Redelmeier DA, Naimark D. "Primer on Medical Decision Analysis: Part 2—Building a Tree". Med Decis Making. 1997 Apr 1;17(2):126–35.
  4. Beck JR, Pauker SG. "The Markov process in medical prognosis". Med Decis Making. 1983;3(4):419–58.
  5. Krijkamp E, Alarid-Escudero F, Enns EA, Jalal H, Hunink, MGM Pechlivanoglou P. Microsimulation modeling for health decision sciences using R: A tutorial. Med Decis Making. 2018 (In press).
  6. Jalal H, Pechlivanoglou P, Krijkamp E, Alarid-Escudero F, Enns E, Hunink MGM. "An Overview of R in Health Decision Sciences". Med Decis Making. 2017;37(7):735–46.