Data & Software

Software installation requirements

Data & Software

Data

Download the Desert Pocket Mouse data

Software Installation

These models are fit using Stan, which compiles each model to C++, so you need a working C++ toolchain in addition to the R packages.

1. Install a C++ toolchain if you don’t already have one:

  • Windows: Install the version of Rtools that matches your version of R (e.g., Rtools45 for R 4.5.x). Check your R version by running R.version.string.
  • macOS: Install Xcode’s command line tools by running xcode-select --install in the Terminal. You don’t need the full Xcode app from the App Store.
  • Linux: Install g++ and make using your distribution’s package manager (e.g., sudo apt install build-essential on Ubuntu/Debian).

2. Install cmdstanr:

install.packages(
  "cmdstanr",
  repos = c('https://stan-dev.r-universe.dev', getOption("repos"))
)

3. Install CmdStan (this can take several minutes):

library(cmdstanr)
check_cmdstan_toolchain()
install_cmdstan()

If this fails try:

check_cmdstan_toolchain(fix = TRUE)
install_cmdstan()

5. Test to make sure the installation worked

cmdstan_version()

If this returns a version number (e.g., “2.37.0”) then the test passed.

library(mvgam); data(portal_data); mvgam(captures ~ 1, data = portal_data)

If this prints a bunch of output and no errors your all set!

If either fails try:

check_cmdstan_toolchain(fix = TRUE)
install_cmdstan()
cmdstan_version()

6. Install mvgam

install.packages("mvgam")