The problem we want to asses

Using the WCS camera trap dataset

model
Authors

German Forero

Diego J. Lizcano

Published

May 20, 2025

Code
library(grateful) # Facilitate Citation of R Packages
library(readxl) # Read Excel Files
library(DT) # A Wrapper of the JavaScript Library 'DataTables'
library(sf) # Simple Features for R
library(mapview) # Interactive Viewing of Spatial Data in R
library(maps) # Draw Geographical Maps
library(tmap) # Thematic Maps
library(terra) # Spatial Data Analysis
library(elevatr) # Access Elevation Data from Various APIs
library(unmarked) # Models for Data from Unmarked Animals
library(ubms) # Bayesian Models for Data from Unmarked Animals using 'Stan'

library(tidyverse) # Easily Install and Load the 'Tidyverse'

We want to Asses the role of Protected Areas (PA) in the conservation of vertebrates using on the ground data.

Evaluating whether PA are working is essential as they are perhaps the primary strategy for averting biodiversity loss. Its been suggested that some do no work, paper parks Its crucial to continue working on best methods to evaluate their impact.

Over a decade ago researchers started evaluating role of PA, mostly focused on the effects of PA in reducing threats (fires, deforestation) and focused on forest cover. However assessments of PA on species comparing inside vs outside is not a common practice.

Even if we are effective in protecting forests, and the forest is in very good condition, PA could have “empty forests” and loosed biodiversity (by hunting-poaching, diseases or introduced species). So when we say a PA is effective, are we looking at this?

TipAnimals live inside the forest. The forest is not empty!

We want to compare apples with apples and control for covariates related with occupancy and abundance of species, like elevation, human pressures, ecosystem type, etc.

Occupancy is a cost effective method for evaluation a population, it is a state variable, representing the proportion of the area occupied by the species, solving the problem of imperfect detection.

We compiled camera trap deployment data sets that have intentionally sampled inside and outside PAS, in a quasi-experimental design, using camera traps.

Each case each camera is adequately matched, in a similar fashion as the remote sensing approaches.

We used a multispecies occupancy model, and a variation incorporating spatial autocorrelation, to compare occupancy inside and outside the PA and also as a distance to the protected area border.

Package Citation

Code
pkgs <- cite_packages(output = "paragraph", pkgs="Session", out.dir = ".")
# knitr::kable(pkgs)
pkgs

We used R v. 4.4.2 (R Core Team 2024) and the following R packages: DT v. 0.34.0 (Xie et al. 2025), elevatr v. 0.99.0 (Hollister et al. 2023), maps v. 3.4.3 (Becker et al. 2025), mapview v. 2.11.4 (Appelhans et al. 2025), sf v. 1.0.21 (Pebesma 2018; Pebesma and Bivand 2023), terra v. 1.8.60 (Hijmans 2025), tidyverse v. 2.0.0 (Wickham et al. 2019), tmap v. 4.2 (Tennekes 2018), ubms v. 1.2.7 (Kellner et al. 2021), unmarked v. 1.5.0 (Fiske and Chandler 2011; Kellner et al. 2023).

Sesion info

