Microsimulation Modeling for Health Decision Sciences Using C++: A Tutorial

Pharmacoeconomics. 2025 Jul 26. doi: 10.1007/s40273-025-01526-8. Online ahead of print.

Abstract

Microsimulation models have become increasingly common in the field of decision modeling for health. Because microsimulation models are computationally more demanding than traditional Markov cohort models, the use of computer programming languages in their development has become more common. C++ is a programming language that has gained widespread recognition in computationally intensive fields, including systems modeling and performance-critical applications. It offers powerful tools for building high-performance microsimulation models, outpacing many traditional modeling software solutions, such as native R, in terms of speed and control over memory management. However, there is limited accessible guidance for implementing microsimulation models in C++. This tutorial offers a step-by-step approach to constructing microsimulation models in C++ and demonstrates its application through simplified but adaptable example decision models. We walk the reader through essential steps and provide generic C++ code that is flexible and suitable for adapting to a range of models. Finally, we present the standalone C++ models and their Rcpp counterparts run within R, and compare their performance to equivalent R implementations in terms of speed and memory efficiency.

Publication types

  • Review