Evolutionary Fitness in Variable Environments

Evolutionary Fitness in Variable Environments

Anna Melbinger and Massimo Vergassola University of California San Diego, Department of Physics, 9500 Gilman Drive, La Jolla, CA 92093
July 7, 2019

One essential ingredient of evolutionary theory is the concept of fitness as a measure for a species’ success in its living conditions. Here, we quantify the effect of environmental fluctuations onto fitness by analytical calculations on a general evolutionary model and by studying corresponding individual-based microscopic models. We demonstrate that not only larger growth rates and viabilities, but also reduced sensitivity to environmental variability substantially increases the fitness. Even for neutral evolution, variability in the growth rates plays the crucial role of strongly reducing the expected fixation times. Thereby, environmental fluctuations constitute a mechanism to account for the effective population sizes inferred from genetic data that often are much smaller than the census population size.


Spencer’s famous expression “survival of the fittest” Spencer (1864) provides an appealing short summary of Darwin’s concept of evolution Darwin (1859); Wallace (1858). However, it leaves aside a very difficult yet important aspect namely identifying the factors determining the fitness of a species Metz et al. (1992); Ariew and Lewontin (2004) : fittest individuals are by definition prevailing but the reasons facilitating their survival are not obvious. Besides the difficulties arising due to the genotype phenotype mapping causing complex fitness landscapes de Visser and Krug (2014), also ecological factors like population structure and composition additionally complicate the issue. Therefore traditional fitness concepts solely based on growth rates and viability were extended by frequency-dependent Maynard Smith and Price (1973) or inclusive fitness approaches Hamilton (1964). Another important factor for the success of a certain trait, is a non-constant environment influencing birth/death rates Gillespie (1973); Takahata et al. (1975); Frank and Slatkin (1990); May (1973); Haccou and Iwasa (1995); Yoshimura and Jansen (1996); Kussell et al. (2005); Orr (2007); Chevin et al. (2010); Rivoire and Leibler (2014). How variable environmental conditions affect evolutionary strategies like phenotypic heterogeneity or bet-hedging has been extensively studied, see e.g. Schaffer (1974); Kussell and Leibler (2005); Kussell et al. (2005); Acer et al. (2008); Beaumont et al. (2009); Patra and Klumpp (2014), yet the consequences of fluctuating reproduction rates and their interplay with demographic fluctuations were not fully elucidated.

Here, we quantitatively investigate the impact of variable environments on the fitness. In contrast to other models dealing with variable environmental conditions, we do not study which strategy is optimally suited to cope with such changing environments but focus on the consequences of fluctuating reproduction rates. In particular, we show that an individual’s sensitivity to environmental changes contributes substantially to its fitness: A reduced sensitivity increases the fitness and may compensate for large disadvantages in the average reproduction rate. We also find that fluctuating environments influence neutral evolution where they can cause much quicker fixation times than expected. These effects are relevant as constant environmental conditions are the exception rather than the norm; for instance, the availability of different nutrients, the presence of detrimental substances and other external factors like temperature, all strongly influence reproduction/survival and occur on a broad range of time scales Mustonen and Lässig (2007).

To understand the impact of fluctuating environmental conditions, we first consider rapidly changing environments in an evolutionary process based on birth and death events similar to May (1973). The dynamics is described by the following stochastic differential equations :


The influence of environmental variability is modeled as white noise acting on the growth rate, , of a trait of type : , where and is the Standard Deviation (STD) of the noise. Death rates are assumed to be constant and identical for all traits FN (). Population growth is bounded and therefore death rates increase with the total population size, where is the number of -type individuals Verhulst (1838). This may account for density-dependent ecological factors such as limited resources or metabolic waste products accumulating at high population sizes. For specificity, we choose as functional form where is the carrying capacity scaling the maximal number of individuals and sets the rate of death events. Beside environmental noise, demographic fluctuations arising from the stochastic nature of the birth-death dynamics yield the term , where is -correlated noise, , with a variance given by the sum of reaction rates Gillespie (1976). Both multiplicative noise terms in Eq. (1) are interpreted in the Ito sense Van Kampen (2001). Note that environmental noise is linearly multiplicative in , which is crucial for our results.

Let us now consider the Fokker-Planck equation (FPE) associated to Eq. (1), which we will use to derive fixation probabilities and times. We shall carry out further analysis for two different traits ; generalizations are straightforward. The transformation of Eq. (1) to a FPE, depends on the correlation level of the environmental noise acting on distinct traits Gillespie (1995). While demographic noise for different traits is always uncorrelated, the same environmental noise can affect multiple traits, e.g. if both traits feed from the same nutrients whose abundance fluctuates. We keep the following analysis quite general by introducing the correlation coefficient  : for environmental noise is uncorrelated, , while for . The resulting FPE is


where . To uncover the influence of environmental noise on the evolutionary dynamics, the relative abundances seem the natural observables. Therefore, we change variables to the fraction and the total number of individuals . The FPE for and can be simplified exploiting the fact that selection, , is much slower than population growth . Therefore, we integrate over the total population size , considering the FPE for the marginal distribution , and employing , see SM SM (). The resulting one-dimensional FPE reads :


where and the last equality defines the Fokker-Planck operator needed in the sequel. In Ref. Takahata et al. (1975) a similar FPE was derived for the special case . For , the drift term reduces to the well-know expression favoring the trait with a higher growth rate Kimura (1983). Note that the variability in the growth rates affects both the diffusion term and the drift, which is due to the multiplicative nature of the environmental noise.

For simplicity, we discuss the case of different environmental sensitivity, defined by and , i.e. only the reproduction rate of the first trait depends on the environment. The drift is then proportional to independent of . If , i.e. the second trait with a smaller variability in its birth rate is also faster in reproducing, the evolutionary dynamics does not change qualitatively compared to . Conversely, if , the situation changes dramatically : the growth rate favors trait 1 while the variability term favors trait 2. This leads to a stable fixed point for (for variability is not sufficient to prevent extinction of trait 2). Such a dynamics can be interpreted as frequency-dependent fitness function. However, the frequency-dependence arises here from environmental noise and not from a pay-off matrix Maynard-Smith (1982) as in standard evolutionary game theory.

Figure 1: Fixation probability, , depending on selection strength, , and variability according to Eq. (1). Other parameters are , , and . The black line indicates the parabola , which is our prediction for . The inset shows cuts for exemplary values of in red, violet, blue, green.

Even though environmental variability causes a drift term favoring the traits which is less sensitive to environmental changes Frank (2011), the interplay between drift and diffusion term has to be understood to predict the evolutionary outcome. This is even more important as for the particular situation discussed here, the environmental contribution to the drift caused by is intrinsically connected to the diffusion term. Therefore we study the fixation probability, i.e. the probability that trait 1 fixates or trait 2 goes extinct. This quantity can be calculated by solving the backward FPE, for the boundary conditions and . The solutions is given by (for details see SM),


with , and In Fig. 1 we show the fixation probability for different values of and (). Results are obtained by the numerical solution of Eq. (1), i.e. before marginalization on . The parabola (Fig. 1 black line) defined by (or ), separates the regions where one of the two traits is predominant : in the grey (green) area, the smaller variability (growth rate) dominates, respectively. The general case of both species having variable birth rates yields analogous results: a selection advantage for the trait with less variability. In the inset, the fixation probability depending on is compared to the analytic solution (Eq. (S6)) for the four values . Both plots demonstrate the advantage of the less variable trait. For strong environmental variations it is then beneficial for a species to minimize its sensitivity to those variations rather than optimizing its growth rate. Interestingly one can interpret this result in the context of game theory: Decreasing the sensitivity to environmental changes also means to optimize the worst case scenario outcome: The average birth rate is the least reduced when the variability is small. In game theory, this corresponds to the MaxiMin strategy which was shown to be very successful in many fields as finance, economy or behavioral psychology von Neumann and Morgenstern (1944); Owen (1995). In the context of evolutionary dynamics another example of a MaxiMin strategy was proposed for bacterial chemotaxis where bacteria move move so as to optimize their minimal uptake of chemoattractants Celani and Vergassola (2009).

