DOI: 10.6084/m9.figshare.26781022
title: Species-Energy Relationships Across Environmental Gradients: Data and Analysis Code

description: This R Markdown document, titled "Species-Energy Relationships in Environmental Space," provides a comprehensive guide to reproducing the main statistical analyses presented in the manuscript "Consistent environmental energy pathways shape global species diversity". The document includes step-by-step instructions using R, covering data structure exploration, environmental space plotting, and statistical analysis. All processed data used in this analysis is provided in the "Input_Data//" directory.<b>Data Sources:</b>The study examines global data on terrestrial vertebrates in relation to energy-related factors within climate space rather than traditional geographical space. The biological and climatic data are publicly accessible from:CHELSA (climate data): https://chelsa-climate.org/bioclim/CGIAR (climate data): https://cgiarcsi.communityIUCN (range maps for amphibians and mammals): https://iucn.orgBirdLife (bird range maps): http://datazone.birdlife.orgSquamate range maps: https://doi.org/10.1038/s41559-017-0332-2<b>Data Files:</b>The files in the "Input_Data//" folder contain the necessary datasets for the analysis, organized into one-dimensional and two-dimensional environmental spaces. These files follow a naming convention that includes the species group, environmental variables, resolution, and whether the data is used for Structural Equation Modeling (SEM).One-Dimensional Climate Spaces: Files such as amphibian_Temp_Space_20_bins.csv represent temperature environmental spaces where temperature is divided into specified bins.Two-Dimensional Climate Spaces: Files like amphibian_temp_precip_20x20_SEM.csv represent climate spaces with both temperature and precipitation divided into bins for SEM.<b>Data Structure:</b>The document includes sections detailing the structure of the data, both for one-dimensional and two-dimensional environmental spaces. Examples are provided to explain how each file is organized and how the data can be used for analysis.<b>Plotting Environmental Space:</b>The document demonstrates how to visualize patterns within environmental spaces using the ggplot2 package, with functions provided to plot both one-dimensional and two-dimensional spaces.<b>Statistical Analysis:</b>The analysis focuses on the relationship between species richness and environmental factors. It includes:Data transformation functions for use in testing the metabolic theory of ecology.Regression analysis functions to model the relationship between species richness and inverse temperature.Structural Equation Modeling (SEM) to explore direct and indirect effects of environmental variables on species richness.Tools to check for autocorrelation, variance inflation factors, and relative importance of predictors.<b>Group-Specific Analysis:</b>The document details the analysis process for different groups of terrestrial vertebrates, including amphibians, reptiles, mammals, and birds. Each group's data is processed and analyzed at multiple resolutions to explore species-energy relationships across environmental gradients.