  Occupancy modeling is a common approach to assess spatial and temporal
species distribution patterns, while explicitly accounting for measurement
errors common in detection-nondetection data. Numerous extensions of the basic
single species occupancy model exist to address dynamics, multiple species or
states, interactions, false positive errors, autocorrelation, and to integrate
multiple data sources. However, development of specialized and computationally
efficient software to fit spatial models to large data sets is scarce or
absent. We introduce the spOccupancy R package designed to fit single-species,
multi-species, and integrated spatially-explicit occupancy models. Using a
Bayesian framework, we leverage P\'olya-Gamma data augmentation and Nearest
Neighbor Gaussian Processes to ensure models are computationally efficient for
potentially massive data sets. spOccupancy provides user-friendly functions for
data simulation, model fitting, model validation (by posterior predictive
checks), model comparison (using information criteria and k-fold
cross-validation), and out-of-sample prediction. We illustrate the package's
functionality via a vignette, simulated data analysis, and two bird case
studies, in which we estimate occurrence of the Black-throated Green Warbler
(Setophaga virens) across the eastern USA and species richness of a
foliage-gleaning bird community in the Hubbard Brook Experimental Forest in New
Hampshire, USA. The spOccupancy package provides a user-friendly approach to
fit a variety of single and multi-species occupancy models, making it
straightforward to address detection biases and spatial autocorrelation in
species distribution models even for large data sets.
