Search for a command to run...
The purpose of this code is to replicate the analyses associated with the manuscript: Parvin, L.K., V. Jirinec, M. Leu, and J.J. Valente. (in review). Survey protocols drive heterogeneity in occupancy estimates that cannot be standardized using post-hoc analyses. Ecological Solutions and Evidence.__ This manuscript simulates point count sampling of a simulated Wood Thrush (Hylocichla mustelina)__ population and evaluates whether asymptotic regression models can be used to recover true instantaneous, daily, and seasonal occupancy rates. The script for simulating Wood Thrush locations is already published and available via Appendix 5 at (https://doi.org/10.5066/P98BJAQU). That script produces csv files named simResults# where the # sign refers to the simulation iteration. For ease of use, we have uploaded results from two simulation iterations here as CSV files named "simResults1.csv" and "simResults2.csv". To replicate the analyses associated with Parvin et al. (in review), begin with "pointCountOccupancyAnalysis.R". This script (1) pulls in the spatiotemporal Wood Thrush simulations (e.g., simResults1.csv, simResults2.csv), (2) generates simulated point count data based on user-specified survey parameters, (3) fits occupancy models to the resulting simulated data, and (4) outputs the occupancy model estimates from those analyses as CSVs. Again, we have uploaded two of these estimate files here as well ("occResults1.csv" and "occResults2.csv") for ease of use. The next script is "asymptoticModeling.R", which processes each occResults#.csv file for downstream asymptotic modeling. The script logit-transforms occupancy-related values and quantifies bias by comparing model-based occupancy estimates to the known “true” instantaneous, daily, and seasonal occupancy values derived directly from the simulated Wood Thrush populations. You must specify the focal density at the top of the script. The script then subsets the data into time series of occupancy estimates where simulation ID, interval length, and radius are held constant, and creates truncated series based on survey duration: a 5-minute survey yields 5 minute-level occupancy estimates, whereas a 30-minute survey yields 30. For each time series, the script fits five candidate asymptotic models and stores (1) whether each model converged, (2) the predicted y-intercept and asymptote, and (3) model fit metrics (e.g., Sum of Squared Errors). Finally, it computes bias by comparing predicted asymptotes to true daily and seasonal occupancy, and predicted y-intercepts to true instantaneous occupancy. Outputs are written to "Full_Results_Summary[density].csv". Again, for ease of use, we have provided one of those files as well. The final script, "binomialRegression.R", synthesizes results across all simulated densities and evaluates when asymptotic regression outperforms traditional site occupancy models (SOMs). This script requires the "Full_Results_Summary[density].csv" files generated by asymptoticModeling.R for each density level (0.05, 0.1, and 0.2). It first combines these outputs, reshapes the data, and isolates results from traditional SOMs and asymptotic regression. For each simulation–protocol combination, the script computes a binary response variable indicating whether asymptotic regression produced a less biased daily occupancy estimate than the SOM. A binomial mixed-effects model is then fit using glmer(), with simulation included as a random effect and survey design parameters (density, radius, interval length, number of surveys, and survey duration) treated as categorical fixed effects. The resulting model quantifies how survey design and population density influence the likelihood that asymptotic regression yields improved estimates relative to traditional occupancy models.