Besides contributing to the fitness, environmental variability also influences fixation probability and time in the case of neutral evolution, i.e. and . Such analysis is of great interest, as evolution is often studied by investigating how neutral mutations evolve over time. In recent years fast-sequencing techniques made huge amounts of data available, see, e.g., Shendure and Ji (2008), which is now analyzed and interpreted by comparison to evolutionary models as the Moran or Fisher-Wright models Blythe and McKane (2007). While the correlation parameter does not qualitatively influence results discussed so far, it plays an important role for neutral evolution. For fully correlated noise, , Eq. (S5) is the same as for and thereby correspond to the ones obtained for no environmental noise, extinctions are solely driven by demographic fluctuations and well-known results apply Kimura (1983). In contrast, for all other values of , including uncoupled noise , the dynamics differs in two major respects. First, the drift term does not vanish and corresponds to a stable fixed point at . Second, the diffusion term consists of demographic and environmental fluctuations . As the drift suppresses extinction events while a larger diffusion term favors them, a more detailed analysis is required to grasp the evolutionary outcome.

Due to the stable fixed point, the fixation probability qualitatively differs from the linear dependence which holds for constant or uncorrelated environments. In Fig 2a), typical solutions for and are shown which clearly demonstrated the ensuing s-shape for the uncorrelated case ().

Figure 2: Fixation probability (panel a) and time (panel b) in the neutral case. Solid lines indicate analytical results for the two typical cases of perfectly correlated and uncorrelated noises and . Parameters are : , , and . Dots are simulations of the IBM. Additional parameters are , , , , , and .

Another important quantity, the extinction time, , also obeys a backward FPE, . Employing the boundary conditions , the fixation time in the neutral case ( and ) can be calculated SM () :


where , , , the function and is the polylogarithm. The result for differs again from the non-fluctuating/fully correlated scenario, (see Fig. 2b). Fluctuating environments decrease the fixation times for all initial conditions. This has a crucial consequence: when measuring extinction times and comparing them to standard models without environmental fluctuations, one can only explain large diffusion constants by small population sizes. Indeed, it is often found that effective population sizes are much smaller than the census population sizes  Charlesworth (2009). Fig. 3 shows that conspicuous orders-of-magnitude reductions in the population size set in already at moderate levels of environmental noise. Amongst other explanations this could account for a difference between effective and census population size. In other words as long as the level of environmental noise and the correlation level of its influence on different growth rates is not known, the effective population size can only be interpreted as a lower bound for the census population size.

Figure 3: Reduction of the effective population size due to environmental noise in the neutral case for . Using (5), we plot the values of the population size and noise that lead to the fixation time for . The black line corresponds to (see (5)), i.e. either perfectly correlated noise or no environmental noise. In the presence of environmental noise, the values of are systematically higher and increase several orders of magnitude even for moderate noise levels.

To further investigate the impact of variable environmental conditions, we introduce an exemplary Individual Based Model (IBM). In particular, the IBM serves as a proof of principle that linear multiplicative noise can be realistically expected and enables us to study the effect of such noise beyond the white noise regime. Importantly, our results presented above hold for any microscopic model whose macroscopic representation is given by Eq. (1), i.e. where noise in the birth or death rates is linearly multiplicative. In specific scenario discussed here, the reproduction rate of an individual, , at time , depends a priori on the history of environmental conditions experienced during its lifetime , where is the time of birth. This could for example account for the level of nutrients or detrimental substances that individuals are exposed to. Following Melbinger et al. (2010); Cremer et al. (2011), our model is based on independent birth and death rates, now depending on the environmental variations subsumed in the scalar value . The number of environments experienced by an individual, , is denoted as and their values are contained in a vector . For the fully correlated case (), is the same for both traits while two different values are drawn for . Environmental conditions change stochastically at rate and are distributed according to a distribution, , with mean and variance .

