Data and code from: Phase-dependent asymmetry in urban avian choruses driven by sensory pollution and environmental context
Data files
Nov 06, 2026 version files 147.98 KB
-
ALLRcode_chorus.zip
123.72 KB
-
README.md
24.26 KB
Abstract
This dataset contains bird dawn and dusk chorus timing records and associated environmental predictors used to analyse the effects of artificial light at night, anthropogenic noise, meteorological conditions, local microclimate, landscape structure, and habitat type on avian vocal phenology. The repository includes two input CSV files and an three R scripts for fitting linear mixed-effects models, conducting model diagnostics, generating predictor correlation matrices, checking collinearity, and producing the manuscript figures.
1. Purpose and scope
This repository contains the processed analysis tables and R code used for the revised manuscript on environmental correlates of urban bird-chorus timing in Nanjing, China. The current analysis contains two integrated mixed-effects model workflows:
- dawn chorus onset relative to local sunrise; and
- dusk chorus cessation relative to local sunset.
The earlier version of the code contained separate light, landscape, habitat, and noise–microclimate models. Those domain-specific analyses are not part of the current manuscript workflow and are not run by the submission code. The current entry point runs only the two integrated models described above.
The archive contains processed analysis tables, not the original acoustic recordings. Acoustic detection, chorus-event construction, environmental-data matching, and site selection were completed before the CSV files in this archive were produced. The manuscript describes the broader monitoring design and processing decisions; this README documents the files and the analyses that can be run from this archive.
Code DOI listed in the manuscript: https://doi.org/10.5061/dryad.h9w0vt4zx
2. Files in this the ALLRcode_chorus.zip archive
| File | Type | Contents and use |
|---|---|---|
ALLRcode_chorus.R |
R script | Single entry point. Sources the dawn and dusk integrated workflows in sequence. Run from the repository root. |
dawn_integrated_model_clean_workflow.R |
R script | Reads finally_all_dawnfirstchorus6.csv, prepares the dawn data, fits the revised integrated model, performs staged ML/AIC selection, refits the selected structure using REML, and writes tables and diagnostics to outputs/dawn/. |
dusk_integrated_model_clean_workflow.R |
R script | Reads finally_all_lastdusk4.csv, performs the corresponding dusk analysis, and writes tables and diagnostics to outputs/dusk/. |
finally_all_dawnfirstchorus6.csv |
CSV, GB18030 encoded | Processed dawn chorus-onset records. The file contains 1,331 data rows and 19 columns. |
finally_all_lastdusk4.csv |
CSV, GB18030 encoded | Processed dusk chorus-cessation records. The file contains 3,696 data rows and 16 columns. |
The outputs/ directory is created when the scripts run; generated results are not required as input. The repository does not contain a separate data/ directory. Keep the three R scripts and two CSV files together in the same directory when running the entry point.
Each CSV row contains a processed timing observation associated with a date, site code, and species code. The archive does not include event IDs or the detection-to-chorus aggregation history; these rows should not be interpreted as independent survey days or as a full raw detection inventory. Missing numeric values are represented by NA and are read as missing values by readr. Species.Code is the grouping identifier used in the model; names in Species3 are retained as supplied. Some code/name mappings differ between the two tables, including historical or inconsistent labels, so the scripts do not harmonize taxonomy automatically.
3. Running the analysis
Software
The scripts require R and the following packages:
readrdplyrtidyrlubridatelme4lmerTestperformanceDHARMa
The scripts stop with an explicit message if a required package is missing. Install packages in R as needed, for example:
install.packages(c(
"readr", "dplyr", "tidyr", "lubridate", "lme4", "lmerTest",
"performance", "DHARMa"
))
Command-line execution
Open a terminal in the directory containing this README and the CSV/R files, then run:
Rscript ALLRcode_chorus.R
Alternatively, run either workflow separately from the repository root:
Rscript dawn_integrated_model_clean_workflow.R
Rscript dusk_integrated_model_clean_workflow.R
The scripts use paths relative to the current working directory. They do not require the original author's D:/... paths and do not depend on pre-existing objects in the R workspace.
4. Input dataset summaries
4.1 finally_all_dawnfirstchorus6.csv
- Rows: 1,331 data rows plus the header.
- Columns: 19.
- Date field:
Date. - Parsed date range in the archived file: 2025-03-09 to 2026-02-11.
- Sites: 21 distinct site codes in this CSV. The manuscript describes 20 monitoring sites; the code preserves the site codes as deposited and does not silently merge or rename them.
- Species fields:
Species3(name) andSpecies.Code(analysis code). - Response:
relative_to_sunrise_min. - Missingness: the response and the predictor fields required by the integrated workflow have no missing values in this CSV.
temp2has 22 missing values, but it is not used by the integrated model. - Model complete cases: the workflow applies
drop_na()after deriving the model variables and reports the resulting number inoutputs/dawn/dawn_sample_summary.csv.
relative_to_sunrise_min is the chorus-onset time in minutes relative to local sunrise. Negative values indicate onset before sunrise; more negative values indicate an earlier onset. The deposited response range is approximately -123.07 to 31.19 minutes. Values are retained as deposited; the workflow does not truncate them to a recording-window boundary.
4.2 finally_all_lastdusk4.csv
- Rows: 3,696 data rows plus the header.
- Columns: 16.
- Date field:
Date. - Parsed date range in the archived file: 2025-03-08 to 2026-02-10.
- Sites: 21 distinct site codes in this CSV. The manuscript describes 20 monitoring sites; the code preserves the site codes as deposited and does not silently merge or rename them.
- Species fields:
Species3(name) andSpecies.Code(analysis code). - Response:
relative_to_sunset_min. - Missingness: 16 rows have missing
tempand missingrelative_to_sunset_min; the integrated workflow excludes incomplete model rows usingdrop_na(). - Model complete cases: the workflow reports the exact number in
outputs/dusk/dusk_sample_summary.csv.
relative_to_sunset_min is the chorus-cessation time in minutes relative to local sunset. Negative values indicate cessation before sunset; positive values indicate cessation after sunset. The deposited response range is approximately -124.14 to 211.93 minutes. Values are retained as deposited; the workflow does not truncate them to a recording-window boundary.
5. Data dictionary: dawn file
The following fields occur in finally_all_dawnfirstchorus6.csv. A field marked model input is used by the current dawn integrated workflow. Other fields are retained metadata or auxiliary measurements and are not included as fixed effects in the current model.
| Field | Role and interpretation | Current dawn workflow |
|---|---|---|
Date |
Observation date. Parsed to a calendar date and used to create the date random-effect factor and day-of-year terms. | Model input |
Site |
Sampling-site code. | Random intercept |
Species3 |
Bird name/species label associated with the record. | Retained; not a fixed effect |
temp2 |
Additional temperature field present in the archived dawn table. Its distinction from temp is not defined in the manuscript or current workflow. |
Not used; 22 missing values |
tree |
Habitat-category label: semi-natural, Semi-artificial habitat, or artificial habitat. The model uses semi-natural as the reference level. |
Fixed effect |
LAeq |
Equivalent continuous A-weighted sound level / ambient-noise predictor as supplied in the processed table. The manuscript describes monthly site-level noise matching; the table does not include a separate event-level timestamp for this measurement. | Standardized to LAeq_z; fixed effect and candidate interaction |
relative_to_sunrise_min |
Dawn chorus-onset time relative to local sunrise, in minutes. | Response |
wind |
Wind predictor from the processed environmental data. The unit is not stated in the supplied manuscript/table metadata. | Standardized to wind_z; fixed effect in the global model |
humidity |
Relative-humidity predictor. | Standardized to humidity_z; fixed effect |
cloud |
Cloud-cover predictor. | Standardized to cloud_z; fixed effect and candidate interaction |
NTL |
Night-time-light predictor used as the proxy for artificial light at night (ALAN). | Standardized to NTL_z; fixed effect and candidate interaction |
RSEI |
Remote Sensing Ecological Index / landscape-context variable retained in the processed table. | Not used in the current integrated model |
arbor |
Arbor-layer vegetation-cover measure from the habitat survey. | Not used in the current integrated model |
shrub |
Shrub-layer vegetation-cover measure from the habitat survey. | Not used in the current integrated model |
herb |
Herb-layer vegetation-cover measure from the habitat survey. | Not used in the current integrated model |
Species.Code |
Species identifier used for the species random intercept. | Random intercept |
temp |
Air-temperature predictor used by the current workflow. | Standardized to temp_z; candidate fixed effect, removed by the prespecified dawn selection sequence |
long |
Longitude field retained in the dawn table. | Not used in the current integrated model |
lat |
Latitude field retained in the dawn table. It is stored as a text field in the archived CSV. | Not used in the current integrated model |
6. Data dictionary: dusk file
The following fields occur in finally_all_lastdusk4.csv.
| Field | Role and interpretation | Current dusk workflow |
|---|---|---|
Species3 |
Bird name/species label associated with the record. | Retained; not a fixed effect |
Site |
Sampling-site code. | Random intercept |
temp |
Air-temperature predictor. | Standardized to temp_z; fixed effect candidate and retained by the current selection sequence |
Date |
Observation date. Parsed to a calendar date and used to create the date random-effect factor and day-of-year terms. | Model input |
relative_to_sunset_min |
Dusk chorus-cessation time relative to local sunset, in minutes. | Response |
arbor |
Arbor-layer vegetation-cover measure from the habitat survey. | Retained in the CSV; not used in the current integrated model |
shrub |
Shrub-layer vegetation-cover measure from the habitat survey. | Retained in the CSV; not used in the current integrated model |
herb |
Herb-layer vegetation-cover measure from the habitat survey. | Retained in the CSV; not used in the current integrated model |
tree |
Habitat-category label: semi-natural, Semi-artificial habitat, or artificial habitat. The model uses semi-natural as the reference level. |
Candidate fixed effect; removed by the current selection sequence |
LAeq |
Equivalent continuous A-weighted sound level / ambient-noise predictor as supplied in the processed table. | Standardized to LAeq_z; fixed effect candidate and candidate interaction |
wind |
Wind predictor from the processed environmental data. The unit is not stated in the supplied manuscript/table metadata. | Standardized to wind_z; fixed effect and candidate interaction |
humidity |
Relative-humidity predictor. | Standardized to humidity_z; fixed effect |
cloud |
Cloud-cover predictor. | Standardized to cloud_z; fixed effect and candidate interaction |
NTL |
Night-time-light predictor used as the proxy for artificial light at night (ALAN). | Standardized to NTL_z; fixed effect and candidate interaction |
RSEI |
Remote Sensing Ecological Index / landscape-context variable retained in the processed table. | Not used in the current integrated model |
Species.Code |
Species identifier used for the species random intercept. | Random intercept |
The CSV files do not provide a separate units metadata file. The manuscript identifies NTL as a VIIRS night-time-light composite, describes temp and humidity as sensor measurements, and describes cloud and wind as meteorological records, but does not state all numerical units. This README therefore does not invent units that are not documented in the supplied materials.
7. Model preparation and statistical workflow
Both workflows perform the following preparation:
-
Read the corresponding GB18030-encoded CSV.
-
Convert numeric environmental and response fields to numeric values and convert
Site,Species.Code, andtreeto factors. -
Parse
Dateand createDate_factor,DOY,DOY_sin, andDOY_cos, where:DOY_sin = sin(2*pi*DOY/365.25) DOY_cos = cos(2*pi*DOY/365.25) -
Standardize continuous predictors within the corresponding input table using z-scores. The response is not standardized. The standardized variables used by the model are
NTL_z,LAeq_z,temp_z,humidity_z,cloud_z, andwind_z. -
Set
semi-naturalas the reference category fortree. -
Create one complete-case model dataset and use the same observations for all candidate models within that workflow.
The global integrated model has the following fixed-effect candidates:
ALAN (NTL_z) x cloud_z
ALAN (NTL_z) x ambient noise (LAeq_z)
wind_z x ambient noise (LAeq_z)
temp_z
humidity_z
tree
DOY_sin + DOY_cos
The random-effects structure is:
(1 | Site) + (1 | Date_factor) + (1 | Species.Code)
Model selection follows the revised manuscript workflow:
- candidate interactions are screened first;
- subsequent deletions use hierarchical/marginality-aware candidates;
DOY_sin,DOY_cos, and the random-effects structure are retained as controls throughout selection;- fixed-effect structure is compared using maximum likelihood (
REML = FALSE); - the selected structure is refitted using restricted maximum likelihood (
REML = TRUE) for final coefficient estimates and inference; - the joint contribution of the two cyclic DOY terms is assessed separately by comparing models with and without the DOY block.
AIC selection is not an unrestricted automatic stepwise search. The generated AIC sequence records the candidate deletions and decisions at each stage.
8. Generated outputs
Running ALLRcode_chorus.R creates the following directories and files. Existing input CSV files are not overwritten.
outputs/dawn/
dawn_sample_summary.csv: archived rows, complete-case model rows, date levels, site levels, and species-code levels.dawn_standardization_summary.csv: means and standard deviations used to describe the continuous predictors.Table_Sx_dawn_global_model.csv: coefficient table for the global dawn model fitted by ML.Table_Sx_dawn_global_TypeIII.csv: Type III tests for the global dawn model.Table_Sy_dawn_AIC_sequence.csv: staged AIC candidate table and decisions.Table_Main_dawn_final_REML_Coefficients.csv: coefficient table for the selected final dawn model refitted by REML.Dawn_Global_vs_Final_ML_Coefficients.csv: shared-coefficient comparison between the global and selected ML dawn models.Table_Main_dawn_final_REML_TypeIII.csv: Type III tests for the final dawn REML model.Dawn_DOY_Block_AIC_Comparison.csv: ML AIC comparison with and without the cyclic DOY block.Dawn_DOY_Block_LRT.csv: ML likelihood-ratio comparison for the cyclic DOY block.Dawn_Final_REML_R2.csv: marginal and conditional Nakagawa R², when calculable.Dawn_Final_REML_Collinearity.csv:performance::check_collinearity()output, when calculable.Dawn_Global_Diagnostics.csvandDawn_Final_Diagnostics.csv: model singularity, convergence messages, and available diagnostic summaries.Dawn_DHARMa_tests.txtandDawn_DHARMa_status.txt: DHARMa tests and an explicit success/failure status.DHARMa_dawn_final_REML.png: DHARMa residual plot, when available.mod_dawn_final_REML.rds: serialized final dawn REML model, when the local filesystem permits R serialization.dawn_run_log.txt: input path, row counts, formulas, and R session information.
outputs/dusk/
The dusk directory contains the corresponding files with dusk in the name:
dusk_sample_summary.csvdusk_standardization_summary.csvTable_Sx_dusk_global_model.csvTable_Sx_dusk_final_ML_Coefficients.csvDusk_Global_vs_Final_ML_Coefficients.csvTable_Sx_dusk_global_TypeIII.csvTable_Sy_dusk_AIC_sequence.csvTable_Main_dusk_final_REML_Coefficients.csvTable_Main_dusk_final_REML_TypeIII.csvDusk_DOY_Block_AIC_Comparison.csvDusk_DOY_Block_LRT.csvDusk_Final_REML_R2.csvDusk_Final_REML_Collinearity.csvDusk_Global_Diagnostics.csvandDusk_Final_Diagnostics.csv: model singularity, convergence messages, and available diagnostic summaries.Dusk_DHARMa_tests.txtandDusk_DHARMa_status.txt: DHARMa tests and an explicit success/failure status.DHARMa_dusk_final_REML.pngmod_dusk_final_REML.rds(when the local filesystem permits R serialization)dusk_run_log.txt
CSV tables are the primary reproducible outputs. No Excel package is required by the current workflow.
Output-table column conventions
The generated coefficient tables contain Model, Predictor, Estimate, SE, df, t_value, and P_value where the corresponding statistic is available. Predictor uses the model term names (for example, NTL_z:cloud_z is the ALAN-by-cloud interaction). Type III tables contain Predictor and the test statistic columns produced by lmerTest::anova(). AIC tables contain the candidate/stage identifiers, model degrees of freedom (df), AIC, within-stage ΔAIC, and the recorded selection decision. DOY-block tables retain the model names as a Model or Comparison column, followed by the AIC or likelihood-ratio statistics. R² tables contain marginal_R2 and conditional_R2. Collinearity tables contain the columns returned by performance::check_collinearity().
The sample-summary tables report the number of archived rows, complete-case model rows, date levels, site levels, and species-code levels. Standardization summaries report the mean and standard deviation used for each continuous predictor. Diagnostic files report singularity, convergence messages, normality/heteroscedasticity checks, and explicit DHARMa success/failure status. Run logs record the input path, model formulas, row counts, and R session information.
9. Interpretation and data limitations
- The CSVs are processed analysis tables rather than raw recordings. They do not by themselves reproduce acoustic detection or chorus-event construction.
LAeqwas matched as described in the manuscript and should not be interpreted as an event-synchronous noise measurement unless the supporting data documentation establishes that explicitly.- The current archive retains all deposited response values, including values outside ±120 minutes. No unreported truncation or filtering is applied by the scripts.
- The archived CSVs contain 21 distinct site codes because one original monitoring site was destroyed during the study and replaced by a nearby site, while the manuscript reports the original 20-site monitoring design.
RSEI,arbor,shrub,herb,Species3, and the dawn-onlytemp2,long, andlatfields remain in the data tables for context or traceability but are not predictors in the current integrated model.- Coefficients for an interaction are conditional effects: a main-effect coefficient is interpreted at the mean of the other standardized interacting predictor.
10. Citation
Please cite the associated manuscript and the Dryad code/data record when using these materials. The code DOI listed in the manuscript is:
