DOI: 10.5281/zenodo.16049071
title: Data and code for: Pacific Northwest birds have shifted their abundances upslope in response to 30 years of warming temperatures

description: ##  Data and code for: "Pacific Northwest birds have shifted their abundances upslope in response to 30 years of warming temperatures"Benjamin G. Freeman [1\*] , Harold N. Eyster [2] , Julian M. Heavyside [3] , Daniel A. Yip [4] , MonicaMather [5] & Louise Waterhouse [6]

1. School of Biological Sciences, Georgia Institute of Technology, Atlanta, GA, USA2. The Nature Conservancy in Colorado, Boulder, CO, USA; and Gund Institute for Environment,University of Vermont, Burlington, VT, USA3. Department of Zoology, University of British Columbia, Vancouver, BC, Canada4. Canadian Wildlife Service, Environment and Climate Change Canada, Delta, BC, Canada.5. British Columbia Ministry of Water, Lands and Resource Stewardship, Nanaimo BC, Canada6. British Columbia Ministry of Forests, Coast Area Research, Nanaimo, BC, Canada\*Corresponding author: bfreeman47@gatech.edu

 

### Repository informationThis repository accompanies the paper "Pacific Northwest birds have shifted their abundances upslope in response to 30 years of warming temperatures" under review at *Ecology* (Freeman et al., 2025). It provides data and code for reproducing statistical analyses and visualizations.

### License and citation informationThis content is licensed under a [CC0](https://creativecommons.org/share-your-work/public-domain/cc0). If you use the code or data provided here, please cite our work.

### Article abstract [insert final copy-edited abstract]

