License: CC BY-NC-ND 4.0 (https://creativecommons.org/licenses/by-nc-nd/4.0/)
R Package versions: registered in file renv.lock
Computational demands:
Estimated total run time: 50 h
locally on laptop without parallelization;
can be significantly enhanced by running predictor scripts in parallel or enable multiple cores to approx. 6 h
Manual to the folder:Folder_metadata.xlsx
has a list of A) scripts, input and output files, figure locations, run times, etc. and B) Files and their sources
How to use this folder:
install renv and here packages if not already installed
open the Git.Rproj in RStudio or VScode and set here::here() as working directory to the root folder (“Git”)
use renv::restore() to restore packages & dependencies from the lockfile (this will lead in a huge downloading session of packages)
There are three sections in this project: The first part (A) produces the predictors and data needed for modelling. It starts by grabbing data from the database, cleaning it, filtering it, ad then producing the predictors. The second part (B) uses the predictors to train a randomForest model and evaluate it using xAI (explainable AI), interaction effects and variable importance. In the last part (C), the model predictions are checked against the latest replication of the empirical data.
Additionally, the project contains several sensitivity analyses and robustness checks, which are not part of the main analysis but were used to aid interpretation of the results and determine patterns of stochasticity in the data.
Script nomenclature:
Each R script is labelled by part (A,B,C) and script sequence (1-14).
The 00_Configuration.R script is needed for almost all other scripts. It ensures that packages are installed and has file paths and global variables and lookup tables needed for many steps.
Get data from MOBI database for first two replications (Cz, Ny, Jp, Eu)
Remove cells and species that were not sampled twice; filter species based on expert knowledge and introduced status
Prepare predictors for H1 and H2, use datasetID as H3 to determine effect of atlas in the ‘full model’ H1: Body mass, Habitat_5, Threatened_01, Generalism_01, Phylodistinct, Migration_123, Global range size H2: Fractal dimension, Lacunarity, Spatial autocorrelation, circularity, AOO, minimum distance to the border from the centroid H3: datasetID
Calculate responses:
Jaccard_dissimilarity,
log Ratio AOO,
log Ratio AOO per year
Make simulations of Jaccard_dissimilarity based on different combinations of parameters and evaluate the effect of these on the Jaccard values. Certain combinations of parameters restrict Jaccard_dissimilarity to a range of values. This can be used to determine the effect of mathematical constraints on the Jaccard_dissimilarity values. Parameters:
initially occupied cells,
total number of cells possible,
number of changes
Train model with
‘all data’ and
subsets for each datasetID (‘split data’) using random forest
Extract for all three responses:
rsq, rmse,
hyper-parameters,
predictions,
variable importance,
interactions
partial dependence plots
Test for phylogenetic autocorrelation for each datasetID in the model residuals (and the raw data)
Calculate responses from third atlas replication (Cz, Jp), use predictors calculated from second period to predict responses for the third period and get residuals
Modeling settings:
80/20 split (80 training, 20 testing)
3x repeated 10-fold cross validation
permutation importance (not impurity)
always split variables : datasetID
respect unordered factors = T
Bayesian hyperparameter tuning:
mtry = 2-10
min_n = 5-15
trees = 1000-5000
initial values = 5
iterations = 50
no improve = 10
set a seed.
C) Data profiling
Responses:
Jaccard_dissimilarity
log_R2_1 (log ratio between sampling period 2 and 1)
log_R2_1_per_year (log ratio between sampling period 2 and 1 divided by the number of years between sampling)
Notes:
The higher J_dissim, the more variable log_R2_1 and log_R2_1_per_year
The smaller AOO, the more variable log_R2_1 and log_R2_1_per_year
The lower D, the more variable (and more positive?) log_R2_1
The higher mean_lnLac, the more variable (and more positive?) log_R2_1
The higher mean_lnLac, the lower Jaccard_dissim
Species in New York and Japan are more dissimilar than species in Czechia and Europe
Table of Variables
Va riable
Type
Hy po th es is
E x planation
Ref erence
Jac card_d issimi larity
resp onse
-
P roportion of sites that have changed status in occupancy between sampling period. S y m metrical, hence does not indicate d irection. Magnitude depends on the smallest number of sites occupied across sampling periods and the total number of sites possible to occupy. Few occupied sites in a large matrix will produce large dis s i milarity.
lo g_R2_1
resp onse
-
(natural) log change in AOO between sampling periods. Magnitude depends on number of sites occupied in period 1 (few sites will produce large log ratios)
log_R 2_1_pe r_year
resp onse
-
(natural) log change in AOO between sampling periods - adjusted for the number of years between the end of period 1 and the end of period 2.
Blowes et al. 2024
Body mass
p redi ctor
1
Bird body mass
Avonet ( Tobias 2021)
Hab itat_5
p redi ctor
1
Preferred bird habitat in 5 c ategories (open, closed, marine, f r eshwater, human modified)
Avonet ( Tobias 2021)
Thre atened
p redi ctor
1
Binary IUCN status ( T h reatened: 0, 1)
IUCN (retr ieved: 25 .March .2025)
Gene ralism
p redi ctor
1
M o d ification of “primary . l ifestyle” column from AVONET where category ’ G e neralist’ got assigned a 1 and all other c ategories got a 0
Avonet ( Tobias 2021)
Phylog enetic dis tincti veness
p redi ctor
1
How isolated the lineage is in the tree. Larger values of pd indicate p h y logenetic isolation and i n dependent e volution. Species with ‘old genes’ like this may be better or worse adapted to changing en v i ronments.
Bi rdTree (Jetz, 2012)
Global range size
p redi ctor
1
Total occupied area c alculated from the native breeding and resident ranges for extant species / l ocations.
log ’ G a ppieness’ of the species di s t ribution, averaged over 6 windows with i ncreasing size. L acunarity estimates include creating a moving window across the species d i s tribution for windows of different sizes. L acunarity is then the sum of all occupied patches within this window. It is averaged across all movement instances and then across window sizes to get a ‘scale i nvariant’ version of l acunarity across different window sizes.
f ractal dim ension
2
Computed using the area of each cell (as opposed to cell side length) using the formula:
D = -2 * slope from OAR + 2.
OAR is the r egression between AOO and scale.
Wilson 2004,
Kunin 1998
AOO
2
Sum of areas of all occupied cells
IUCN rec ommend ations
s patial aut ocorre lation
2
Joincount s tatistics literally counts the average number of joins for each cell and compares this number to an expected value based on occupied number of sites. We use the d ifference between the expected and modelled value for JC ( h ereafter: joincount delta)
Joi ncount for binary data (0,1)
norm alized circu larity
2
aka ’ c o mpactness ratio’. Dim e n sionless.
Formula: (pe r i meter^2) / (4 * pi * area).
A perfect circle = 1. Values > 1 indicate deviation from the circle (as d eviations increase the perimeter in ratio to the area, thus i ncreasing the values of circNorm.
G abriel
m inimum di stance to the border from range ce ntroid
2
Measured the smallest distance from the centroid of the species d i s tribution to the border of the atlas region. Ranges that have a centroid in the middle of the atlas region have a higher s tochastic potential to fill the whole plane, while those situated closer to the borders are (a r t ifically) limited by these borders within the analysis. This could be a useful predictor for the magnitude of change that may happen, as ranges close to the border may be ‘cut out’ of the study area and thus show smaller change (e.g., because the change is happening in the periphery of the range which may be outside of the study area)
-
dat asetID
3
Indicator which dataset (Czechia, Japan, New York, Europe)