Skip to contents

This vignette describes how to install CmdStan on your system to use as a backend for EpiSewer. If you cannot install CmdStan locally, you can alternatively use the docker backend (see the docker vignette).

Step 1: Install the EpiSewer package

Install the EpiSewer package from GitHub. This will also install the cmdstanr package, which is used to interface with CmdStan from R.

remotes::install_github("adrian-lison/EpiSewer", dependencies = TRUE)

Step 2: Check the C++ toolchain

CmdStan requires a working C++ toolchain. You can check whether your system is ready using:

If the toolchain is not set up, follow the instructions printed by the above function. The cmdstanr vignette also contains platform-specific guidance for setting up the toolchain on Windows, macOS, and Linux.

Step 3: Install CmdStan

Once the toolchain is ready, install CmdStan using:

cmdstanr::install_cmdstan(cores = 2) # use more cores to speed up installation

You can verify the installation was successful by checking the CmdStan version:

cmdstanr::cmdstan_version()

Step 4: Compile the EpiSewer models

The Stan models used by EpiSewer need to be compiled for your device. This is only necessary once — after installing or updating the package — and can be done using:

EpiSewer::sewer_compile()

Great, you are now ready to run EpiSewer! See the README for an introduction on how to use the package.

Troubleshooting

If the models are not successfully compiled in step 4, first ensure that CmdStan is properly set up by re-running step 2. You can also try updating CmdStan to a newer version by re-running cmdstanr::install_cmdstan().

If the problem persists, run EpiSewer::sewer_compile(verbose = TRUE) and post the output in a new GitHub issue, along with your cmdstanr::cmdstan_version().