### Repository contents- ``src``: R and stan code, including data preprocessing, data formatting, model fitting, and figure generation.     - ``data_formatting.R``: R code to take in cleaned data (``dat/clean/BC_pointcount_data.csv`` and ``dat/clean/pointdata.csv``) and format it for model fitting. This code exports an Rdata file with these formatted data ``dat/fmt/allspecies_sparse.Rdata``).    - ``model_run.R``: R code to run the Bayesian models and test diagnostics. It takes in the formatted data (``dat/fmt/allspecies_sparse.Rdata``) and fits a model for each species using the stan model defined by ``src/binmix_elevation_1sp_ragged.stan``.     - ``binmix_elevation_1sp_ragged.stan``: a stan model to build Bayesian single-species abundance models with HOF-encoded elevation-response curves.     - ``post_process_eachsp.R``: R code to take in the model objects for each species and output the statistics and figures shown in the paper. - ``dat``: contains data    - ``dat/raw``: subfolder containing raw data.        - `data90s.csv`: raw historical data, containing the following columns:              - ``STUDY_AREA``: not informative; all values are "SC".             - `STAND`: stand ID.             - ``STAND_TYPE``: stand type. Uncertain what these abbreviations mean, but 'OG' likely means old growth coastal western hemlock forest, 'MH' likely means old growth mountain hemlock forest, and 'MG' likely means a mixture of old growth mountain and western hemlock forest.             - ``DATE``: date in YYMMDD format.              - `WEATHER`: weather observations.             - ``OBSERVER``: observer initials.             - ``COMMENTS``: additional comments. NA= not applicable.              - ``STATION``: point count ID number. This number is unique to the particular point count location.              - ``TIME``: time of day in HMM. All times AM.               - `SPECIES`: species, reported using four-letter alpha codes. These codes are for the historical taxonomy (i.e., 'WIWR' for Winter Wren instead of the 'PAWR' for the since-split Pacific Wren).               - `DIST_1`, `DIST_2`,`DIST_3`: distance in meters between the bird and the center of the point count during the the first, second, and third 4-minute subcounts, respectively.               - `BEHAV_1`, `BEHAV_2`, `BEHAV_3`: behavior observed during the first, second, and third 4-minute subcounts, respectively. For behavior definitions, see below.            - `YEAR`, `MONTH`, `DAY`: year, month, and day in YY, M, D format.          - ``JMH_data_for_analysis.csv``: raw modern point count data collected by JMH. Each row is an observation of a single individual. Includes the following columns:               - `date`: date in M/D/YY format.                 - `location`: the park or watershed where the point count was located. See below for details.                 - `weather`: weather observations.                - `observer`: initials of the observer.                 - `point`: point count ID.                - `time`: time in HH:MM format. All times AM.                 - `species`: Four-letter alpha codes indicating the species observed.                 - `distance`: distance between the species and the center of the point count location in meters.                 - `behavior`: behavior observed. See below for details.                 - `count_period`: the 2-minute sub-subcount period (either 1, 2, 3, 4, 5, or 6). Subcount 1 is the four-minute period including sub-subcount 1 and 2, subcount 2 is the four-minute period including sub-subcount 3 and 4, and subcount 3 is the four-minute period including sub-subcunt 5 and 6.                 - `notes`: miscellaneous notes.         - ``BGF_data_for_analysis.csv``: raw modern point count data collected by BGF. Each row is an observation of a single species during a single 2-minute observation period. Includes the following columns:             - ``year``, ``month``, ``day``, ``time``: when the data was collected, in yyyy m hmm or yyyy m h:mm formats. All times are AM.             - `observer`: initials of the observer.             - `weather`: weather observations.            - `location`: the park or watershed where the point count was located. See below for details.             - `point`: point count ID.            - `time`: time in H:MM format. All times AM.             - `count_period`: the 2-minute sub-subcount period (either 1, 2, 3, 4, 5, or 6). Subcount 1 is the four-minute period including sub-subcount 1 and 2, subcount 2 is the four-minute period including sub-subcount 3 and 4, and subcount 3 is the four-minute period including sub-subcunt 5 and 6.             - `species`: Four-letter alpha codes indicating the species observed.             - `distance`: distance between the species and the center of the point count location in meters.             - `behavior`: behavior observed. See below for details.             - `number`: number of individuals observed.            - `notes`: miscellaneous notes.         - ``pointdata_2023_w_elevs.csv``: raw data recorded in 2023 on the point count locations. Includes the following columns:             - ``access``: same as in ``dat/clean/pointdata.csv``            - ``location``: same as in ``dat/clean/pointdata.csv``            - `years_surveyed`: same as in ``dat/clean/pointdata.csv``            - `point`: same as in ``dat/clean/pointdata.csv``            - `lat``: the latitude measured with a GPS in situ.             - `long`: the longitude measured with a gps in situ.             - ``mapped_elevation_2023``: the elevation (in meters) measured with a gps in situ.             - `dem_elevation`: the elevation (in meters) from a digital elevation model.             - `notes`: additionial information.     - ``dat/clean``: cleaned data, hand-filtered from the datasets in ``raw``.        - ``BC_pointcount_data.csv``: cleaned tabular data on each visit to each point count. This dataframe has the following columns:             - ``point_countID``: the ID number unique to each point count location            - ``year``, ``month``, ``day``, ``time``: when the data was collected, in yyyy m hmm or yyyy m h:mm formats. All times are AM.             - ``observer``: the initials of the observer.             - ``weather``: weather observations about cloud cover, wind, and precipitation. "O.C" stands for "overcast."             - ``subcount``: an indicator variable identifying the four-minute subcount (1, 2, or 3). Each 12-minute point count was divided into 3, 4-minute subcounts.            - ``species``: the species observed, indicated using the four-digit alpha banding code.            - ``distance``: the distance in meters of the bird from the center of the point count.             - ``behavior``: behavioral observations. Categories differed slightly between historical and modern counts.  "C" = call; "S" = singing (or a noise with a terrirotiral purpose); "D" = down: for birds flying under the canopy in a plot; "T" = other forms of territorial behavior, or indications of breeding status, i.e., feeding young, aggressivve defense, carrying nesting material; "N" = nest; "R" = visual observation, bird resting; "M"=move: for birds flying over the plot and thus not directly associated with it. "F"= flyover.             - ``first_two_min``: number of individuals identified during the first two minutes of the four-minute subcount. Only recorded during modern time_period.             - ``second_two_min``: number of individuals identified during the second two minutes of the four-minute subcount. Only recorded during modern time_period.            - ``time_period``: whether the observation occured during the original surveying ('historic') or the modern replication ('modern').         - ``pointdata.csv``: cleaned tabular data on each point count. Includes the following columns:             - `` access``: The type of entity that controls access to the point count location, either a 'park' or a 'watershed'.             - ``location``: the name of the watershed or park  containing the point count location. One of: "capilano", "coquitlam", "seymour", "cypress", "cheakamus", "garibaldi", or "tetrahedron."            - ``years_surveyed``: whether the point was surveyed just during first time period ('old'), just the modern replication ('new') or during both ('both').             - ``point``: the point count ID number.            - ``lat``: the latitude of the point count location, in EPSG:3857. Not always given for points not relocated in the modern replication.            - ``long``: the longitude of the point count location, in EPSG:3857. Not always given for points not relocated in the modern replication.            - ``elevation``: the elevation of the point count location in meters. Not always given for points not relocated in the modern replication.            - ``notes``: miscellaneous notes.     - ``dat/fmt``: data formatted for modeling using the ``data_formatting.R`` script.         - ``allspecies_sparse.Rdata``: data formatted for modeling. Includes the following variables:             - int<lower=0> `R`;       // Number of sites            - int<lower=0> `Jmax`;    // max number of temporal replicates            - int<lower=0> `J1` [R];       // Number of temporal replicates for each site in year 1            -  int<lower=0> `J2` [R];       // Number of temporal replicates for each site in year 2            -  int<lower=0> `y1`[R, Jmax]; // Historical counts            -   int<lower=0> `y2`[R, Jmax]; // Modern counts            -  int<lower=0> `K`;       // Upper bound of population size            -  real `elevation_std`[R];          // standardized elevation of each point count (not in meters)            - S;// number of species- ``out``: contains analysis output files, including model objects `.csv` tables with elevational data for each species.    - ``modeled_change_in_range_and_abundance.csv``: a table with the median abundance and 89% credible intervals of each species at each elevation (in meters) during the historical and modern survey periods.     - ``optimum_elevations.csv``: a table with the optimum elevations (medians and 89% credible intervals, in meters) for each species during each time period (year 1 = historical sampling period, year 2 = modern sampling period).     - ``range_changes_table.csv``: a table with the lower and upper range limits for each species during historical and modern sampling periods. Also incldues the counts of the number of meters of elevatonal stability, contraction, expansion, and increasing and decreasing abundnce for each species between the historical and modern time periods.