How to use this guide
Work through each page in order. Follow along with the code examples as you go. You’ll gradually build up a working model and your skills as you progress.
Each section builds on the previous one. You can:
- Follow the explanations and instructions
- Copy and run the provided code
- Complete exercises at the end to test your understanding
It will help you meet two important reproducibility standards:
NHS Levels of RAP STARS reproducibility recommendations
Language selection
Use the toggle above to switch between Python and R examples throughout.
You have selected: Python
You have selected: R
What you’ll need
- Your chosen programming language installed (Python or R).
- A code editor or IDE (e.g., VSCode, RStudio, PyCharm, Positron).
For NHS readers: If your IT department is concerned about installing open source software, check out this advice from the Health Service Modelling Associates (HSMA) website. For users interested in Python and VSCode, HSMA also have a tutorial on how to set this up.
Before you get started…
If you are new to discrete-event simulation (DES), reproducibility and Reproducible Analytical Pipelines (RAP), or to using free and open source software, it is worth spending a little time on the foundations first.
The following short introductions provide the background you need for this book:
Discrete-Event Simulation - what DES is, explaining the key components and concepts underlying these models, and touching on their use in healthcare.
Reproducible Analytical Pipelines - defining reproducibility and RAPs, and explaining the advantages of reproducibility for you and for others.
Free & Open Source Software - what “free and open source means”, why it is strongly preferred for RAPs, and an overview of FOSS tools for DES, including an explanation for the tools chosen for this book.
Example models
Four complete example repositories show fully-implemented DES models. At the end of relevant pages, you’ll see an “Explore the example models” callout pointing you to sections you can reference.
Work through the guide first to understand the fundamentals, then refer to the examples to see how concepts work in practice and adapt them for your own models.
Ready? Let’s get started. → Next: Version control



