multiocc: An R Package for Spatio-Temporal Occupancy Models for Multiple Species

Spatio-temporal occupancy models are used to model the presence or absence of a species at particular locations and times, while accounting for dependence in both space and time. Multivariate extensions can be used to simultaneously model multiple species, which introduces another dimension to the dependence structure in the data. In this paper we introduce multiocc, an R package for fitting multivariate spatio-temporal occupancy models. We demonstrate the use of this package fitting the multi-species spatio-temporal occupancy model to data on six species of birds from the Swiss MHB Breeding Bird Survey.

Staci Hepler (Department of Statistical Sciences, Wake Forest University) , Robert Erhardt (Department of Statistical Sciences, Wake Forest University)

0.1 Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at

J. H. Albert and S. Chib. Bayesian analysis of binary and polychotomous response data. Journal of the American Statistical Association, 88(422): 669–679, 1993.
J. R. Bradley, S. H. Holan and C. K. Wikle. Multivariate spatio-temporal models for high-dimensional areal data with application to longitudinal employer-household dynamics. The Annals of Applied Statistics, 9(4): 1761–1791, 2015.
D. Chamberlain, M. Brambilla, E. Caprio, P. Pedrini and A. Rolando. Alpine bird distributions along elevation gradients: The consistency of climate and habitat effects across geographic regions. Oecologia, 181(4): 1139–1150, 2016.
J. S. Clark, A. E. Gelfand, C. W. Woodall and K. Zhu. More than the sum of the parts: Forest climate response from joint species distribution models. Ecological Applications, 24(5): 990–999, 2014.
J. S. Clark, D. Nemergut, B. Seyednasrollah, P. J. Turner and S. Zhang. Generalized joint attribute modeling for biodiversity analysis: Median-zero, multivariate, multifarious data. Ecological Monographs, 87(1): 34–56, 2017.
J. W. Doser, A. O. Finley, M. Kéry and E. F. Zipkin. spOccupancy: An r package for single-species, multi-species, and integrated spatial occupancy models. Methods in Ecology and Evolution, 2022.
A. E. Gelfand, P. Diggle, P. Guttorp and M. Fuentes. Handbook of spatial statistics. CRC press, 2010.
G. Guillera-Arroita, M. Kéry and J. J. Jahoz-Monfort. Inferring species richness using multispecies occupancy modeling: Estimation performance and interpretation. Ecology and Evolution, 9(2): 780–792, 2019.
A. Guisan and C. Rahbek. SESAM–a new framework integrating macroecological and species distribution models for predicting spatio-temporal patterns of species assemblages. Journal of Biogeography, 38: 1433–1444, 2011.
S. A. Hepler and R. J. Erhardt. A spatiotemporal model for multivariate occupancy data. Environmetrics, 32(2): e2657, 2021.
S. A. Hepler, R. Erhardt and T. M. Anderson. Identifying drivers of spatial variation in occupancy with limited replication camera trap data. Ecology, 99(10): 2152–2158, 2018.
S. A. Hepler, K. A. Kaufeld, K. Benedict, M. Toda, B. R. Jackson, X. Liu and D. Kline. Integrating public health surveillance and environmental data to model presence of Histoplasma in the United States. Epidemiology, 2022. DOI 10.1097/EDE.0000000000001499.
J. Hughes and M. Haran. Dimension reduction and alleviation of confounding for spatial generalized linear mixed models. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 75(1): 139–159, 2013.
Information Systems and Wake Forest University. WFU High Performance Computing Facility. 2021. URL
D. S. Johnson, P. B. Conn, M. B. Hooten, J. C. Ray and B. A. Pond. Spatial occupancy models for large data sets. Ecology, 94(4): 801–808, 2013.
M. Kéry, A. Royle and M. Meredith. AHMbook: Functions and data for the book “applied hierarchical modeling in ecology.” R package version 0.1, 3: 2017.
S. R. Lele, M. Moreno and E. Bayne. Dealing with detection error in site occupancy surveys: What can we do with a single survey? Journal of Plant Ecology, 5(1): 22–31, 2012.
D. I. MacKenzie, J. D. Nichols, G. B. Lachman, S. Droege, J. A. Royle and C. A. Langtimm. Estimating site occupancy rates when detection probabilities are less than one. Ecology, 83(8): 2248–2255, 2002.
K. Mardia. Multi-dimensional multivariate gaussian markov random fields with application to image processing. Journal of Multivariate Analysis, 24(2): 265–284, 1988.
O. Ovaskainen, G. Tikhonov, A. Norberg, F. Guillaume Blanchet, L. Duan, D. Dunson, T. Roslin and N. Abrego. How to make more out of community data? A conceptual framework and its implementation as models and software. Ecology letters, 20(5): 561–576, 2017.
L. J. Pollock, R. Tingley, W. K. Morris, N. Golding, R. B. O’Hara, K. M. Parris, P. A. Vesk and M. A. McCarthy. Understanding co-occurrence by modelling species simultaneously with a joint species distribution model (JSDM). Methods in Ecology and Evolution, 5(5): 397–406, 2014.
H. A. Rahman, K. P. McCarthy, J. L. McCarthy and M. M. Faisal. Application of multi-species occupancy modeling to assess mammal diversity in northeast Bangladesh. Global Ecology and Conservation, 25: 2021.
C. T. Rota, R. J. Fletcher Jr, R. M. Dorazio and M. G. Betts. Occupancy estimation and the closure assumption. Journal of Applied Ecology, 46(6): 1173–1181, 2009.
C. T. Rota, C. K. Wikle, R. W. Kays, T. D. Forrester, W. J. McShea, A. W. Parsons and J. J. Millspaugh. A two-species occupancy model accommodating simultaneous spatial and interspecific dependence. Ecology, 97(1): 48–53, 2016.
J. A. Royle and R. M. Dorazio. Hierarchical modeling and inference in ecology: The analysis of data from populations, metapopulations and communities. Academic Press, 2008.
J. S. Sanderlin, J. D. Golding, T. Wilcox, D. H. Mason, K. S. McKelvey, D. E. Pearson and M. K. Schwartz. Occupancy modeling and resampling overcomes low test sensitivity to produce accurate SARS-CoV-2 prevalence estimates. BMC Public Health, 21(577): 2021.
N. C. Stenseth, J. M. Durant, M. S. Fowler, E. Matthysen, F. Adriaensen, N. Jonzén, K.-S. Chan, H. Liu, J. De Laet, B. C. Sheldon, et al. Testing for effects of climate change on competitive relationships and coexistence between two bird species. Proceedings of the Royal Society B: Biological Sciences, 282(1807): 20141958, 2015.
D. Taylor-Rodriguez, K. Kaufeld, E. M. Schliep, J. S. Clark and A. E. Gelfand. Joint species distribution modeling: Dimension reduction using dirichlet processes. Bayesian Analysis, 12(4): 939–967, 2017.
G. Tikhonov, Ø. H. Opedal, N. Abrego, A. Lehikoinen, M. M. de Jonge, J. Oksanen and O. Ovaskainen. Joint species distribution modelling with the r-package hmsc. Methods in ecology and evolution, 11(3): 442–447, 2020.
M. W. Tobler, M. Kéry, F. K. Hui, G. Guillera-Arroita, P. Knaus and T. Sattler. Joint species distribution models with species correlations and imperfect detection. Ecology, 100(8): e02754, 2019.
A. Vehtari, A. Gelman and J. Gabry. Practical bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and computing, 27: 1413–1432, 2017.



Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Hepler & Erhardt, "multiocc: An R Package for Spatio-Temporal Occupancy Models for Multiple Species", The R Journal, 2024

BibTeX citation

  author = {Hepler, Staci and Erhardt, Robert},
  title = {multiocc: An R Package for Spatio-Temporal Occupancy Models for Multiple Species},
  journal = {The R Journal},
  year = {2024},
  note = {},
  doi = {10.32614/RJ-2023-082},
  volume = {15},
  issue = {4},
  issn = {2073-4859},
  pages = {37-52}