We first consider a constant environment . The average instantaneous growth rate is assumed to be a positive, monotonically increasing function of  FN2 (). In particular, we consider the sigmoidal function :


with the ordinate of the inflection point, the maximal deviation from it, and scales the sensitivity to environmental changes.

Let us now consider changing environments and individuals whose current growth rate memorizes previously experienced environments. The reproduction rate of an individual, , of type now depends on the whole vector, . For concreteness, we assume that the rate is


where the memory parameter defines the influence of previously experienced environments upon an individual’s growth rate. For only the current environment sets , while for all experienced environments, , have the same influence in the arithmetic mean . Independent of we assume that offsprings lose memory at the time of reproduction. Bounded growth is modeled by death rates .

To compare the results of the microscopic individual based model to the effective stochastic model, Eq. (1), the parameters of both models have to be mapped. For simplicity let us consider the case and a symmetric distribution throughout the following discussion. Since death rates are constant, there is a direct correspondence between them in the Langevin and the IBM. For birth rates and their STDs the situation is more intricate as we discuss hereafter. For the no-memory case () an exact mapping is obtained SM (): For strong fluctuations, , the mean of the growth rate and STD of the noise in Eq. (1) are given by :


Note that the variability in the growth rate not only results in , but also influences the average reproduction rate . While for such a variability increases , the second term of is reduced while increases till it changes sign (see SM SM () for details). For instance, for the growth rate is approximately . Hence, the more variable trait has a disadvantage in the average reproduction rate in addition to the effects discussed above. For , the approximation holds SM (). Dependencies in this expression are intuited as follows. The number of environmental changes an individual experiences until the memory resets is of the order , where is the typical time for an individual to reproduce or die. As environmental changes are independent random events, the variance of the reproduction rates (S21) is . The expression for is finally obtained noting that correlations in the noise extend over times therefore it follows that the average reproduction rate drops out.

Figure 4: Comparison of the IBM and the Langevin model. We show the fixation time for neutral evolution for vs the environmental switching rate . Dots correspond to the IBM [] for different values of in red, blue and green. Black lines are analytic solutions [Eq. (5) with Eq. (8)]. For quickly fluctuating environments both results are in good agreement whilst for large the white noise approximation fails. Other parameters are as in Fig. 2.

For a detailed comparison of the IBM with the analytics derived in the first part of this paper, we simulate the IBM with a modified Gillespie algorithm updating reproduction rates after every environmental change Gillespie (1976). As shown in Figs. 2a) and b), results for fixation probability and time, are in very good agreement with analytic solutions [Eqs. (S6) and (5)]. In particular, the sigmoidal shape of the fixation probability is well reproduced by the IBM, supporting the existence and importance of linear multiplicative noise.

Finally, the IBM enables us to study the environmental switching rate. This is of main interest as results obtained previously strictly only hold for very rapidly fluctuating environments. In Fig. 4, the dependency on of the extinction time in the neutral case for is shown for different ; see SM for results with  SM (). The black lines correspond to Eq. (5) mapped according to Eqs. (8) and dots are obtained by stochastic simulations of the IBM for . For both models are in very good agreement. This demonstrates that the white noise approximation is valid in a broad parameter range, where fluctuating environments substantially influence the evolutionary dynamics.

In summary, we demonstrated that environmental variability has crucial impact on evolutionary fitness. First, we quantified the role of reduced sensitivity to environmental changes and determined how it substantially increases the fitness. Second, we showed that the timescale of extinction in the neutral case is strongly affected by environmental noise. That provides a mechanism to explain experimental observations of population sizes that are often much smaller than expected. Finally, we investigated individual based models that generate the linear multiplicative noise considered here. It will be of interest to investigate how different forms of memory or time-dependent reproduction rates influence evolution and to integrate them with evolutionary game models.

