Chapter 2 Preparation and Installation

2.1 Pre-Workshop preparation

We will present this initial workshop primarily as a demonstration. So you do not need to run any actual code, in order to get a good sense of what the package can do.

If you are reasonably familiar with using R, and you do want to follow along with the coding during the workshop, please ensure you have installed the most recent version of R (4.0.3) and RStudio.

In addition, please install the bbsBayes package and download the data.

Finally, if you haven’t used JAGS before, you’ll also need to install this stand-alone program (the Bayesian MCMC software that the package relies on). Follow the link below to download the installer.

2.2 Installation

bbsBayes is on CRAN! There are two ways to install the package:

Option 1: Stable release from CRAN

# To install from CRAN:
install.packages("bbsBayes")

Option 2: Less-stable development version

# To install the development version from GitHub:
install.packages("devtools")
library(devtools)
devtools::install_github("BrandonEdwards/bbsBayes")

2.3 Data Retrieval

You can download BBS data by running fetch_bbs_data. This will save the data to a package-specific directory on your computer. You must agree to the terms and conditions of the data usage before the download will run [type yes at the prompt]. You only need run this function once for each annual update of the BBS database.

fetch_bbs_data()

There are options to download the available stop-level data, so you can use the package to access these data. However, for now the bbsBayes modeling functions only work with the route-level summaries. So use the defaults in the function.

2.4 Install JAGS

The modeling functions of bbsBayes require an installation of JAGS. JAGS is installed from SourceForge, an open software distribution agent. Follow this link to install [https://sourceforge.net/projects/mcmc-jags/].

2.5 Example data for Barns Swallow

This link allows you to download some example model results for Barn Swallow. This model output can be used with many of the visualization and estimation functions for the package (without having to wait hours-days for the models to run). To use these saved results, save these four folders to a relevant folder in your working directory. Each folder contains the input data object jags_data and the model output object jags_mod, stored as a saved R workspace. Each of the four folders contains the results from fitting one of the bbsBayes models to data for Barn Swallow. You can explore the differences among the four models in section 4.2.