README.md

occupancy: an R package for fitting occupancy-detection models with JAGS

occupancy lets you write your model with a standard R mixed-model formula, and provides several methods for summarising, visualising, validating, and predicting from fitted models.

You can install the current version of the package (0.0.1) from GitHub (you will need to install the devtools package if not already installed):

devtools::install_github("jdyen/occupancy")

System requirements

The occupancy package uses the JAGS software to fit all models. JAGS will need to be downloaded and installed separately. You can find details about JAGS installation here.

Example analysis

The package includes some simulated data, and you can fit an occupancy-detection model to these data with the following code:

# load the occupancy package
library(occupancy)

# fit a model
mod <- occupancy(response ~ occ_predictor1 + occ_predictor2 +
                   (1 | occ_random1) + (1 | occ_random2),
                 ~ detect_predictor1 + detect_predictor2 + 
                   (1 | detect_random1),
                 site_id = "site",
                 survey_id = "survey",
                 data = occupancy_data,
                 jags_settings = list(n_iter = 1000, n_burnin = 500))

# plot the model coefficients
plot(mod)

# extract model coefficients
coef(mod)

# calculate model fit statistics
calculate_metrics(mod)

# cross validate a fitted model
validate(mod, n_cv = 5)

build status codecov.io license



jdyen/occupancy documentation built on July 8, 2019, 3:33 a.m.