mrgsolve user guide


Kyle Baron


August 17, 2023


Welcome to the mrgsolve user guide. The user guide is the main documentation source for how mrgsolve works and how to best use mrgsolve in your modeling and simulation project. As with most of the mrgsolve documentation, this is a work in progress. I am currently working to transition this to more of a reference resource, rather than demonstration. So key content in the user guide includes Chapter 2 on model specification, Chapter 1 on model components and Chapter 7 on the simulation sequence. Installation is a big topic but we defer to the wiki page for installation help since requirements tend to change frequently with new R releases. The other content is hopefully helpful as well. I’m leaving it all in place for now, but will gradually transition the “how-to” and demo type content over to the vignettes repository or the gallery repository (see below).

Please feel free to ask questions about anything mrgsolve-related on the issue tracker on the main github repo:


If you are accessing the user guide via html, you should be able to see a table of contents on the left. That has a lot of detail in there so I’m going to give you high-level overview of what is here (the high-level should be pretty clear in the pdfbook).

  • Chapter 1 tells you about what is in the mrgsolve model object (like parameters, compartments, C++ functions and the like)
  • Chapter 2 tells you about model specification. There are two main sections to this chapter: Section 2.2) lists the different model code blocks and Section 2.3) lists the different variables that you can get (or set) in the different code blocks
  • Chapter 3 shows you how to format input data sets
  • Chapter 4 shows you how to create and work with simple data set objects called event objects
  • Chapter 5 shows how to work with model matrices
  • Chapter 6 tells you about the simulated output object and how you can work with it
  • Chapter 7 dives into the simulation sequence, showing you the steps that mrgsolve takes to work through a problem
  • Chapter 8 gives the details on how mrgsolve advances the system to a pharmacokinetic steady state
  • Chapter 9 talks about different plugins you can use for more advanced modeling
  • Chapter 10 talks about modeled events (discontinuities in the simulation that are triggered from within the model rather than from the data set)
  • Chapter 11 is a collection of applied examples on different topics
  • Chapter 12 are brief questions and answers providing some bits of information that don’t obviously fit into another chapter
  • Chapter 13 provides links to some Wiki pages that can help with installation

PDF Version

This book is also available in pdf format here.

Other Resources

This book was assembled on Thu Aug 17 16:12:29 2023 with mrgsolve version 1.1.1.