DOI: 10.5061/dryad.dbrv15f83
title: Data from: Trophic reorganization of animal communities under climate change

description: Aim This study uses a novel modeling approach to understand global trophic
 structure transformations under 21st-century climate changes. The goal is
 to project and understand the impacts of climate change on trophic
 dynamics, guiding future research and conservation efforts. Location
 14,520 terrestrial grid cells of 1° x 1° globally. Taxon Trophic
 structures were assessed for 15,265 species, including 9,993 non-marine
 birds and 5,272 terrestrial mammals, across 9 predefined trophic guilds.
 Methods A spatially explicit community trophic structure model, based on
 an extreme gradient boosting algorithm (Xgboost), was used. The model was
 trained with 1961-1990 climatic data and projected changes according to
 three Shared Socioeconomic Pathways: SSP2-45, SSP3-70, and SSP5-85.
 Results The Xgboost model showed high predictive accuracy (86%,
 kappa=0.91). Projections indicated many global regions are transitioning
 in their trophic structures due to climate changes from 1990 to 2018, with
 decreases in species carrying capacity in 5.5% of cells and increases in
 9.8%. Predictions for mid- and late-21st century under climate scenarios
 suggest significant reorganization, with notable impacts in regions such
 as the Amazon Basin, Central Africa, and Southeast Asia. Under SSP5-85,
 17.1% of cells may face reductions in carrying capacity, while 41.1% could
 see increases, affecting thousands of species. Main conclusions Climate
 change is profoundly reorganizing global trophic communities, with
 significant shifts in species carrying capacity across different
 guilds.  Tropical regions and high northern latitudes are most
 affected, with some species facing collapses and others finding new
 opportunities. These changes highlight the need to integrate community
 trophic structure models into biodiversity conservation strategies,
 offering a comprehensive view of climate change impacts on trophic
 networks.
