# epcc: An R package to assess and simulate the vulnerability of ectothermic populations when facing climate change

**Handling Editor: ** Luis Cayuela

## Abstract

en

- An established framework to evaluate vulnerability to global warming is to associate the expected temperature trends with thermal performance curves, which indicate how fitness changes as a function of body temperature.
- Mathematical modelling approaches allow synthesizing the mechanistic understanding of ecological processes, enabling the assessment of the potential impacts of global warming on populations.
- epcc allows to model and simulate the effects of thermal sensitivity and the exposition to different trends in environmental temperature on the abundance dynamics of ectothermic populations.
- epcc allows a synthesis of the possible consequences of global- and local-scale warming, constituting a useful tool for understanding the risk of extinction of populations.

## Resumen

es

- Un marco establecido para evaluar la vulnerabilidad frente al calentamiento global es asociar las tendencias de temperatura esperadas con las curvas de desempeño térmico, las cuales indican cómo cambia la adecuación biológica en función de la temperatura corporal.
- Las aproximaciones desde el modelamiento matemático permiten sintetizar la comprensión mecanicista de los procesos ecológicos, lo que permite la evaluación de los potenciales efectos del calentamiento global sobre las poblaciones.
- epcc permite modelar y simular los efectos de la sensibilidad térmica y la exposición a diferentes tendencias de temperatura ambiental sobre la dinámica de la abundancia de poblaciones de ectotermos.
- epcc permite una síntesis de las posibles consecuencias del calentamiento a escala global y local, constituyendo una herramienta útil para comprender el riesgo de extinción de las poblaciones.

## 1 INTRODUCTION

Climate change and the associated global warming constitute one of the main factors explaining the current world-wide biodiversity crisis, where future scenarios predict even higher risk of extinction (IPBES, 2019; Urban, 2015; Wiens, 2016). Ectothermic organisms are highly vulnerable because the environmental temperature determines their body temperature (Duarte et al., 2012; Paaijmans et al., 2013). Nevertheless, the impact of warming depends on the magnitude and trend of temperature change, and on the physiological sensitivity of organisms when exposed to altered conditions (Deutsch et al., 2008; Huey et al., 2012; Pinsky et al., 2019).

Mathematical modelling approaches allow synthesizing the mechanistic understanding of ecological processes, constituting a highly valuable tool for assessing and simulating the potential impact of global warming on populations (e.g. Amarasekare & Coutinho, 2014; Jenouvrier et al., 2009; Urban et al., 2016). Here, we present the R package epcc (Ectotherm Populations and Climate Change), which allows an easy understanding of the warming effects on population dynamics.

## 2 MODELLING APPROACH

### 2.1 Thermal performance curves

An established framework to evaluate the vulnerability of ectothermic organisms considers associating expected temperature trends and thermal performance curves (TPCs). These curves indicate how fitness changes as a function of body temperature (Deutsch et al., 2008; Huey et al., 2012; Pinsky et al., 2019). TPCs have a characteristic unimodal asymmetric shape skewed to the left. Its main descriptors are minimum and maximum critical temperatures (CT_{min} and CT_{max} respectively), which indicate the thermal tolerance range, and the optimum temperature (*T*_{o}), which indicates the temperature at which performance is at its maximum value (Angilletta, 2006; Huey et al., 2012). Our models implement a cubic expression that follows the characteristic shape of TPCs, which has been described in Saldaña-Núñez et al. (2019), that is $r\left[T\right]={r}_{o}\times \left[\omega \left(T\right)/\omega \left({T}_{o}\right)\right]$ with $\omega \left(T\right)=T\times \left(T-{\mathrm{CT}}_{\mathrm{min}}\right)\times \left({\mathrm{CT}}_{\mathrm{max}}-T\right)$, and where two parameters are needed to characterize the curve. Both CT_{min} and CT_{max} delimit the range at which population exists and *T*_{o} indicates the temperature at which the intrinsic growth rate (*r*) achieves the maximum value (${r}_{o}$).

### 2.2 Population dynamics

