Comparison of three sources of long-term trends of swallows and martins in the Great Lakes region
收藏资源简介:
Contents in this repository support the paper entitled "Aggregating three sources of long-term roosting and abundance trends of swallows and martins to identify priority conservation areas in the Great Lakes region" Radar Data Preparation - build_eDird_dataset.R: the three files with names following this pattern do the following: 1) Load and process roost data: this script will load and process roost detections from the Great Lakes region. The detections will be processed to obtain count summaries across all elevation sweeps for each detection. These will be further aggregated in tracks (using the maximum), and then into days (summing across tracks). 2) Create a partition of the Great Lakes region: Creates a grid with "squares" that have the same area as the original BBS grid, but are a result of aggregation of the finer resolution grid used in eBird trend analysis. 3) Create the radar sampling dataset: we extracted from UI information about whether a day was sampled by a given station or not (if the day was discarded due to weather or AP, we considered it as not sampled). These data were used to establish sampled regions on each date, and then determine whether each grid cell was sampled or not. If a grid cell was sampled AND had no detections, we consider it a true 0. If a hexagon wasn't sampled, we count it as NA. The final dataset has columns hex_id, date, year, julian_day, sampled, daily_count. Fitting impact trajectories - inter_year_gam_fitting.R: This file loads the data prepared by `build_eBird_dataset.R`, digests it for modeling, and fits the model. We summarize daily data into a seasonal sum per year, per cell_id. Afterwards, we create an effort variable that is the proportion of days that were sampled. Finally, we create proper variable encodings for modelling. We fit a GAM to between seasonal impact and year with iCAR structure. It fits the model in "gam.stan". BBS Model Fitting - bbsbayes.R: this script uses bbsbayes2 to fit models to the BBS data for a given species. It uses a custom grid. Fitting a model to any of the swallow species takes between 5 and 10 hours. The summarized trends and relative abundances are saved as csvs (not used) and the raw chains are saved as RDS objects. We used the aggregated eBird grid within the Great Lakes region. Run from 2000 to 2023. This is the GAMYE model with explicit spatial autocorrelation (iCAR). Directional Disagreement Analyses - eBird data is downloaded and processed using the eBirdst package. - data_loader.R: This script will create objects containing trend summaries and folds for each source. It takes a while to run and creates .Rds files that can be loaded in other scripts when needed. - ebird_vs_bbs_radar.R: runs analysis for aggregated metrics of all swallow species: - BBS: we obtain sums of relatives abundances for all species, and calculate average percent per year change from 2012 to 2022. - eBird: we calculate the relative abundance-weighted average of percent per year change across all species. This approach works well if the relative abundances are relatively stable through time (they can be well-summarized by the mean).