description: <strong>Data Collection</strong>
 <em>Species Distribution Data</em>
 Geographical data were garnered from two primary sources and
 subsequently plotted on a global terrestrial grid, with each cell
 measuring 1 × 1°. These sources included the global distribution ranges of
 terrestrial mammals and non-marine birds. The distributions of species,
 specifically 9,993 non-marine birds and 5,272 terrestrial mammals,
 totaling 15,265 species, were informed by the IUCN Global
 Assessment's data on native ranges (IUCN, 2014). To enable analysis,
 a presence/absence matrix was created. In this matrix, the species were
 aligned as columns, each named, against 14,498 terrestrial grid cells,
 each cell measuring 1 × 1°, as rows. These include all the non-coastal
 cells of the world, excluding Antarctica and some northern regions, such
 as most of Greenland, for which some data are lacking. This approach
 provided a clear, granular view of species distribution across the
 globe. <em>Bioclimatic
 Variables</em> The bioclimatic variables were
 divided into two datasets: historical (1961-2018) and future (2021-2100).
 Historical bioclimatic variables were not obtained directly but derived
 from three monthly meteorological variables: mean minimum temperature
 (°C), mean maximum temperature (°C), and total precipitation (mm). These
 variables were downscaled from CRU-TS-4.03 (Harris et al., 2014) with
 WorldClim 2.1 (Fick & Hijmans, 2017) for bias correction. The
 nineteen WorldClim variables were calculated from these three monthly
 meteorological variables using the "biovars" function of the R
 dismo package (Hijmans et al., 2011). Unlike the
 historical data, pre-processed bioclimatic variables for the future could
 be accessed directly. We used a multimodel ensemble approach, which tends
 to perform better than any individual model (Pierce et al., 2009; Araújo
 & New, 2007). The ensemble integrates mean outputs from 25 global
 climate models (GCMs) corresponding to an array of twelve different future
 climate change scenarios (Harris et al., 2014; Fick & Hijmans,
 2017). These scenarios emerge from the interplay of four specific
 timeframes (2021-2040, 2041-2060, 2061-2080, and 2081-2100) and three
 Shared Socio-economic Pathways (ssp2-45, ssp3-70, and ssp5-85) (Gidden et
 al., 2019). <em>Feeding Habits
 Data</em> The feeding habits of bird and mammal
 species were obtained from the global species-level compilation of key
 trophic attributes, known as Elton traits 1.0 (Wilman et al., 2014). This
 dataset provided essential information on the trophic roles of species,
 which is crucial for understanding their ecological interactions and
 energy flow within ecosystems. <strong>Trophic
 profile of the cells and structure identification</strong>
 <em>Trophic profile of the cells</em>
 We assigned each of the 15,265 terrestrial mammal and non-marine
 bird species to one of 9 trophic guilds and then counted the number of
 species in each guild within each cell, following a previous analysis
 (Mendoza & Araújo, 2022). The result is a matrix with the 9
 trophic guilds as columns, 14,498 cells as rows, and values representing
 numbers of species. The trophic profile of every community is thus a point
 in a 9-dimensional ‘trophic space' defined by the number of species
 from each trophic guild (a vector of dimension 9).
 <em>Selection of training samples</em>
 From the initial set of 14,498 terrestrial grid cells, each
 measuring 1°×1°, a specific subset of 6,610 continental cells was
 selected. This subset was defined by their overlap, either partial or
 complete, with designated protected areas. This subset was crucial for two
 analytical steps: first, to decipher the community trophic structures; and
 second, to model the interaction between the prevailing climate and the
 trophic structure. Given the nature of these cells — designated as
 "continental protected area cells" — we assume they experience
 reduced human activity compared to the surrounding matrix; an assumption
 that may not align with reality globally, considering evidence of reduced
 effectiveness of protected areas in ensuring tangible protection in
 various parts of the tropics (Geldmann et al., 2019).  Nevertheless, a
 working assumption is made that the trophic structures displayed within
 these areas likely present a closer reflection of what might be expected
 from an undisturbed, stable energy network (Mendoza & Araújo,
 2022). <em>Identification of the six basic
 trophic structures through AMD analysis</em> We
 utilized AMD analysis to explore the previously described 9-dimensional
 'community trophic space', defined by the number of species
 within each trophic guild. This analysis is rooted in computing the
 Average Membership Degree (AMD) of cluster elements based on their
 Euclidean distance to the geometric center. The primary aim of AMD
 analysis is to discern the presence of distinct groups within
 multidimensional spaces, while concurrently assessing their degree of
 definition and compactness. The emergence of well-defined community groups
 within this trophic space allows for the consideration of the identified
 basic trophic structures as qualitatively distinct entities (Mendoza
 & Araújo, 2022). We applied AMD analysis to the 6,610 continental
 protected area cells to confirm that the same six basic trophic structures
 (TS1 to TS6) identified by Mendoza & Araújo (2022) are present
 within this curated subset. For a more comprehensive understanding of the
 AMD method and its application to our dataset, readers are directed to the
 supplementary information of Mendoza & Araújo (2022), accessible
 via the following link:
 https://nsojournals.onlinelibrary.wiley.com/action/downloadSupplement?doi=10.1111%2Fecog.06289&file=ecog12872-sup-0001-AppendixS1.pdf <strong>Climate modelling of community trophic structures</strong> <em>Data preparation</em> We modelled the relationship between climate and trophic structures, utilizing 19 predictors derived from historical bioclimatic data encompassing the years 1961-1990. Denoted as pre-1990 period, this phase marks a time before the significant uptick in temperatures attributable to human-induced greenhouse gas emissions. The trophic profile data, systematically assembled from faunal lists gathered over numerous decades, also hail from an era prior to this pronounced temperature increase. Therefore, these records present a fitting basis for examining the interplay between the trophic structure and the climatic conditions prevalent during the pre-1990 period. The bioclimatic variables represent conditions over specific time periods, and the corresponding trophic structure type (TS1 to TS6) is inferred as the one expected at the end of these periods. <em>Model Implementation Using Xgboost</em> We employed the Extreme Gradient Boosting algorithm (Xgboost) (Chen & Guestrin, 2016), using the xgboost package (Chen et al., 2023), a state-of-the-art machine learning technique known for its superior performance over traditional models such as random forests (e.g., Shao et al., 2024). The target variable in our analysis was the basic type of trophic structure (TS1 to TS6), identified in the previous step (with the AMD analysis) in the 6,610 continental protected area cells. <em>Hyperparameter optimization</em> Before training the model, we optimized the hyperparameters of the Xgboost algorithm to enhance its performance. Specifically, we focused on six parameters: learning rate, maximum tree depth, gamma, lambda, alpha, and the number of trees. Due to the enormous number of possible parameter combinations, we employed a Bayesian optimization approach, which provided a more efficient search over the hyperparameter space compared to traditional grid search. As an optimization criterion, we used the xgb.cv cross-validation function within the Xgboost package, based on k-fold cross-validation. <em>Spatial cross-validation by blocks</em> In order to thoroughly assess the predictive accuracy of our model and address the spatial autocorrelation inherent in ecological data, we employed a rigorous Spatial Cross-Validation by Blocks method. This approach entailed partitioning the 6,610 continental protected area cells into 3,848 validation blocks, each corresponding to one of the 3,848 globally identified protected areas. Subsequently, the model was trained on the remaining data, excluding the grid cells corresponding to the currently isolated protected area. Predictions were specifically generated for the grid cells encompassing each isolated protected area. This enabled us to effectively evaluate the model’s ability to generalize across diverse geographic regions. By implementing this strategy, we aimed to mitigate the risk of overestimating model performance due to the expected spatial structure in the data, thereby ensuring the independence of our validation process. While an optimal approach would have involved employing Spatial Cross-Validation by Blocks not only for testing the model but also for hyperparameter optimization, computational constraints rendered this unfeasible (as this would have required 3,848 analyses for each of the thousands of combinations tested). Nonetheless, the robustness of the final model was ensured through rigorous testing with Spatial Cross-Validation by Blocks, allowing for reliable projections of trophic structures under various climatic scenarios. <em>Performance Evaluation Metrics</em> To evaluate the model's performance, we used overall accuracy and accuracy for each type of trophic structure, as well as Cohen's kappa statistic, which quantifies the agreement between predicted and observed trophic structures, correcting for chance agreement. <strong>Inference and analysis of trophic reorganization</strong> <em>Inference of Expected Trophic Structures at a Global Level</em> By projecting the results of the Xgboost algorithm onto the 14,503 1°×1° terrestrial grid cells studied, we inferred the expected trophic structure based on their current climatic conditions. Our model's projections are expected to be unaffected by recent climatic changes, as its training was based on pre-1990 data. Similarly, it is expected to remain unaffected by the severe impacts of human activity due to the exclusive use of protected area cells, nor by the existence of significant biogeographical barriers, as continental cells were used. Therefore, the projections reflect the expected natural baseline, providing insights against which to measure climate change impacts. <em>Implications of Trophic Structure Transitions</em> When the climatic conditions of communities reach certain tipping points, the stable configuration of the energy network, from which their trophic structure emerges, abruptly shifts to a new configuration (Solé et al., 2002; Mendoza, Goodwin, and Criado, 2004; Mendoza & Araújo, 2022). Our Xgboost algorithm aims to capture the complex pattern linking these tipping points in the 19-dimensional space defined by the WorldClim variables (parameter space) with the 9-dimensional 'community trophic space' defined by the number of species in each trophic guild (state space). However, the trophic structure actually found in a community does not always match the one corresponding to its climate, as other factors such as human impacts or insularity also affect the number of species in each trophic guild present in a location (Mendoza & Araújo, 2019). Therefore, our algorithm's projections do not aim to predict the actual existing trophic structure but rather what would be expected in the absence of these other factors. As long as our model demonstrates true predictive capacity for continental protected area cells, which are less exposed to those other factors that deviate the trophic structure from the expected, it is anticipated that a trophic reorganization will occur as predicted when the model forecasts the transition from one type of trophic structure to another. Every trophic reorganization involves the disappearance of species in trophic guilds whose carrying capacity decreases, if they previously exceeded this capacity, and the colonization of species in guilds whose carrying capacity increases, if it was previously lower. While the disappearance of the former can be relatively rapid, the establishment of new species requires the absence of biogeographical barriers that impede their arrival and the necessary time to establish a population. <em>Estimation of Species Carrying Capacity</em> The species carrying capacity of each trophic guild in a cell was estimated based on the average number of species found in the type of trophic structure predicted for that cell according to its climatic conditions. Increases and decreases in the species carrying capacity, resulting from changes in the trophic structure caused by climate change, were obtained by calculating the difference between the average number of species in the final trophic structure and the original one. <em>Analysis of Trophic Reorganization</em> To comprehensively analyze the changes associated with trophic reorganizations, we considered two main axes of aggregation: spatial and trophic (Box 1). Increases and decreases in species carrying capacity were quantified both at the cell level and globally, first for all guilds combined and later for each trophic guild individually. Aggregating all guilds provides a measure of the overall impact of various climate change scenarios on trophic organization. By analyzing changes in individual guilds, we gain insights into how specific functional groups are impacted by climate change. <strong>BOX 1. </strong> <strong>Categories of trophic reorganization analysis</strong> <em>Spatial Scale</em> <strong>Cell level changes:</strong> This includes the analysis of changes in species-carrying capacity within individual grid cells. These changes are measured as increases or decreases in the number of species (expected in the absence of significant human impact and major biogeographical barriers). <strong>Global level changes:</strong> This involves summing the changes across all grid cells to obtain a global measure of impact. This metric, termed "aggregated species-cells" results from summing the total number of species affected by trophic reorganization across all cells, regardless of whether the same species is affected in different cells. This provides a measure of the overall impact of climate change on a global scale. <em>Trophic scale</em> <strong>Individual Guilds: </strong>This involves examining changes within each trophic guild separately. By disaggregating the data in this way, we can identify which specific guilds are most affected by climate change in each region and how their species-carrying capacities are altered, whether increasing or decreasing. <strong>Aggregated Guilds: </strong>This involves aggregating changes across all trophic guilds to understand the overall impact on the community's trophic organization. <strong>Ongoing Trophic Reorganization</strong> By contrasting the trophic structures (TS1 to TS6) projected for the most recent available decade (2009-2018) with those projected for the reference period (1961-1990), we can derive the expected increases and decreases in the species carrying capacity of each guild between 1990 and 2018. Given the expected lag between climate change and the community's trophic reorganization, these variations indicate potential processes of local extinction and colonization that may already be occurring or be imminent. By aggregating all guilds (see Box 1), we obtain an estimate of the severity of this trophic reorganization. Its geographic representation allows us to see which regions around the globe are being most affected. <strong>Predicting Future Local Extinctions and Colonizations</strong> The Xgboost algorithm was further applied to various climate change predictions spanning the 21st century (specifically, 2021-2040, 2041-2060, 2061-2080, and 2081-2100). The resulting projection was intended to discern potential shifts in community trophic structures, contingent on the Shared Socioeconomic Pathway (SSP) the global community adopts (Gidden et al., 2019). Initially, three emission scenarios were considered: SSP2-45, SSP3-70, and SSP5-85 (Waliser et al., 2020). The SSP2-45 scenario aligns closely with the objectives of the Paris Agreement, seeking to restrain global temperature rise to beneath 2°C, while simultaneously making efforts to cap the increase at 1.5°C. However, the growing consensus among scientists (Schwalm et al., 2020), deems the realization of this target under current policy trajectories as increasingly unlikely. Thus, our analysis used the more moderate SSP3-70 scenario and the more extreme SSP5-85 scenario, so to span a wide range of uncertainties. Details on the SSP2-45 scenario findings are provided in the Supplementary Material (Figures 2, 3, 4). By assessing deviations in the trophic structure relative to pre-1990 data, we were able to approximate changes in species-carrying capacity—both in terms of decline and growth—for individual trophic guilds, as well as cumulatively. The collective projected decrease in species-carrying capacity of guilds across all grid cells allowed us to estimate the anticipated number of species-cell units impacted since 1990, after each time window. This was evaluated both at the level of individual trophic guilds and in a comprehensive manner, encompassing all guilds.