Population growth is generally determined by resource availability. The logistic model of population growth captures the essential characteristics of population dynamics through the intrinsic rate of increase ($r$) and the carrying capacity ($K$) (e.g. Gotelli, 2008). Our modelling approach modifies the logistic model incorporating temperature effects on the intrinsic rate of increase, that is $r\left(T\right)={b}_{0}\left(T\right)-{d}_{0}\left(T\right)$, where ${b}_{0}$ and ${d}_{0}$ corresponds to the intrinsic birth death rates respectively. As usual, linear expressions are used to denote density dependence, that is $b\left(x,T\right)={b}_{0}\left(T\right)-{b}_{1}x$ and $d\left(x,T\right)={d}_{0}\left(T\right)+{d}_{1}x$, where *x* is the population abundance, and ${b}_{1}$ and ${d}_{1}$ are the slopes that relate birth and death rates as a function of population size. Using the classical form of population dynamics, we have: ${x}^{\prime}/x=b\left(x,T\right)-d\left(x,T\right)$, allowing to obtain a non-autonomous logistic equation (Hallam & Clark, 1981) in which temperature (*T*) varies with time. The carrying capacity is given by $K\left(T\right)=\left({b}_{0}\left(T\right)-{d}_{0}\left(T\right)\right)/\left({b}_{1}+{d}_{1}\right)$, which is therefore also thermodependent. The carrying capacity can be rewritten as $K\left(T\right)=r\left(T\right)/\lambda $, where $\lambda ={b}_{1}+{d}_{1}$ indicates the marginal loss per competition. The $\lambda $ parameter indicates the loss in carrying capacity per an extra individual in the population, this being a non-thermodependent component of intraspecific competition. Note that increments in this parameter reduce the carrying capacity, and therefore can be used to incorporate components of climate change different from temperature and other factors that may influence resource availability (Figure 1). Demographic information such as birth and death rates and the carrying capacity may allow model parametrization.

Several ectothermic species have complex life cycles, where warming can impose differential effects through developmental stages (Amarasekare & Coutinho, 2014). In these cases, a class-structured population model (Gotelli, 2008) is appropriate. Therefore, our approach also considers a model for an ectotherm population with three stages (see Supporting Information for a detailed explanation). In addition, our approach also considers interspecific interactions that can be affected by warming (Miller et al., 2014; Pokallus & Pauli, 2015; Rico-Gray, 2001; Seifert et al., 2015). Specifically, we formulated models for a population of an ectothermic species that (a) competes with a species that is not affected by temperature and (b) that is predated by a species that is not affected by temperature (see Supporting Information for a detailed explanation).

## 3 PACKAGE DESCRIPTION

The R package epcc provides several functions that allow to model and simulate the effects of thermal sensitivity and the exposition to different environmental temperature trends on the abundance dynamics of ectothermic populations. More specifically, parameters associated with the optimum population performance (${r}_{o}$) and critical thermal limits for survival (${\mathrm{CT}}_{\mathrm{min}}$ and ${\mathrm{CT}}_{\mathrm{max}}$) can be specified. For instance, it is possible to simulate if the thermal optimum is below or above the current temperature, and determine the potential outcome when considering that thermal specialists or generalist organisms constitute the population (i.e. wider or narrower thermal limit ranges). Regarding environmental temperature, the package encompasses predicted scenarios proposed by the Intergovernmental Group of Experts on Climate Change (IPCC), trends such as heating or cooling pulses, and trends with different temperature variability levels through time (Figure 2). This suite of functions allows evaluating hypothetical trends and predicted scenarios at different latitudes and time lapses. In addition, potential intraspecific non-thermal effects on population dynamics (Rich et al., 2009; Svanback & Bolnick, 2007) can also be incorporated through a specific parameter (i.e. $\lambda $, the marginal loss per competition).

The package also provides functions to assess thermal effects on stage-structured populations and on the outcome of two common interspecific interactions, that is, competence and predation, when the population growth of one of the species is affected by temperature (the prey population in the case of predation). These functions have been developed considering global warming trends as proposed by the IPCC (2014).

The package epcc has been built upon a classical ordinary differential equation (ODE) solver, that is, the R package deSolve (Soetaert et al., 2010), but our approach involves incorporating temperature effects through time, which leads to a non-autonomous system ODE approach. epcc provides a range of functions allowing the visualization of variations in abundance, corresponding carrying capacity and temperature trends.

## 4 EXAMPLES

### 4.1 Single population simulation

