A novel generalized spatial mark-resight model that accounts for group associations
Data files
Feb 05, 2026 version files 437.57 MB
Abstract
The number and distribution of animals in space form the basis of many wildlife studies. Yet, reliable estimation of population abundance remains challenging. Generalized spatial mark-resight (gSMR) models are widely applicable abundance estimators that do not require all individuals be uniquely identifiable. Despite their flexibility, gSMR models assume independence in distribution and detections of individuals throughout space. Group-living species that aggregate (i.e., share activity centers) and move cohesively (i.e., share detections) violate these assumptions, limiting the applicability of gSMR models to solitary species with limited home range overlap.
We developed a gSMR model that accounts for group associations to estimate spatial abundance. We treated groups as the measurable “units” and included a submodel that uses Poisson processes to estimate group size. We conducted a simulation study to compare our novel group-based gSMR to a gSMR that ignores group associations. We generated data across varying levels of aggregation and cohesion parameters. We then quantified and compared precision and bias of parameter estimates between the two models.
The group-based gSMR model outperformed the individual-based gSMR under all aggregation and cohesion scenarios. Group-based 95% Bayesian Credible Intervals (BCI) overlapped the true value of abundance in 91% of simulations, compared to only 10% of simulations in the individual-based gSMR. Both the group-based and individual-based models became less precise and more biased as aggregation and group-size increased. However, the group-based gSMR model was less biased in estimating all parameters when compared to the individual-based gSMR model.
We applied our group-based gSMR model to grey wolf (Canis lupus) monitoring data within a Canadian national park complex (Banff, Yoho, and Kootenay National Parks, and Ya Ha Tinda). We used 12 years (2012-2023) of remote camera data, along with information from GPS radio-collared wolves (N = 16) to estimate spatiotemporal variation in abundance. Over a 12-year period wolf abundance averaged 73 (95% BCI = 20 – 207) individuals, and a density of 6.69 (95% BCI = 1.83 – 19.0) wolves per 1,000 km2 within the park complex. Our novel group-based gSMR model extends the applicability of spatial mark-resight to species with group associations.
Repository for finalized code and data for submission to Methods in Ecology and Evolution
Prepared by Connor J. Meyer
All data to run models and simulations is included in the "Data" tab. Code for the simulation study is included in the "Code" and "Simulation Study" folder. Code to run the Wolf Case Study is included in the "Code" and "Wolf Case Study Folders". All code is mapped to data and results within this Rproj. file.
Metadata for all data necessary to recreate analyses discussed in the manuscript are included in the csv file DataDescrption_MetaData.csv located in the "Data" folder
##############################################################################################################
Wolf Case Study R Code Files
0a. nimble_efficient_functions.R - custom functions to calculate lambda and distributions of vectors.
0b. group gSMR model code.R - Model code for group-based gSMR model to analyze wolf remote camera data
1a. Run Model.r - R script for importing data and fitting the wolf gSMR model. Script calls upon 0a. nimble_efficient_functions.R and 0b. group gSMR model code.R
1b. Combine and plot results.R - R script for importing results from wolf gSMR case study includes importing raw data and MCMC (Markov Chain Monte Carlo; an algorithm to estimate results from a posterior distribution) results in an RData file
1c. Compare Manual and Coda BCI estimates.R - Rscript for comparing Bayesian model results "manually" using summarize function and CODA package
#######
Wolf Case Study Data Files and Information
Data File: abundance_mcmc_byPark.csv - Raw MCMC (Markov Chain Monte Carlo) ouputs of group based gSMR model for each protected area
- chain = MCMC chain number
- iter = mcmc iteration
- Region = refers to the name of the protected area region (e.g., Banff, Yoho, Kootenay national parks)
- Year = annual year
- value = output value from the mcmc estimator, raw number of wolves estimated within the park area
- area.1000km = area of each protected area in 1000km
Data File: d2.cam.Rdata
- Matrix of squared euclidean distance dbetween each pixel (row) and each remote camera site (column)
Data File: Density_xy_10km.csv - Gridcell density estimates for each gridcell in statespace
- Year = Year
- x = gridcell x-axis location (UTM zone 11N)
- y = gridcell y-axis location (UTM zone 11N)
- n = abundance estimate for each gridcell (raw number of wolves estimated within each 10x10km gridcell)
- niter = mcmc iteration corresponding to the estimate
Data File: detect.marked.csv - detection data for marked (radio-collared) wolves
- site.id = unique site id that links to site_cam$site.id
- location = unique camera site name that links to site_cam$location
- start = capture occasion start date
- end = capture occasion end date
- occasion = unique reccuring annual occasion number
- NDays = number of 24 days within each occasion
- Year = annual year
- animal_name = animal name that lnks to gps_day$animal_name
- Detect = total number of detections of wolves per occasions
- NTotal = total number of detect events per occasion
Data File: detect.year.cam.csv - detection history data for cameras summarized by year
- site.id = unique site id that links to site_cam$site.id
- Year = annual year
- location = unique camera site name that links to site_cam$location
- NTotal = total number of wolf detection events per camera per year
- NEvents = total number of detection events per camera per year
- nDetOcc = umber of occasions with detections per camera per year
- nCamOcc = number of occasions sampled per camera per year
Data File: gps.day.csv - daily gps information of marked (radio-collared) wolves
- animal_name = unique animal name
- sex = animal sex (male or female)
- Date = Date of gps location
- Year = annual year
- x = x coordinate (UTM zone 11N; random selection of one gps location from that date)
- y = y coordinate (UTM zone 11N; random selection of one gps location from that date)
- remove = originally a filter to keep locations, but all == 1
- geometry = x,y geometry of locations to be created/used with SF package in Rstudio
Data File: occ.long.cam.csv - occurance data for wolves in long format: Each occasion is a 14 day period, unless otherwise listed in NDays column
- site.id = site id that links to site_cam$site.id
- location = camera site name that links to site_cam$location
- start = occasion start date
- end = occasion end date
- occasion = unique annually reccuring occasion number
- NDays = number of days within the occasion
- Year = annual year
- NTotal = total number of detections per occasion
- NEvents = total number of detection events per occasion
- Detect = was a wolf detected (1 = yes, 0 = no)
Data File: pix.xy.csv - table of pixel coordinate with spatial information
- x = x coordinate (UTM 11N)
- y = y coordinate (UTM 11N)
- id = pixel id (unique number from 1 to total number of pixels)
- x.id = pixel number on the x axis
- y.id = pixel number on the y axis
- inStudy = is the pixel within the state space (1 = yes, 0 = no)
- inStudy2017 = is the pixel within the state space of a 2017 remote camera study
- banff = pixel within Banff National Park (1 = yes, 0 = no)
- koot = pixel within Kootenay National Park (1 = yes, 0 = no)
- yoho = pixel within Yoho National Park (1 = yes, 0 = no)
- yahatinda = pixel within Ya Ha Tinda (1 = yes, 0 = no)
- study.parks = In one of hte study parks (Banff, Kootenay, Yoho, Ya Ha Tinda)
- ssf.sc = wolf step selection function (SSF) covariate values for the 10x10km pixel. Extracted from a previously developed SSF, centered and scaled
- dpark = distance from pixel to protected area (km)
Data File: pixel.lookup.csv - matrix lookup table that links x.id and y.id (pixel coordinates) to a unique pixel number in pix_xy
Data File: site.cam.csv - Spatial Attributes of remote camera locations
- site.id = unique site id
- location = unique location name
- x = x-coordiante (UTM 11N)
- y = y-coordinate (UMT 11N)
- trailroad = binary variable whether remote camera is located on a trail or a road (yes = 1, no = 0)
- dpark = covariate for distance from remote camera to a protected area (km)
- ssf.sc = wolf step selection function (SSF) covariate values for the remote camera location. Extracted from a previously developed SSF, centered and scaled
Data File: group gSMR MCMC input data.RData - This RData file is a combination of all the csv files provided above to run MCMC analyses. Also includes initial value, data, and constants.
Located in Results Folder:
Data File: All.MCMC.Results.RData - Contains raw results from MCMC analysis using the group-based gSMR. Included to view results without re-running model code
##############################################################################################################
Simulation Study R Code Files
01a. nimble models gSMR.R - Model code for group- and individual-based gSMR model for simulation study
01b. simData Cohesion Discrete.R - Function code for simulating detection history with various aggregation and cohesion scenarios
01c. run simulation study gSMR_gSMR Group.R - R code to simulate detection history and estimate abundance using individual- and group-based gSMR model code. This code calls upon 01a. nimble models gSMR.R and 01b. simData Cohesion Discrete.R
01d. Combine and Summarise Simulation Results.R - R code to read in data from and plot results of simulation study
1e. Compare all results to subsampled simulation results.r - R code to compare all converged simulated results (a la 01d. Combine and Summarise Simulation Results.R) to a subsample of 100 converged simulations per aggregation and cohesion scenario
1f. Plot Simulated Detections Per Scenario.r - R code to visualize total and average number of detections per aggregation and cohesion scenario
Simulation Study Data Files and Information
Data File: simulated.detections.csv - Simulated detection data given cohesion and aggregation parameters
- Cohesion = cohesion parameter value (range = 0 - 1)
- n.packs = parameter value for number of packs withint he study area. inversely related to group size
- n.det = total number of detections per simulation run
- avg.det = average number of detections per individual per simulation run
- sim.number = number related wot which simulation the data belongs to
Data File: simulation.study.results.csv - results from simulation study testing individual- and group-based gSMR models under varying aggregation and groupsize scenarios
- xxx = models under varying aggregation and groupsize scenarios
- simID = unique ID for each simulation
- param = parameter identifier in question
- true_value = true value of the parameter
- median = posterior median value of parameter
- SD = posterior standar deviation of parameter
- lcl = 95% bayesian lower credible interval
- ucl = 95% bayesian upper credible interval
- Gelman = Gelman-Rubin diagnostic statistic value
- model = individual based (gSMR) or group based (group gSMR)
- nMarkd = number of marked individual in state space (constant at 25% of N)
- GroupSize = average size of each group, though the size of each group is not identical as individuals were assigned to each group using a uniform distribution. inversely related to group size
- N.packs = number of groups in state space
- cohesion = cohesion paramter value (range = 0 - 1)
##############################################################################################################
Suggested Program:
We suggest users of this data use program R and Rstudio to repeat the analysis described in Meyer et al. 2026 "A novel generalized spatial mark-resight model that accounts for group associations". Data were analyzed using R version 2.5.0.
We also recommend users install and have updated nimble, coda, patchwork, readr, stringr, readxl, here, and tidyverse packages in R to smoothly run analyses.