description: # Data from: Trophic reorganization of animal communities under climate
 change This dataset includes 13 databases and 2 scripts, providing
 predictions of species-carrying capacities across 9 trophic guilds under
 three climate change scenarios (SSP2-45, SSP3-70, SSP5-85) at four future
 time points (2040, 2060, 2080, 2100). The data covers 14,498 rows of 1°×1°
 terrestrial grid cells, detailing latitude, longitude, and projected
 changes in species numbers. *Description of Data and File Structure* The
 dataset comprises 12 databases, each representing specific climate
 scenarios and time points, including 11 variables: latitude, longitude,
 and projected species numbers in trophic guilds. The files are in CSV
 format, structured for analysis and visualization. The 13th database
 contains the 6,620 grid cells that overlap with protected areas, which
 were used to train the climate model. This script includes the
 optimization of the algorithm and the resulting model. *Code/Software* 1\.
 MapsTG_changes: An R script for processing and visualizing data. It uses
 packages like ggplot2, earth, maps, and RColorBrewer to log-transform and
 map changes in species-carrying capacities. 2\.
 XGBoost_TrophicModel_Optimization_BCV.R: This R script optimizes the
 XGBoost algorithm for modeling trophic structures using a block
 cross-validation (BCV) method. It focuses on the 6,620 terrestrial grid
 cells overlapping protected areas. Both scripts should be run sequentially
 from data loading to transformation and visualization to explore the
 impacts of climate change on trophic guilds globally.