Code
print(sessionInfo(), locale = FALSE)
R version 4.4.2 (2024-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.9.4 forcats_1.0.0   stringr_1.5.2   dplyr_1.1.4    
 [5] purrr_1.1.0     readr_2.1.5     tidyr_1.3.1     tibble_3.2.1   
 [9] ggplot2_4.0.0   tidyverse_2.0.0 ubms_1.2.7      unmarked_1.5.0 
[13] elevatr_0.99.0  terra_1.8-60    tmap_4.2        maps_3.4.3     
[17] mapview_2.11.4  sf_1.0-21       DT_0.34.0       readxl_1.4.3   
[21] grateful_0.3.0 

loaded via a namespace (and not attached):
 [1] DBI_1.2.3            pbapply_1.7-2        gridExtra_2.3       
 [4] tmaptools_3.3        s2_1.1.9             inline_0.3.20       
 [7] logger_0.4.0         rlang_1.1.6          magrittr_2.0.3      
[10] matrixStats_1.5.0    e1071_1.7-16         compiler_4.4.2      
[13] loo_2.8.0            png_0.1-8            vctrs_0.6.5         
[16] pkgconfig_2.0.3      wk_0.9.4             fastmap_1.2.0       
[19] lwgeom_0.2-14        leafem_0.2.4         rmarkdown_2.29      
[22] tzdb_0.4.0           spacesXYZ_1.6-0      xfun_0.52           
[25] satellite_1.0.5      jsonlite_2.0.0       parallel_4.4.2      
[28] R6_2.6.1             stringi_1.8.4        RColorBrewer_1.1-3  
[31] StanHeaders_2.32.10  cellranger_1.1.0     stars_0.6-8         
[34] Rcpp_1.1.0           rstan_2.32.6         knitr_1.50          
[37] base64enc_0.1-3      timechange_0.3.0     Matrix_1.7-1        
[40] tidyselect_1.2.1     rstudioapi_0.17.1    dichromat_2.0-0.1   
[43] abind_1.4-8          yaml_2.3.10          maptiles_0.10.0     
[46] codetools_0.2-20     curl_7.0.0           pkgbuild_1.4.8      
[49] lattice_0.22-6       leafsync_0.1.0       withr_3.0.2         
[52] S7_0.2.0             evaluate_1.0.4       units_0.8-7         
[55] proxy_0.4-27         RcppParallel_5.1.9   pillar_1.11.1       
[58] KernSmooth_2.23-24   stats4_4.4.2         generics_0.1.3      
[61] sp_2.2-0             hms_1.1.3            rstantools_2.4.0    
[64] scales_1.4.0         class_7.3-22         glue_1.8.0          
[67] tools_4.4.2          leaflegend_1.2.1     data.table_1.17.8   
[70] RSpectra_0.16-2      XML_3.99-0.18        grid_4.4.2          
[73] QuickJSR_1.4.0       crosstalk_1.2.1      colorspace_2.1-1    
[76] cols4all_0.8-1       raster_3.6-32        cli_3.6.5           
[79] V8_6.0.0             gtable_0.3.6         digest_0.6.37       
[82] progressr_0.15.0     classInt_0.4-11      htmlwidgets_1.6.4   
[85] farver_2.1.2         htmltools_0.5.8.1    lifecycle_1.0.4     
[88] leaflet_2.2.3        microbenchmark_1.5.0 MASS_7.3-61         

References

Appelhans, Tim, Florian Detsch, Christoph Reudenbach, and Stefan Woellauer. 2025. mapview: Interactive Viewing of Spatial Data in r. https://CRAN.R-project.org/package=mapview.
Becker, Richard A., Allan R. Wilks, Ray Brownrigg, Thomas P. Minka, and Alex Deckmyn. 2025. maps: Draw Geographical Maps. https://CRAN.R-project.org/package=maps.
Fiske, Ian, and Richard Chandler. 2011. unmarked: An R Package for Fitting Hierarchical Models of Wildlife Occurrence and Abundance.” Journal of Statistical Software 43 (10): 1–23. https://www.jstatsoft.org/v43/i10/.
Hijmans, Robert J. 2025. terra: Spatial Data Analysis. https://CRAN.R-project.org/package=terra.
Hollister, Jeffrey, Tarak Shah, Jakub Nowosad, Alec L. Robitaille, Marcus W. Beck, and Mike Johnson. 2023. elevatr: Access Elevation Data from Various APIs. https://doi.org/10.5281/zenodo.8335450.
Kellner, Kenneth F., Nicholas L. Fowler, Tyler R. Petroelje, Todd M. Kautz, Dean E. Beyer, and Jerrold L. Belant. 2021. ubms: An R Package for Fitting Hierarchical Occupancy and n-Mixture Abundance Models in a Bayesian Framework.” Methods in Ecology and Evolution 13: 577–84. https://doi.org/10.1111/2041-210X.13777.
Kellner, Kenneth F., Adam D. Smith, J. Andrew Royle, Marc Kery, Jerrold L. Belant, and Richard B. Chandler. 2023. “The unmarked R Package: Twelve Years of Advances in Occurrence and Abundance Modelling in Ecology.” Methods in Ecology and Evolution 14 (6): 1408–15. https://www.jstatsoft.org/v43/i10/.
Pebesma, Edzer. 2018. Simple Features for R: Standardized Support for Spatial Vector Data.” The R Journal 10 (1): 439–46. https://doi.org/10.32614/RJ-2018-009.
Pebesma, Edzer, and Roger Bivand. 2023. Spatial Data Science: With applications in R. Chapman and Hall/CRC. https://doi.org/10.1201/9780429459016.
R Core Team. 2024. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Tennekes, Martijn. 2018. tmap: Thematic Maps in R.” Journal of Statistical Software 84 (6): 1–39. https://doi.org/10.18637/jss.v084.i06.
Wickham, Hadley, Mara Averick, Jennifer Bryan, Winston Chang, Lucy D’Agostino McGowan, Romain François, Garrett Grolemund, et al. 2019. “Welcome to the tidyverse.” Journal of Open Source Software 4 (43): 1686. https://doi.org/10.21105/joss.01686.
Xie, Yihui, Joe Cheng, Xianying Tan, and Garrick Aden-Buie. 2025. DT: A Wrapper of the JavaScript Library DataTables. https://CRAN.R-project.org/package=DT.

Reuse

Citation

BibTeX citation:
@online{forero2025,
  author = {Forero, German and J. Lizcano, Diego},
  title = {The Problem We Want to Asses},
  date = {2025-05-20},
  url = {https://dlizcano.github.io/Occu_APs_all/blog/2025-10-10-the-model/},
  langid = {en}
}
For attribution, please cite this work as:
Forero, German, and Diego J. Lizcano. 2025. “The Problem We Want to Asses.” May 20, 2025. https://dlizcano.github.io/Occu_APs_all/blog/2025-10-10-the-model/.