Log in

Health Economic Evaluation Using Markov Models in R for Microsoft Excel Users: A Tutorial

  • Practical Application
  • Published:
PharmacoEconomics Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20
Fig. 21

Similar content being viewed by others

References

  1. Drummond MF, O’Brien B, Stoddart GL, et al. Methods for the economic evaluation of health care programmes. Oxford University Press; 1997. (978-0198529453).

    Google Scholar 

  2. Weinstein MC, Stason WB. Foundations of cost-effectiveness analysis for health and medical practices. N Engl J Med. 1977;296(13):716–21.

    Article  CAS  Google Scholar 

  3. 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.

    Article  Google Scholar 

  4. 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.

    Book  Google Scholar 

  5. 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.

    Article  Google Scholar 

  6. 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.

  7. 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.

    Google Scholar 

  8. **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.

    Article  Google Scholar 

  9. RStudio Team. RStudio: Integrated Development for R. RStudio, PBC, Boston, MA URL. 2020. http://www.rstudio.com/. Accessed 2 May 2022.

  10. 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.

    Book  Google Scholar 

  11. 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.

    Article  Google Scholar 

  12. 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.

    Article  Google Scholar 

  13. 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.

    Article  Google Scholar 

  14. Taveras JL. R for excel users: an introduction to r for excel analysts. CreateSpace Independent Publishing Platform; 2016.

    Google Scholar 

  15. 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.

  16. Grolemund G. Hands-on programming with R. O’Reilly, 2014; 978-1449359010. https://rstudio-education.github.io/hopr/index.html. Accessed 2 May 2022.

  17. 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.

  18. 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.

    Book  Google Scholar 

  19. Norris JR. Markov chains. No. 2. Cambridge University Press; 1998. https://doi.org/10.1017/CBO9780511810633.

    Book  Google Scholar 

  20. Briggs A. Decision modelling for health economic evaluation exercises. London: London School of Hygiene & Tropical Medicine; 2022. https://doi.org/10.17037/DATA.00002980.

    Book  Google Scholar 

  21. Briggs A, Sculpher M. Introducing Markov models for economic evaluation. Pharmacoeconomics. 1998;13(4):397–409.

    Article  CAS  Google Scholar 

  22. Briggs AH. Handling uncertainty in cost-effectiveness models. Pharmacoeconomics. 2000;17(5):479–500.

    Article  CAS  Google Scholar 

  23. 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.

  24. Incerti D, Jansen JP. hesim: Health Economic, Simulation Modeling and Decision Analysis. 2021. https://arxiv.org/abs/2102.09437. Accessed 20 Oct 2022.

  25. Wickham H, Advanced R, The R. The R Series. 2nd ed. Chapman & Hall/CRC; 2019. https://doi.org/10.1201/9781351201315.

    Book  Google Scholar 

  26. 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.

  27. 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.

  28. Grolemund G, Wickham H. R Programming for Data Science. 1st ed. O’Reilly Media; 2016. (978-1491910399).

    Google Scholar 

  29. Csardi G, Nepusz T. The igraph software package for complex network research, InterJournal, Complex Systems. 2006; 1695. https://igraph.org. Accessed 20 Oct 2022.

  30. 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.

  31. Iannone R. DiagrammeR: Graph/Network Visualization. R package version. 2020;1.0.9. https://CRAN.R-project.org/package=DiagrammeR. Accessed 20 Oct 2022.

  32. Spedicato GA. Discrete time Markov chains with R. R J. 2017;9(2):84–104.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Felicity Lamrock.

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.

Supplementary file1 (DOCX 157 kb)

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.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

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

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s40273-022-01199-7

Navigation