This repository will contain materials for the virtual NIMBLE workshop for the UK National Centre for Statistical Ecology, 14 June 2021, 14:00 - 17:00 UK time (UTC+1). The online location is set up via the vNCSE meeting.
To prepare for the workshop:
- Install NIMBLE (see below)
- Install additional packages (see below)
- Download these materials. They should be complete by the morning of 14 June 2021.
All materials for the workshop will be in this GitHub repository. If you're familiar with Git/GitHub, you already know how to get all the materials on your computer. If you're not, go here, click the (green) "Code" button, and choose the "Download ZIP" option.
This workshop is organized into four modules:
- Overview of
nimble
using a capture-recapture example - Extending models and methods in NIMBLE.
- Overview of
nimbleEcology
with a worked hidden Markov model (HMM) example. - Introduction to
nimbleSCR
for spatial capture-recapture, with a worked example.
This workshop will focus on the nimble
software per se, not the statistical models. The material assumes attendees have basic knowledge of:
- ecological statistical models such as capture-recapture, occupancy, N-mixture, hidden Markov, and spatial capture-recapture.
- writing models in the "BUGS language", of which variants are in WinBUGS, OpenBUGS, JAGS, and NIMBLE.
Without this background, you will still be able to follow the workshop, but we will not have time to fill in basics of these topics.
Our user manual is here.
We have a 'cheatsheet' here.
For those of you who are not already familiar with writing models in WinBUGS, JAGS, or NIMBLE, you may want to look through the first module (Introduction to NIMBLE) or Section 5.2 of our user manual in advance.
We're happy to answer questions about writing models as we proceed through the workshop, but if you have no experience with it, reviewing in advance will greatly lessen the odds you feel lost right at the beginning.
NIMBLE is an R package on CRAN, so in general it will be straightforward to install as with any R package, but you do need a compiler and related tools on your system.
In summary, here are the steps.
-
Install compiler tools on your system. https://r-nimble.org/download has more details on how to install Rtools on Windows and how to install the command line tools of Xcode on a Mac. Note that if you have packages requiring a compiler (e.g., Rcpp) on your computer, you should already have the compiler tools installed.
-
Install the nimble package from CRAN in the usual fashion for an R package. More details (including troubleshooting tips) can also be found in Section 4 of the NIMBLE manual.
- To test that things are working please run the following code in R:
library(nimble)
code <- nimbleCode({
y ~ dnorm(0,1)
})
model <- nimbleModel(code)
cModel <- compileNimble(model)
If that runs without error, you're all set. If not, please see the troubleshooting tips. The most common problems have to do with the compiler tools. On Windows, the PATH must be set (see link to Rtools installation details from our download linked above). On OS X, command line tools must be installed as part of Xcode. If you remain stuck, please email the nimble-users group for help.
In general we encourage you to update to the most recent version of NIMBLE, 0.11.1.
Some of the packages we will use (beyond those automatically installed with nimble
) can be installed as follows:
install.packages(c("mcmcplots", "coda", "nimbleEcology", "nimbleSCR"))
compareMCMCs
is a package in development that is not yet on CRAN:
library(remotes)
install_github("nimble-dev/compareMCMCs", subdir = "compareMCMCs")
Windows users will probably need to use this invocation:
library(remotes)
install_github("nimble-dev/compareMCMCs", subdir = "compareMCMCs", INSTALL_opts = "--no-multiarch")