Figure 3 shows simulation examples performed with epcc. These examples consider a population with an initial abundance of ${N}_{0}=100$ individuals, imposing four types of temperature increase trends, that is, linear increase (function: increasing_linear; Figure 3a,e,i), warming pulse (function: heating_pulse; Figure 3b,f,j), increments with variability (function: variability; Figure 3c,g,k) and an IPCC scenario (function: IPCC_RCP8.5; Figure 3d,h,l). The effects of the initial temperature (${T}_{i}$), thermal tolerance range ($\mathrm{\mathcal{R}}$) and the marginal loss due to competition ($\lambda $) are depicted. For an easier understanding of the variable parameters, each function allows the incorporation of three different values for these parameters. Colours represent the different population abundances, and the edges of the shaded areas are the corresponding carrying capacities. In the first row (i.e. from (a) to (d)), the initial simulation temperatures (${T}_{\mathrm{i}}$) correspond to three values related to ${T}_{\mathrm{o}}$. In the second row, different thermal tolerance ranges (i.e. from (e) to (h)) are considered, where their critical extreme temperatures vary proportionally. Finally, the third row (i.e. from (i) to (l)) shows the abundance and carrying capacity curves considering the variation of the marginal loss due to competition. In greater detail, the first row of Figure 3a shows three abundance trends when considering different initial simulation temperatures, that is ${T}_{\mathrm{i}}<{T}_{\mathrm{o}}$ (red curve), ${T}_{\mathrm{i}}={T}_{\mathrm{o}}$ (green curve) and ${T}_{\mathrm{i}}>{T}_{\mathrm{o}}$ (blue curve). While in the first case the abundance increases until it reaches ${T}_{\mathrm{o}}$ and then begins to decrease, in the other two cases the abundance of the population decreases as the temperature increases with time. The same figure shows the carrying capacities associated with each of the curves (hatched areas), whose shape is directly related to the TPC represented by $r$ as defined by $K$. With the effect of the same thermal trend, Figure 3e shows different levels of tolerance ranges ($\mathrm{\mathcal{R}}$), which are formed considering ${\mathrm{CT}}_{\mathrm{min}1}=10/9\times {\mathrm{CT}}_{\mathrm{min}2}$ and ${\mathrm{CT}}_{\mathrm{min}2}=10/9\times {\mathrm{CT}}_{\mathrm{min}3}$, ${\mathrm{CT}}_{\mathrm{max}2}=10/9\times {\mathrm{CT}}_{\mathrm{max}1}$ and ${\mathrm{CT}}_{\mathrm{max}3}=10/9\times {\mathrm{CT}}_{\mathrm{max}2}$ and which are associated with the red, green and blue curves respectively. It is possible to observe that broader thermal ranges reduce population risk when facing temperature increments; it can also be seen that as ${T}_{\mathrm{i}}<{T}_{\mathrm{o}}$, the curves associated with the carrying capacity rise until they reach their optimum temperature, subsequently falling more abruptly. Finally, in Figure 3i, variations in the marginal loss due to competition ($\lambda $) are considered as follows ${\lambda}_{2}=2\times {\lambda}_{1}$ and ${\lambda}_{3}=2\times {\lambda}_{2}$, represented by red, green and blue curves respectively. It is possible to observe that a higher marginal loss due to competition leads to low population sizes and carrying capacities.

### 4.2 Single population application

This example considers the data reported for *Macrolophus pygmaeus* available in Rezende and Bozinovic (2019). By using the function rate_adjustment, the main TPC descriptors can be obtained and therefore be used for the simulation. Considering three localities reported in Sanchez et al. (2012), the function w_clim can be used to obtain projected data at these locations. This function internally calls the function getData from the raster package (Hijmans, 2020), downloading data from WorldClim (Hijmans et al., 2005). Different bioclimatic variables, resolutions, models, representative concentration pathways and years can be specified. Figure 4 shows the effect of the increase in temperature on the populations of *Macrolophus pygmaeus* when considering the following three different bioclimatic variables: annual mean temperature, the maximum temperature of the warmest month and mean temperature of the warmest quarter. As a caution note, in this example the same TPC is used for the three localities, obviating potential geographic differences in the performance of populations, and the parameter $\lambda $ was arbitrarily set to $5\times {10}^{-5}$. Nevertheless, it illustrates how population trends vary depending on the geographic location that is being evaluated and on the bioclimatic variable that is being considered. Clear differences can be observed in the risk of extinction. More detailed information is provided in the Supporting Information.