We thank Jonas Cremer for valuable discussions and comments on the manuscript. AM acknowledges the German Academic Exchange Service (DAAD) for financial support.


  • Spencer (1864) H. Spencer, Principles of biology (William and Nordgate, 1864).
  • Darwin (1859) C. Darwin, Origin Of Species (John Murray, 1859), Online Version.
  • Wallace (1858) A. R. Wallace, J. Proc. Linn. Soc. London 3, 53 (1858).
  • Metz et al. (1992) J. A. J. Metz, R. M. Nisbet, and S. A. H. Geritz, TREE 7, 198 (1992).
  • Ariew and Lewontin (2004) A. Ariew and R. C. Lewontin, Brit J Phil Sci 55, 347 (2004).
  • de Visser and Krug (2014) J. de Visser and J. Krug, Nature Reviews Genetics 15, 480 (2014).
  • Maynard Smith and Price (1973) J. Maynard Smith and G. R. Price, Nature 246, 15 (1973).
  • Hamilton (1964) W. D. Hamilton, J.Theor. Biol. 7, 1 (1964).
  • Gillespie (1973) J. Gillespie, Genet. Res., Camb. 32, 115 (1973).
  • Takahata et al. (1975) N. Takahata, K. Ishii, and H. Matsuda, Proc. Natl. Acad. Sci. USA 72, 2541 (1975).
  • Frank and Slatkin (1990) S. Frank and M. Slatkin, The American Naturalist 136 (1990).
  • May (1973) R. M. May, Am. Nat 107, 621 (1973).
  • Haccou and Iwasa (1995) P. Haccou and Y. Iwasa, Theor Popul Biol 47, 212 (1995).
  • Yoshimura and Jansen (1996) J. Yoshimura and V. Jansen, Res.Popul. Ecol 82, 165 (1996).
  • Kussell et al. (2005) E. Kussell, R. Kishony, N. Q. Balaban, and S. Leibler, Genetics 169, 1807 (2005).
  • Orr (2007) H. Orr, Evolution 61, 2997 (2007).
  • Chevin et al. (2010) L. Chevin, R. Lande, and G. Mace, PLoS Biol. 8, e1000357 (2010).
  • Rivoire and Leibler (2014) O. Rivoire and S. Leibler, Proc Natl Acad Sci USA 111 (2014).
  • Schaffer (1974) Q. Schaffer, The American Naturalist 108 (1974).
  • Kussell and Leibler (2005) E. Kussell and S. Leibler, Science 309, 2075 (2005).
  • Acer et al. (2008) M. Acer, J. Mettetal, and A. van Oudenaarden, Nature Genetics 40, 471 (2008).
  • Beaumont et al. (2009) H. Beaumont, J. Gallie, C. Kost, G. Ferguson, and P. Rainey, Nature 462 (2009).
  • Patra and Klumpp (2014) P. Patra and S. Klumpp, Phys. Rev. E 89, 030702 (2014).
  • Mustonen and Lässig (2007) V. Mustonen and M. Lässig, Proc Natl Acad Sci USA 104, 2277 (2007).
  • () For simplicity we restrict our discussion to the situation where the environment only affects the birth rate; the influence on the death rate is analyzed analogously and leads to the same conclusions.
  • Verhulst (1838) P. F. Verhulst, Corresp. Math. Phys. 10, 113 (1838).
  • Gillespie (1976) D. Gillespie, Journal of Computational Physics 22, 403 (1976).
  • Van Kampen (2001) N. Van Kampen, Stochastic Processes in Physics and Chemistry (North-Holland Personal Library) (North Holland, 2001), 2nd ed.
  • Gillespie (1995) D. Gillespie, Am. J. Physics 64, 1246 (1995).
  • () More details are provided in the supporting information
  • Kimura (1983) M. Kimura, The Neutral Theory of Molecular Evolution (Cambridge University Press, Cambridge, 1983).
  • Maynard-Smith (1982) J. Maynard-Smith, Evolution and the Theory of Games (Cambridge University Press, Cambridge, 1982).
  • Frank (2011) S. Frank, J. Evol. Biol. 24, 229 (2011).
  • von Neumann and Morgenstern (1944) J. von Neumann and O. Morgenstern, Theory of Games and Economic Behavior (Princeton Univ. Press, 1944).
  • Owen (1995) G. Owen, Game Theory (Academic Press, New York, 1995).
  • Celani and Vergassola (2009) A. Celani and M. Vergassola, Proc. Natl. Acad. Sci. 107, 1391 (2010).
  • Shendure and Ji (2008) J. Shendure and H. Ji, Nature Biotechnology 26, 1135 (2008).
  • Blythe and McKane (2007) R. A. Blythe and A. J. McKane, J. Stat. Mech. 2007, P07018 (2007).
  • Charlesworth (2009) B. Charlesworth, Nat Rev Genet 10, 195 (2009).
  • Melbinger et al. (2010) A. Melbinger, J. Cremer, and E. Frey, Phys. Rev. Lett. 105, 178101 (2010).
  • Cremer et al. (2011) J. Cremer, A. Melbinger, and E. Frey, Phys. Rev. E 83, 051921 (2011).
  • () Without loss of generality, we assume that larger values of correspond to better environmental conditions.

