Abstract
A health economic evaluation (HEE) is a comparative analysis of alternative courses of action in terms of both costs and consequences. A cost-effectiveness analysis is a type of HEE that compares an intervention to one or more alternatives by estimating how much it costs to gain an additional unit of health outcome. Cost-effectiveness analyses are commonly performed using Microsoft (MS) Excel. However, there is current interest in using other software that is better suited to more complex problems, methods, and data, as well as improved reproducibility and transparency. That is, it is increasingly important to be able to repeat an analysis of a particular data set and obtain the same results, and access the analysis and results in a clear and comprehensive openly available form. In this tutorial we provide a step-by-step guide on how to implement a mainstay model of HEE, namely a Markov model, in the statistical programming language R. The adoption of R for the purpose of cost-effectiveness analysis is highly dependent on the ability of the health economic modeller to understand, learn, and apply programming-type skills. R is likely to be less familiar than MS Excel for many modellers and so coding a cost-effectiveness model in R can be a large jump. We describe the technical details from the perspective of a MS Excel user to help bridge the gap between software and reduce the learning curve by providing for the first-time side-by-side comparisons of the Markov model example in MS Excel and R.
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig1_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig2_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig3_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig4_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig5_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig6_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig7_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig8_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig9_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig10_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig11_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig12_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig13_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig14_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig15_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig16_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig17_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig18_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig19_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig20_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs40273-022-01199-7/MediaObjects/40273_2022_1199_Fig21_HTML.png)
Similar content being viewed by others
References
Drummond MF, O’Brien B, Stoddart GL, et al. Methods for the economic evaluation of health care programmes. Oxford University Press; 1997. (978-0198529453).
Weinstein MC, Stason WB. Foundations of cost-effectiveness analysis for health and medical practices. N Engl J Med. 1977;296(13):716–21.
Hart R, Burns D, Ramaekers B, et al. R and shiny for cost-effectiveness analyses: why and when? A hypothetical case study. Pharmacoeconomics. 2020;38:765–76.
Edlin R, McCabe C, Hulme C, et al. Cost effectiveness modelling for health technology assessment, a practical course. Springer; 2015. https://doi.org/10.1007/978-3-319-15744-3.
Lunn DJ, Thomas A, Best N, et al. WinBUGS - A Bayesian modelling framework: concepts, structure, and extensibility. Stat Comput. 2000;10:325–37. https://doi.org/10.1023/A:1008929526011.
R Core Team. R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. 2020. https://www.R-project.org/. Accessed 2 May 2022.
Baio G, Heath A. When simple becomes complicated: why Excel should lose its place at the top table. Glob Reg Health Technol Assess. 2017;4(1):e3–6.
**n Y, Gray E, Robles-Zurita JA, Haghpanahan H, Heggie R, Kohli-Lynch C, Briggs A, McAllister DA, Lawson KD, Lewsey J. From spreadsheets to script: experiences from converting a Scottish cardiovascular disease policy model into R. Appl Health Econ Health Policy. 2021. https://doi.org/10.1007/s40258-021-00684-y.
RStudio Team. RStudio: Integrated Development for R. RStudio, PBC, Boston, MA URL. 2020. http://www.rstudio.com/. Accessed 2 May 2022.
Baio G, Berardi A, Heath A. Bayesian cost-effectiveness analysis with the R package BCEA. Springer; 2017. https://doi.org/10.1007/978-3-319-55718-2.
Jalal H, Pechlivanoglou P, Krijkamp E, et al. An overview of R in health decision sciences. Med Decis Making. 2017;37(7):735–46. https://doi.org/10.1177/0272989X16686559.
Krijkamp EM, Alarid-Escudero F, Enns EA, et al. Microsimulation modeling for health decision sciences using R: a tutorial. Med Decis Making. 2018;38(3):400–22. https://doi.org/10.1177/0272989X18754513.
Williams C, Lewsey JD, Briggs AH, et al. Cost-effectiveness analysis in R using a multi-state modeling survival analysis framework: a tutorial. Med Decis Making. 2016. https://doi.org/10.1177/0272989X16651869.
Taveras JL. R for excel users: an introduction to r for excel analysts. CreateSpace Independent Publishing Platform; 2016.
Filipovic-Pierucci A, Zarca KID-Z., Markov models for health economic evaluation modelling in R with the heemod Package. Value Health. 19(7): A369. https://arxiv.org/abs/1702.03252.
Grolemund G. Hands-on programming with R. O’Reilly, 2014; 978-1449359010. https://rstudio-education.github.io/hopr/index.html. Accessed 2 May 2022.
GitHub Docs: Licensing a repository. https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository. Accessed 20 Oct 2022.
Hunink M, Weinstein M, Wittenberg E, et al. Decision making in health and medicine: integrating evidence and values. Cambridge University Press; 2014. https://doi.org/10.1017/CBO9781139506779.
Norris JR. Markov chains. No. 2. Cambridge University Press; 1998. https://doi.org/10.1017/CBO9780511810633.
Briggs A. Decision modelling for health economic evaluation exercises. London: London School of Hygiene & Tropical Medicine; 2022. https://doi.org/10.17037/DATA.00002980.
Briggs A, Sculpher M. Introducing Markov models for economic evaluation. Pharmacoeconomics. 1998;13(4):397–409.
Briggs AH. Handling uncertainty in cost-effectiveness models. Pharmacoeconomics. 2000;17(5):479–500.
dplyr <-> base R. Tidyverse vignette. Package developed by Wickham H, François R, Henry L, Müller K, Rstudio. https://dplyr.tidyverse.org/articles/base.html. Accessed 2 Oct 2021.
Incerti D, Jansen JP. hesim: Health Economic, Simulation Modeling and Decision Analysis. 2021. https://arxiv.org/abs/2102.09437. Accessed 20 Oct 2022.
Wickham H, Advanced R, The R. The R Series. 2nd ed. Chapman & Hall/CRC; 2019. https://doi.org/10.1201/9781351201315.
Allaire J, **e Y, McPherson J, Luraschi J, Ushey K, Atkins A, Wickham H, Cheng J, Chang W, Iannone R. rmarkdown: Dynamic Documents for R. R package version 2.14. 2022. https://rmarkdown.rstudio.com. Accessed 20 Oct 2022.
Allaire J. quarto: R Interface to 'Quarto' Markdown Publishing System. R package version 1.2, 2022 https://CRAN.R-project.org/package=quarto. Accessed 20 Oct 2022.
Grolemund G, Wickham H. R Programming for Data Science. 1st ed. O’Reilly Media; 2016. (978-1491910399).
Csardi G, Nepusz T. The igraph software package for complex network research, InterJournal, Complex Systems. 2006; 1695. https://igraph.org. Accessed 20 Oct 2022.
Soetaert K. diagram: Functions for Visualising Simple Graphs (Networks), Plotting Flow Diagrams. R package version 1.6.5. 2020; https://CRAN.R-project.org/package=diagram. Accessed 20 Oct 2022.
Iannone R. DiagrammeR: Graph/Network Visualization. R package version. 2020;1.0.9. https://CRAN.R-project.org/package=DiagrammeR. Accessed 20 Oct 2022.
Spedicato GA. Discrete time Markov chains with R. R J. 2017;9(2):84–104.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Funding
Financial support for this study was provided by a Medical Research Council Centre pump-priming award. The funding agreement ensured the authors’ independence in designing the study, interpreting the data, writing, and publishing the report. The views expressed are those of the author(s) and are not necessarily those of author-affiliated institutions, including the National Institute for Health Research, the UK Health Security Agency or the Department of Health and Social Care.
Competing interests
The authors declare they have no conflicts of interest.
Consent to participate
Not applicable.
Ethics approval
Not applicable.
Consent for publication
Not applicable.
Data availability
All data used for this tutorial paper are available at https://github.com/Excel-R-tutorials/Markov-model-introduction
Code availability
Code for the R model used in this tutorial can be found on GitHub at the following link https://github.com/Excel-R-tutorials/Markov_Intro. The corresponding original MS Excel model is available open-access and can be downloaded from the following link https://doi.org/10.17037/DATA.00002980 [20].
Authorship statement
N. Green: Conceptualisation, writing original draft, validation, writing review and editing. F. Lamrock: Conceptualisation, writing original draft, validation, writing review and editing. N. Naylor: validation, writing review and editing. J. Williams: validation, writing review and editing. A. Briggs: Resources, writing review and editing.
Supplementary Information
Below is the link to the electronic supplementary material.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Green, N., Lamrock, F., Naylor, N. et al. Health Economic Evaluation Using Markov Models in R for Microsoft Excel Users: A Tutorial. PharmacoEconomics 41, 5–19 (2023). https://doi.org/10.1007/s40273-022-01199-7
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s40273-022-01199-7