### 4.3 Adjustment to observed population trends

The function adjustment_trend allows to adjust observed time series of abundance and environmental temperature trends along with the main descriptors of TPCs. This function internally calls the nls2 function (Grothendieck, 2013) to fit one of the proposed temperature trends as described in Figure 2. Information about TPCs is also needed. For instance, by using the abundance trends reported for the salamander *Desmognathus ochrophaeus* in the BioTIME database (Dornelas et al., 2018; Wiley, 2016), temperature data obtained from NOAA’s platform (www.ncdc.noaa.gov), TPCs descriptors reported by Layne and Claussen (1987) and by Markle and Kozak (2018), and the increasing periodic temperature trend (Figure 2m), the abundance follows variations that are expected when environmental temperatures are within the maximum critical temperatures (see Figure 5). More detailed information is provided in the Supporting Information.

### 4.4 Class-structured population

The age_structure function allows simulating the dynamics of an ectotherm population with three developmental stages, in which each stage can be affected by temperature differentially. For instance, reducing the ${\mathrm{CT}}_{\mathrm{max}}$ of the first stage while keeping other parameter values constant may lead to extinction (Figure 6).

### 4.5 Interspecific competition

The function competition allows simulating an interspecific competition interaction in which the performance of one of the species depends on temperature. For instance, although species 1 may have higher competitive abilities than species 2, a reduction in ${\mathrm{CT}}_{\mathrm{max}}$ will result in the extinction of species 1 (Figure 7).

#### 4.5.1 Predation

The function predation allows simulating the outcome of a predation interaction. While the performance of the prey depends on temperature, the predator is not affected by temperature. For instance, a reduction in ${\mathrm{CT}}_{\mathrm{max}}$ will result in the extinction of prey, and therefore the predators will also go to extinction due to the lack of food resources (Figure 8).

## 5 CONCLUSIONS

Here, we present epcc, an R package developed to model and simulate the potential impact of global warming on ectothermic populations. Our package allows evaluating hypothetical temperature trends and warming scenarios proposed by the IPCC. In addition, incorporating TPCs allows understanding the physiological sensitivity and its effects on population trends. Furthermore, the package also allows to simulate thermal effects on stage-structured populations and on the outcome of two common interspecific interactions, that is competition and predation. Our approach is based on a non-autonomous ordinary differential equation. The graphical output allows the simultaneous comparison of different parameter values, resulting in a relatively easy and fast tool to understand the repercussions of warming on the abundance and extinction risk of populations. Future versions of the package will include higher flexibility in the specification of the $\lambda $ parameter, plasticity in TPCs through time, lagged population responses to temperature variations, other classical models and the inclusion of body size following macroecological theory (Campillay-Llanos et al., 2021). We expect that epcc will be a useful tool for understanding the effect of warming on ectotherm populations.

## ACKNOWLEDGEMENTS

V.S.-N. thanks the Doctorado en Modelamiento Matemático Aplicado of the Universidad Católica del Maule for the doctoral scholarship provided during the development of the doctoral thesis. F.N.M.-G. and V.S.-N. were also supported by FONDECYT 11160778.

## CONFLICT OF INTEREST

The authors have no conflict of interest.

## AUTHORS' CONTRIBUTIONS

All authors contributed integrally to the construction of all the points of the manuscript, giving their consent for its publication; V.S.-N. wrote the programming code, considering F.C.-L. and F.N.M.-G. observations.

## Open Research

# PEER REVIEW

The peer review history for this article is available at https://publons.com/publon/10.1111/2041-210X.13816.

# DATA AVAILABILITY STATEMENT

The epcc package is available on CRAN (https://CRAN.R-project.org/package=epcc), and its more recent version is available in a GitHub repository https://github.com/Victor-Saldana/epcc, which is licensed under the GPL-3.0. It can also be found on Zenodo http://doi.org/10.5281/zenodo.5034087 (Saldaña-Núñez, 2021). Instructions for installation and usage are in the Supporting Information.