Supporting Information
In this Supporting Material, we provide more details on the calculations leading to the one-dimensional Fokker-Planck equation (FPE), Eq. (3) main text. Moreover, we present calculations for the average fixation time and the extinction probability. We discuss the mapping of the individual based model (IBM) to the Langevin model. For the no-memory limit we present an analytic derivation of the mapping. For other parameter values we give heuristic arguments that are supported by additional data. Finally, we present results for non-neutral evolution investigating the regime in which the white noise approximation is an adequate description for the evolutionary process.

Appendix A Derivation of the one-dimensional Fokker-Planck equation

In this Section, we provide details how the Langevin equations,


can be transformed into the one-dimensional FPE presented in the main text. From general results on stochastic processes (see Gnedenko (1998)), it follows that the previous Langevin equation is associated to the following two-dimensional FPE :


where . The drift part is directly stemming from the non-fluctuating parts of the Langevin equations . Diffusion depends on the correlation level of the noises experienced by the two species. In particular, we have introduced the correlation coefficient . The case when the two noises are the same is given by , when they are independent is and when they are anti-correlated is .

To study the evolutionary dynamics associated to Eq. (S2), the relative abundances are the natural choice of variables. Therefore, we transform the absolute abundances and to and . To perform the change of variables, not only and have to be replaced, also the differential operators and the probability distribution have to be transformed. Ensuring that the latter is still normalized after change of variables, the Jacobian has to be introduced, . The derivatives are given by, and .

After the change of variables, the FPE for and can now be further simplified exploiting the fact that the time scale of selection, , is much slower than the one of the population growth  Cremer et al. (2011). Therefore, we marginalize the FPE with respect to the total population size . Thereby, the integrals of -derivative terms such as or vanish and the FPE simplifies to


where . The drift term in the second line stemming from demographic fluctuations can be neglected as holds. To finally arrive at the one-dimensional FPE employed in the main text, we compute the steady state population size . As the deterministic differential equation for is given by

the fixed point for the populations size is . Employing that relation and the aforementioned condition , the last term in Eq. (S3) can be simplified as , which finally leads to the one-dimensional FPE in the main text:


Appendix B Fixation probability

In the following, we derive a general expression for the fixation probability. The calculations are analogous to the procedure for the neutral case described in the body of the paper. To determine the fixation probability the following backward equation has to be solved,


Boundary conditions are and . The solution to Eq. (S5) for the fixation probability is




The solution (S6) is obtained by integrating (S5) once, to find the gradient


The expression (S8) is verified to be proportional to the derivative of and boundary conditions are then imposed to fix the two constants of integration. The resulting expression is finally transformed into Eq. (S6) by using the elementary identity: . It is verified that in the limit , one recovers the expression given in the main text.

All in all, the behavior we discussed in the main text is validated by analyzing the fixation probability: Both a higher growth rate and a smaller variability are beneficial for an individual.

Appendix C Average time for fixation

