Shiny Contest Submission: DSAIRM - An R/Shiny package to teach modeling to immunologists and other lab scientists


This R package consists of a set of simulation models that teach within-host infection dynamics and immune response modeling from a dynamical system perspective. By manipulating the models through a graphical (Shiny) user interface and working through the provided instructions, you can learn about some important concepts of within-host and immmune response modeling. The target audience are immunologists and other bench scientists who are interested in modeling but who have little or no coding experience.


The main site for this R package is

Github source code is at: https://​​ahgroup/​DSAIRM

A less updated version with less functionality than the one on Github is on CRAN:

The package/app is on RStudio Cloud:

An online version is here:

Main features

  • Users can explore and learn about simulation models without having to write code
  • Multiple different simulation models are wrapped around a shiny interface which allows seamless exploration of a diverse set of models.
  • All simulations come with documentation and a list of tasks the user should do to learn the topic. This helps with learning/teaching, both as part of a classroom course and for self-learning.
  • The package is structured in a modular way, which allows students to gently move from no coding to light coding using the provided simulation models to downloading and modifying the models themselves.
  • Further information on how to get started and use the package/app are provided in the package vignette:


The main menu from which all simulations are accessed

User interface for one of the simulations

Part of the documentation that comes with each simulation.


  • A companion package to this one, which focuses on teaching/learning infectious disease modeling at the epidemiological, population level exists at
1 Like

Nice submission Andreas :wink: . Do you have any plans for more complex models that would need compilation (C, C++ or Fortran)?

Thanks! This package is meant for teaching, as such models will likely stay simple.
However, we are currently developing another package that allows students/users to build models graphically without coding. An early (mostly working) prototype is here:

Right now users can build and analyze a model graphically, and also download code that runs their model as differential equation (deSolve) or stochastic (adaptivetau) model. My thought is that eventually allowing export that might include components in lower level languages to allow faster running of models would be good. I know there is the package RxODE that turns ODE models into C code for speed. A version of that, or interfacing with that package might be useful. But I'm not very far yet with my thinking on this, other than 'something like that might be good'. I certainly welcome suggestions/contributions!

deSolve has utilities such as ccSolve to generate compiled code from R, but I am not sure whether it is on CRAN. From benchmark experience, RxODE is faster for most of ODE problems. However it does not have the flexibility of deSolve (does not support several operators such as modulo, ...)

In this shiny contest contribution, the patient simulator runs a compiled code with deSolve. However, as you mentioned, this code was written by hand and for your case, it is not in the scope of "Building model without coding".

Thanks for pointing out ccSolve, I didn't know about it. One problem I have with RxODE is that it's not easy to get working for beginners because of the required Rtools setup.
I checked your app, it looks very cool! I clicked around a bit, but I don't really know what I'm doing, not my area :slight_smile: I'll show it to my colleague who works on modeling of chronic diseases (diabetes) and is using shiny too.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.