Thank you participating in our workshop, Diagnostic Classification Modeling With R and Stan. To prepare for the workshop, please install the following:

install.packages(c("measr", "dplyr", "fs", "usethis"),
                 repos = "",
                 dependencies = TRUE)


By default, measr uses rstan as a backend for estimating models. However, the version of rstan on CRAN is outdated. Therefore, I recommend using an updated version of rstan from the stan-dev/r-packages repository, or using the cmdstanr interface to CmdStan.

Updated rstan

You can download an updated version of rstan by running the following code:

  c("StanHeaders", "rstan"),
  repos = c("", getOption("repos"))

To verify that rstan is installed correctly, run the following code. If it works, then things are set up properly! For additional help installing rstan, see the RStan Getting Started help page.

example(stan_model, package = "rstan", run.dontrun = TRUE)


For cmdstanr, I recommend installing the development version directly from Github:


After installing cmdstanr, you will also need to install CmdStan, which can be by running:


To ensure that cmdstanr and CmdStan are installed properly, try running the following code. If it works, then you are good to go! For help with install cmdstanr, see the Getting Started with CmdStanR vignette.

file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
mod <- cmdstan_model(file)