c.1 Neutral case

The expression for the time of fixation in the neutral case that we presented in the body of the paper is derived as follows. The average time for fixation obeys the following backward equation,


with the boundary conditions . Integrating Eq. (S9) and by variation of constants, we obtain:


where is a constant to be fixed by the boundary conditions. The integrals of Eq. (S10) needed for are performed by decomposing the rational function at the prefactor and using the formula :


that follows from the very definition of the dilogarithm (see Zagier (2007)). The formula (S11) is used four times either directly (with a simple change of variables) or first integrating by parts to satisfy the condition in (S11). The resulting expression is then transformed to the form given in the main text (which is the one given by Mathematica) by using the reflection property, , see Zagier (2007).

c.2 General case

In the general case when selection is present, the expression for the average fixation time cannot be found explicitly but is reducible to quadratures as follows. The fixation time obeys the backward equation (S5) with the left-hand side replaced by . Using the definitions (S7), we obtain


Boundary conditions are . The homogeneous solution was already found following (S8) and reads


where and are constants and we defined


to simplify notation. The non-homogeneous solution for the gradient of is obtained by varying the constant in (S8), remarking that and integrating the resulting first-order differential equation to obtain

where is the hypergeometric function of two variables Gradshteyn et al. (2007). The solution for involves the integral of the expression above (for which a closed form does not seem to be available), and the two constants in (S13) are fixed by

It is verified from the expression above or directly from the original equation (S12) that in the two limits and the solution behaves like in the neutral case, i.e. and . Selection and the rest of the parameters affect of course the solution in the rest of the interval of definition .

Appendix D Coexistence time

Depending on the position of the stable fixed point, coexistence between two species (one with a larger growth rate, one with a smaller variability, and ) is possible. In this section we present some additional data demonstrating this. In Fig. S1, the extinction time which corresponds to the time of coexistence is shown depending on is shown for different values of . Dots correspond to solutions of Eqs. (A) and black lines are numerical solutions of Eq. (S12). The extinction time has a maximum which exactly coincides with the parameter values of a fixed point . The dependence of this maximal extinction time on the selection strength is shown in Fig. S2.

Figure S1: Extinction time depending on for different values of the selection strength: (red), (violet) and (blue). Dots are numerical solutions of the Langevin equations, Eq. (A), and black lines are solutions of Eq. (S12).
Figure S2: Extinction time for different values of and . This combination of and corresponds to a stable fixed point at and the maximal coexistence time for each value of , see Fig. S1. As not only the selection strength but also the variability is increasing from left to right, the fixation time is a monotonically decreasing function of .

Appendix E Mapping individual-based models onto the Langevin dynamics

The aim of this Section is to show that individual-based models are described by the Langevin equations, Eqs. (A), discussed in the main text and to analyze the mapping between the parameters of the two models.

The environmental conditions change stochastically at the rate and are distributed according to a distribution, , with mean and variance Var[E]. The dependency of the instantaneous reproduction rate on is given by the sigmoidal function :


which reduces to in the limit of large variances Var[E]. Birth rates are defined as,


In the no-memory limit , the growth rate is therefore given by the instantaneous growth rate , while for the current growth rate is the arithmetic mean of all previously experienced environments. Death rates are given by .

e.1 No memory,

We discuss first the model without memory, where the memory parameter, , is zero : Individuals reproduce with the instantaneous reproduction rates [Eq. (S15)], which reduce to in the limit of large environmental variance. We consider an interval of length such that the probability for an individual to reproduce or die is small, yet the total number of events occurring over the whole population () is large. Neglecting the standard demographic noise term Kimura (1983), the variation of the -type population is given by

where is the environmental Boolean random variable that takes values and switches with characteristic time . The last term of Eq. (LABEL:eq:stepML) is estimated as follows


where is a Gaussian random variable having zero mean and variance


Here, we used that and . The second term in Eq. (S18) is evaluated at the order using the same integral, Eq. (S19), and gives . Combining back all the terms, we conclude that the equation (LABEL:eq:stepML) is equivalent to the Langevin equation (A) with the mapping of the parameters


