DOI: 10.57760/sciencedb.32664
title: Codes for model constructions and statistical analysis in "‘Energetic Window’ Determines Reptile Reproductive Output Under Climate Change: Concept, Latitudinal Gradients and Physiological Mechanisms"
title: Codes for model constructions and statistical analysis in "‘Energetic Window’ Determines Reptile Reproductive Output Under Climate Change: Concept, Latitudinal Gradients and Physiological Mechanisms"

description: This codes contain two parts, one is codes used for model construction, the other is used for analyzed the output of the models.Notes for code-Energetic window & ReproductionThis code integrates a microclimate model with an ectotherm model to simulate lizard body-temperature variation and behavioral thermoregulation within natural microhabitats, generating hourly estimates of body temperature and activity state. It then uses these temperature and activity data to estimate energy income (such as foraging  intake  and  energy  digestion)  and  energy  expenditure  (including  basal metabolic costs and activity costs), and allocates the accumulated daily energy surplus to maintenance or reproductive output.Notes for codes-Analysis model outputCode Description 1: Statistical Comparisons of Climate Change Treatments and Seasonal EffectsThis  code  uses  non-parametric  statistical  methods  to  evaluate  how  climatechange  treatments  and  seasonal  differences  affect  body  temperature,  energeticwindow, energy income, energy expenditure, and reproductive output in differentlizard species.First, the script compares differences among experimental treatmentswithin each species. For the same individuals under present versus warming-onlyconditions, a paired Wilcoxon test is applied. For independent groups under warming-only versus warming with plasticity conditions, an independent Mann–Whitney U testis used. To reduce false positives, all p-values are adjusted using the Bonferronimethod, and significance levels are assigned based on the adjusted p-values.Next, thescript assesses seasonal differences for each species and comparison scenario. AWilcoxon rank-sum test is used to compare values between the two seasons, and themean and standard deviation of each variable in each season are calculated. Allstatistical results are then compiled and saved.Code Description 2: Mechanisms Underlying Energetic Window RegulationThis part of the code processes hourly model output data to quantify the mechanisms by which temperature, energy income, and energy expenditure regulate the energetic window. For each species and scenario, the data are first aggregated by day of year (DOY) to calculate daily variables, including total daily metabolic expenditure, total daily energy income, and average daily body temperature (TC). Next, daily body temperatures are rounded and binned to capture trends in energy expenditure and energy acquisition across temperature ranges.Within each temperature bin, the average daily energy expenditure and average daily energy income are calculated. Then, generalized additive models (GAMs) are used to fit smooth functions describing how energy expenditure and energy income vary with body temperature (avg_daily_MR ~ s(TC), avg_daily_income ~ s(TC)). If the GAM fit fails, the original values are retained. These smooth curves illustrate the temperature dependence of energy expenditure and energy income, providing insights into the core physiological mechanisms that constrain the energetic window.
description: This codes contain two parts, one is codes used for model construction, the other is used for analyzed the output of the models.Notes for code-Energetic window & ReproductionThis code integrates a microclimate model with an ectotherm model to simulate lizard body-temperature variation and behavioral thermoregulation within natural microhabitats, generating hourly estimates of body temperature and activity state. It then uses these temperature and activity data to estimate energy income (such as foraging  intake  and  energy  digestion)  and  energy  expenditure  (including  basal metabolic costs and activity costs), and allocates the accumulated daily energy surplus to maintenance or reproductive output.Notes for codes-Analysis model outputCode Description 1: Statistical Comparisons of Climate Change Treatments and Seasonal EffectsThis  code  uses  non-parametric  statistical  methods  to  evaluate  how  climatechange  treatments  and  seasonal  differences  affect  body  temperature,  energeticwindow, energy income, energy expenditure, and reproductive output in differentlizard species.First, the script compares differences among experimental treatmentswithin each species. For the same individuals under present versus warming-onlyconditions, a paired Wilcoxon test is applied. For independent groups under warming-only versus warming with plasticity conditions, an independent Mann–Whitney U testis used. To reduce false positives, all p-values are adjusted using the Bonferronimethod, and significance levels are assigned based on the adjusted p-values.Next, thescript assesses seasonal differences for each species and comparison scenario. AWilcoxon rank-sum test is used to compare values between the two seasons, and themean and standard deviation of each variable in each season are calculated. Allstatistical results are then compiled and saved.Code Description 2: Mechanisms Underlying Energetic Window RegulationThis part of the code processes hourly model output data to quantify the mechanisms by which temperature, energy income, and energy expenditure regulate the energetic window. For each species and scenario, the data are first aggregated by day of year (DOY) to calculate daily variables, including total daily metabolic expenditure, total daily energy income, and average daily body temperature (TC). Next, daily body temperatures are rounded and binned to capture trends in energy expenditure and energy acquisition across temperature ranges.Within each temperature bin, the average daily energy expenditure and average daily energy income are calculated. Then, generalized additive models (GAMs) are used to fit smooth functions describing how energy expenditure and energy income vary with body temperature (avg_daily_MR ~ s(TC), avg_daily_income ~ s(TC)). If the GAM fit fails, the original values are retained. These smooth curves illustrate the temperature dependence of energy expenditure and energy income, providing insights into the core physiological mechanisms that constrain the energetic window.