unmarked is an R package for analyzing ecological data arising from several popular sampling techniques. The sampling methods include point counts, occurrence sampling, distance sampling, removal, double observer, and many others. unmarked uses hierarchical models to incorporate covariates of the latent abundance (or occupancy) and imperfect detection processes.

Installation

The latest stable version of unmarked can be downloaded from CRAN:

install.packages("unmarked")

The latest development version can be installed from Github:

install.packages("remotes")
remotes::install_github("rbchan/unmarked")

Support

Support is provided through the unmarked Google group. The package website has more information. You can report bugs here, by posting to the Google group, or by emailing the current maintainer.

Example analysis

Below we demonstrate a simple single-season occupancy analysis using unmarked. First, load in a dataset from a CSV file and format:

library(unmarked)
wt <- read.csv(system.file("csv","widewt.csv", package="unmarked"))

# Presence/absence matrix
y <- wt[,2:4]

# Site and observation covariates
siteCovs <-  wt[,c("elev", "forest", "length")]
obsCovs <- list(date=wt[,c("date.1", "date.2", "date.3")]) 

Create an unmarkedFrame, a special type of data.frame for unmarked analyses:

umf <- unmarkedFrameOccu(y = y, siteCovs = siteCovs, obsCovs = obsCovs)
summary(umf)

Fit a null occupancy model and a model with covariates, using the occu function:

(mod_null <- occu(~1~1, data=umf))
(mod_covs <- occu(~date~elev, data=umf))

Rank them using AIC:

fl <- fitList(null=mod_null, covs=mod_covs)
modSel(fl)

Estimate occupancy probability using the top-ranked model at the first six sites:

head(predict(mod_covs, type='state'))

Predict occupancy probability at a new site with given covariate values:

nd <- data.frame(elev = 1.2)
predict(mod_covs, type="state", newdata=nd)