Note that the standard demographic noise term in Eq. (A) should a priori include the fluctuating environmental term in the sum of the rates. In fact, it can be safely ignored as due to and .

Finally, the factor appearing in in (S20) depends on the Poisson statistics of the environmental fluctuations. If the duration is fixed and equal to , Eq. (S19) becomes . In that case, the corresponding mappings are and . This is confirmed numerically in Fig. S3 where we show data for exponentially distributed (black) and fixed duration (red) environments. Solid lines are analytic solutions of the fixation time [Eq. (6) main text] employing the respective mappings.

Figure S3: Comparison of data obtained by simulations in the neutral case with fixed (red) and exponentially distributed (black) environmental changes. Both sets of data agree with our analytic calculations, where we used the mappings for fixed times of environmental changes and for exponentially distributed switches. Thereby, the data confirms that the origin of the factor 2 in the mapping is solely the exponential distribution of the environmental changes. Parameters are and , , , , and .

e.2 Finite memory,

We now turn to the scenario where memory extends over several environmental conditions that an individual previously experienced. Whilst for an exact analytic mapping can be found in the limit of small , for finite memories the situation is more intricate. However, for the special case the variability in the growth rate can be well approximated by the following argument. The reproduction rate of an individual, , of type at time depends on the average of all instantaneous reproduction rates experienced by the individual :


At the time of reproduction, we assume for simplicity that offspring looses its memory of past environments experienced by the progenitor.

We consider again a time interval of length as in (LABEL:eq:stepML). Fluctuations in the rates decorrelate on timescales of the order of the lifetimes of individuals, , which are much longer than and . Therefore on the scale, noise is smooth, contrary to (LABEL:eq:stepML). Conversely, timescales of several lifetimes are much smaller than those on which selection acts and much longer than the characteristic time of the noise. Therefore, to describe the dynamics of the fractions, the environmental noises are well approximated by a shortly correlated noise. An estimation of the amplitude of the noise is obtained by calculating the sum

The durations of the environmental intervals are independent for different and (and the contribution is negligible with respect to the rest of the sum) so that one can replace them by . In addition, the symmetry in the indices of the intervals allows us to further simplify the expression


To compute the average in Eq. (S22) three different orders of events have to be distinguished: a) If the birth of the -th individual was prior to the one of the -th individual, then it follows from Eq (S21) that the quantity to be averaged is , where is the number of environmental switches since the birth of the -th individual up to time . To derive Eq. (S22) we have used that the terms in the sum (S21) take independent values with equal probability. Conversely, case (b) is when the birth of the individual is posterior to the one of the -th individual. Then the quantity to be averaged is , where is the time between the birth of the -th and the -th individuals. Finally, in case (c) when , the correlation is zero as there is no overlap between the environmental fluctuations of the two individuals. Due to the Poissonian nature of the events, the number of switches since birth (back in the past) or before reproduction (forward in the future) have the same distribution where (its exact value does not affect the sequel). It follows that

The integral over is the continuous approximation of the sum over appearing in Eq. (S22) while the variables and refer to the variables and . The first and second term in the square parentheses of (LABEL:eq:mess) correspond to cases (a) and (b), respectively. By a series of change of variables and integrations by parts, it is shown that (LABEL:eq:mess) reduces to


The validity of this approximation is confirmed for the neutral case in Fig. 2 in the main body of the paper where the fixation probability and time are compared to the analytic calculations employing Eq. (S24). Additional data for non-neutral evolution is presented in Fig. S4 where two species (one with finite variability, , one with vanishing variability) are analyzed. Analytic solutions for the fixation time and probability are fitted to simulation data. The best fit deviates less than from Eq. (S24).

Figure S4: Fixation probability and time for non-neutral evolution with memory . Black dots correspond to simulation results of the IBM and red lines are analytic solutions. To obtain the latter we fitted Eq. (S6) and the solution of Eq. (S12) to the IBM. We used