<<

bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Chaos and the (un) of in a changing environment

Artur Rego-Costaa,c, Florence Débarreb, and Luis-Miguel Chevinc,1

aDepartment of Organismic and Evolutionary , Harvard University, Cambridge, MA, USA bCentre Interdisciplinaire de Recherche en Biologie (CIRB), Collège de France, CNRS UMR 7241 - Inserm U1050, 11 place Marcelin Berthelot, 75231 Paris Cedex 05, France cCEFE-CNRS, UMR 5175, 1919 route de Mende, 34293 Montpellier Cedex 05, France 1To whom correspondence should be addressed. E-mail: [email protected]

November 20, 2017

Among the factors that may reduce the predictability of evolution, chaos, characterized by a strong de- pendence on initial conditions, has received much less attention than due to genetic drift or environmental stochasticity. It was recently shown that chaos in phenotypic evolution arises commonly un- der frequency-dependent selection caused by competitive interactions mediated by many traits. This result has been used to argue that chaos should often make evolutionary dynamics unpredictable. However, pop- ulations also evolve largely in response to external changing environments, and such environmental forcing is likely to influence the outcome of evolution in prone to chaos. We investigate how a changing environment causing oscillations of an optimal phenotype interacts with the internal dynamics of an eco- evolutionary that would be chaotic in a constant environment. We show that strong environmental forcing can improve the predictability of evolution, by reducing the probability of chaos arising, and by damp- ening the magnitude of chaotic oscillations. In contrast, weak forcing can increase the probability of chaos, but it also causes evolutionary trajectories to track the environment more closely. Overall, our results indicate that, although chaos may occur in evolution, it does not necessarily undermine its predictability. Keywords Eco-evolutionary dynamics, to changing environments, Predictability, Repeatability, Chaotic dynamics

Introduction ics of a system, despite being completely predictable from the initial conditions, are strongly sensitive to The extent to which evolution is repeatable and pre- them. Under chaotic dynamics, any measurement er- dictable bears on the usefulness of evolutionary biol- ror, regardless how small, will be amplified over time, ogy as a tool for a growing number of applied fields, to the point that it becomes impossible to make ac- including drug resistance management in pests and curate predictions beyond a certain timescale (Ott, pathogens, or sustainable agriculture and harvesting 2002; Petchey et al., 2015). under climate change. So far, the investigation of fac- It was recently demonstrated theoretically that evo- tors that may reduce the predictability of evolution lutionary dynamics at the phenotypic level can be- has mostly focused on various sources of stochastic- come chaotic when natural selection results from ity (i.e. randomness), namely genetic drift, the con- between-individual interactions within a species tingency of mutations, and randomly fluctuating en- (Doebeli & Ispolatov, 2014), i.e., even in the ab- vironments (Crow & Kimura, 1970; Lenormand et al., sence of any interspecific eco-evolutionary feed- 2009; Sæther & Engen, 2015). A much less explored backs, which are known to enhance ecological chaos source of unpredictability in evolution is determin- (Abrams & Matsuda, 1997; Dercole & Rinaldi, 2010; istic chaos (but see Hamilton, 1980; Altenberg, 1991; Dercole et al., 2010). Specifically, evolutionary chaos Gavrilets & Hastings, 1995; Abrams & Matsuda, 1997; arises in single-species models when (i) selection is Dercole & Rinaldi, 2010; Dercole et al., 2010; Doebeli frequency-dependent, such that the fitness of an in- & Ispolatov, 2014), which occurs when the dynam- dividual depends on trait-mediated interactions with

1 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license. conspecifics; (ii) the fitness effects of these interac- ing phenotypic selection, modeled as a moving opti- tions are not simply a function of the phenotypic dif- mal phenotype (a classic approach, reviewed by Kopp ference between the interactors (unlike typical mod- & Matuszewski, 2014), influences the predictability els of within- and between-species interactions, e.g. of evolutionary dynamics in a context where chaos Dieckmann & Doebeli, 1999; Doebeli & Ispolatov, is expected to make evolution highly unpredictable 2010); and (iii) the number of traits involved in these in the absence of environmental forcing. Focusing interactions (described as organismal ) is on a periodic environment, we ask how the ampli- large (Doebeli & Ispolatov, 2014).The authors con- tude and period of cycles influence (i) the probability cluded from this study that evolution is likely to that evolutionary trajectories are chaotic, and (ii) the be much less predictable than generally perceived. degree to which those trajectories that are indeed However, the theoretical demonstration that chaos is chaotic track the optimal phenotype set by the en- possible in a system is not sufficient to argue that this vironment, making them partly predictable.We show system is necessarily unpredictable, as we elaborate that a changing environment can dramatically alter below. the probability of evolutionary chaos in either direc- First, the parameter values that lead to chaos may tion, but that evolutionary tracking of the environ- be rare in nature (Hastings et al., 1993; Zimmer, 1999). mental forcing generally contributes to making evo- For instance in , chaos has long been known lutionary trajectories much more predictable than to be a possible outcome of even simple population anticipated from a theory that ignores any role of the dynamic models (May, 1976), but despite a few clear external environment. This suggests that the pre- empirical demonstrations in the laboratory (Benincà dictability of evolution is partly determined by a bal- et al., 2008) and in the wild (Benincà et al., 2015), ance between the strength of intraspecific interac- most natural populations seem to have demographic tions and responses to environmental change. parameters placing them below the “edge of chaos” (Hastings et al., 1993; Ellner & Turchin, 1995; Zimmer, 1999; Dercole et al., 2006). Methods Second, and importantly with respect to evolution, Model a potentially chaotic system may still be predictable because it is subject to forcing by external factors with We consider a set of d phenotypic traits that evolve autonomous dynamics. In eco-evolutionary pro- under both frequency-dependent and frequency- cesses, such external forcing generally results from independent selection. Frequency-independent se- a changing environment that affects fitness compo- lection is assumed to be caused by stabilizing selec- nents and their dependence on phenotypes, causing tion towards an optimal trait value, at which carry- variation in natural selection. In fact, environmental ing capacity K is maximized. For instance, selection variability affecting population growth (Lande et al., on beak size/shape in a bird, or mouth shape in a 2003; Ellner et al., 2011; Pelletier et al., 2012) and nat- fish, may have a local optimum set by the available ural selection (MacColl, 2011; Chevin et al., 2015) is type of resources (Martin & Wainwright, 2013; Grant probably ubiquitous in natural populations, as doc- & Grant, 2014). The frequency-dependent compo- umented notably by numerous examples of ecologi- nent of selection, on the other hand, emerges from cal and evolutionary responses to climate change (re- trait-mediated ecological and social interactions be- viewed by Davis et al., 2005; Parmesan, 2006; Hoff- tween individuals within the species (either coopera- mann & Sgrò, 2011). When such external forcing is tive or competitive). Selection on a bird’s beak mor- imposed, the predictability of evolution is likely to phology, for instance, depends not only on the avail- change, because (i) forcing can alter the probability able types of resources, but also on competition with that the system is indeed chaotic, for instance by sup- conspecifics for these resources (as in Grant & Grant, pression of chaos through synchronization to the ex- 2014). The intensity of this competition may depend ternal forcing (e.g. Pikovsky et al., 2003); and, (ii) even on the beak size of competing individuals, but also if the dynamics remain chaotic, they may still be af- on other traits of these interactors, such as their ag- fected by the forcing in ways that make them largely gressiveness, territoriality, or degree of choosiness in predictable. food preference. This frequency-dependent compo- We investigate how a changing environment affect- nent of selection, when it involves many traits, can

2 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license. lead to complex dynamics such as chaos or internally environment causing the optimum to oscillate sinu- driven cycles, as shown by Doebeli & Ispolatov (2014). soidally, which may represent, depending on the or- Other details of the models, laid out in the Support- ganism, oscillations in biotic (predators, parasites) or ing Information, follow Doebeli & Ispolatov (2014) abiotic (e.g. meteorological) conditions on seasonal, for ease of comparison. Notably, we use the same multi-annual (e.g., El Niño oscillation), or geological adaptive dynamics assumptions, whereby evolution time scales. We assume for simplicity that the opti- is slower than population dynamics and relies on rare mal values for all traits respond to the same under- new mutations (Dieckmann & Law, 1996; Geritz et al., lying environmental variable, such that they oscillate 1998; Dercole & Rinaldi, 2008), although our results with the same period and phase (i.e., they are syn- are likely to apply also in a quantitative genetic con- chronized). The vector of optimal phenotypes for all text where evolutionary dynamics are much faster traits can then be written as (see Discussion). Under these assumptions, the evo-  ‹ lutionary dynamics of each phenotypic trait x is (see 2π i θ (t ) = A sin t , (2) Supporting Information for more details) · T d d dxi X X 3 where T is the period, and A = (A1, A2, , Ad ) is a vec- b x a x x x θ t . (1) dt = i j j + i j k j k ( i i ( )) tor of amplitudes of oscillation for each··· of the d traits. j 1 j,k 1 − − = = This defines a single sine wave of amplitude A (the The first two terms in equation (1) repre- norm of vector A), and direction given by thek unitaryk sent frequency-dependent selection caused by vector A/ A . In our simulations, we focused for sim- phenotype-dependent interactions between indi- plicity onk thek case where Ai is the same for all traits, viduals. The coefficients bi j and ai j k determine, such that the optimum changes along a diagonal of respectively, the strength of first- and second-order the phenotype space. Note also that equation (2) im- selective interactions between traits. The latter plies that the optimum fluctuates around the pheno- occurs when the fitness of an individual with a given type for which the strength of selective interactions phenotype at trait i depends on the product of its vanishes (set to the origin by definition, without loss phenotypic values at two traits j and k (including of generality). Allowing for fluctuations to be cen- j = i and/or k = i ), at least one of which is from its in- tered on a different phenotype – or equivalently, in- teractor (e.g. beak size of focal individual interacting cluding a 0t h order term in the interaction compo- with beak size and agressiveness of interactor). Im- nent of selection in equation (1) – would select for portantly, these frequency-dependent components increasing interactions in all environments, thus arti- of directional selection will be null if the interaction ficially increasing the probability of chaos relative to between individuals depends only on their pheno- Doebeli & Ispolatov (2014), where the optimum was typic difference, in which case frequency-dependent set constant at the origin. selection would not lead to chaotic dynamics (as explained in the Supporting Information). Put differ- ently, this means that a necessary (but not sufficient) Simulations condition for evolutionary chaos in this model is that intraspecific interactions do not depend solely on the We studied the evolution of the phenotypic vector resemblance (or difference) between the trait values x(t ) containing the mean phenotype for each trait of interactors, but also on their actual phenotype, by numerically solving the dynamics of equation (1) for instance when individual that are highly social, given the initial phenotype x(0), period T and vec- agressive, or large, interact more overall. tor of amplitudes A (both characterizing the optimum The last term in equation (1) models stabilizing se- θ ), and set of interaction coefficients ai j k and bi j . In lection that causes the phenotype to evolve towards each simulation, the interaction coefficients were in- dependently drawn from a normal distribution with the optimum θi for each trait i . In the original model a mean 0 and standard deviation 1, and rescaled as i j k (Doebeli & Ispolatov, 2014), the optimal phenotype pd bi j was assumed to be constant and equal to zero for all and d . This rescaling, proposed by Doebeli & Ispo- traits. Here in contrast, we modeled the forcing ef- latov (2014), ensures that dynamics under different fect of a changing environment by letting the opti- dimensionalities under a constant environment ex- mum θ (t ) change with time. We focused on a cycling plore similar ranges of phenotypic values, between 1 − 3 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

and 1. It also prevents the unrealistically strong selec- ity, we thus estimated the proportion f (t ) of trajecto- tion produced at high dimensionalities in the model ries behaving chaotically at each time step, and used with unscaled interaction coefficients: in effect, we this to estimate the asymptotic proportion of trajec- keep the expected overall strength of selection con- tories that remain chaotic over infinite time. This was stant but spread it across the d traits. Trajectories done using the non-linear least-squares method (nls were run up to t = 1200 using the LSODA method, as function in R’s stats package R Core Team, 2015) to fit implemented in the package deSolve in R (Soetaert a statistical model of the form f (t ) = A exp(B t )+C +ε, et al., 2010; R Core Team, 2015), with integration step where A, B and C are the estimated variables (C be- dt = 0.1. Initial phenotypes were drawn from a mul- ing the asymptotic proportion of chaos), and ε is the tivariate normal distribution centered at zero such residue (see Supplementary Fig.S2). that, on average, the carrying capacity K (x(0),θ (0)) = 0.5 (Eq. S2). This choice was made to keep the initial Predictability in a changing environment state of the system under biologically relevant degrees of adaptation. To investigate the effect of a changing environment, Evolutionary dynamics were categorized based on we focused on a system of high dimensionality (d = their largest λ, which measures 70), because this leads to a high probability of chaos the rate of exponential increase in the distance be- in a constant environment (Supplementary Fig. S3 tween two trajectories that start from very close initial and Doebeli & Ispolatov, 2014). We used 100 sets conditions (Sprott, 2001). Dynamics that converge of interaction coefficients bi j and ai j k and initial to an equilibrium phenotype have 0, those that λ < phenotypes x0. Each set of parameters was used oscillate periodically (limit cycles) have λ = 0, and for simulations in a constant environment and in those that systematically diverge due to strong sensi- changing environments (40 different combinations tivity to initial conditions (which defines chaos) have of amplitude A and period T of optimum oscilla- λ > 0. Here we used a local average Lyapunov ex- tion, with A k k 1.30,2.33,3.73,5.04,5.99 and T ponent computed over a sliding window of 200 time 1.5,2,3,5,10,20,50,100k k ∈ { .) The amplitudes} were cho-∈ units (see Supporting Information and Supplemen- sen{ such that the smallest} carrying capacity that a tary Fig.S1). phenotype centered at the origin would experience (i.e. when the optimal phenotype was at the peak of Proportion of transient chaos in a constant en- its oscillation) was 0.99,0.9,0.5,0.1,0.01 . { } vironment For each regime of environmental change, we in- vestigated the extent to which chaotic trajectories (i.e. In this model, trajectories that eventually reach fixed trajectories with a final Lyapunov exponent λ > 0) points or limit cycles may exhibit complex behaviors track the moving optimum. For this, the time-series for long periods of time (Fig.1A and B), during which of phenotypic values were regressed on the oscillat- they are indistinguishable from chaos. To understand ing optimal phenotype. We focused on the projec- the prevalence in the system of this so-called tran- tion xˆ of the multivariate phenotypes along the di- sient chaos (Grebogi et al., 1983; Gavrilets & Hastings, rection of oscillations of the optimum in the pheno- 1995; Lai & Tél, 2010), we ran simulations with d rang- typic space, which we regressed on a similar projec- ing from 2 to 100 traits, under a constant optimum tion θˆ for the optimum (which is simply the norm set at zero for all traits. Trajectories were identified of θ ). Additionally, because the evolving phenotype as transiently chaotic if they switched from λ > 0 to systematically lags behind the moving optimum in either λ = 0 or λ < 0 (i.e. they went from chaos to a such a system (Lande & Shannon, 1996), we maxi- cycle or fixed equilibrium, respectively) by the end of mized the R 2 of the regression by shifting forward the the simulations (at time t = 1200; excluding the first time-series of phenotype relative to that of the opti- 50 time steps of the simulations that correspond to a mum (as shown in Supplementary Fig.S4). This max- burn-in period). imum R 2 quantifies the proportion of variance in the Transience is expected to cause the proportion of evolutionary dynamics explained by (lagged) track- chaos-like trajectories to decrease exponentially with ing of the optimum, so it is a measure of the pre- time (Yorke & Yorke, 1979), even for high-dimensional dictability of evolution conditional on knowledge of systems (Grebogi et al., 1983). For each dimensional- the environment. This tracking component of evolu-

4 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license. tion necessarily has the same period as the optimum (Supplementary Fig. S4), so approximating it as a si- nusoidal function for simplicity, the regression slope of the phenotype xˆ on the (resynchronized) optimum θˆ is just the ratio of amplitudes of their cycles (as we confirmed in our simulations, see Supplementary Fig.S5). We also looked for signatures of tracking of the changing environment in the evolutionary time- series xˆ using spectral analysis (fast Fourier transform method, as implemented in R’s stats package, R Core Team, 2015). This technique treats time-series as su- perpositions of sine and cosine waves of different fre- quencies (Shumway & Stoffer, 2011), and allows es- timation of the amplitudes associated to each fre- quency of oscillation (1/T ). More precisely, the spec- tral density as computed by the spectrum() function in R is half the squared amplitude of waves of the cor- responding frequency of oscillation.

Results Fig. 1. Transients in a constant environment. Transient trajectories present chaos-like behavior for some time, be- fore transitioning to either (A) fixed equilibrium pheno- Transient evolutionary chaos is common types or (B) periodic cycles. Two representative trajecto- ries for a single trait are shown, simulated as described in Chaos in phenotypic evolution was previously shown the Methods, with d = 45 and a constant optimum (or- ange line). (C) The expected proportion of evolutionary to be a common outcome in a constant environment, trajectories (among all those for a given dimensionality d ) when interactions with conspecifics cause frequency- that will eventually transition to non-chaotic dynamics, dependent selection as modeled in equation (1) and but would still be categorized as chaotic at a given time, the interactions are mediated by many traits (Doe- are shown for different times. These proportions were es- beli & Ispolatov, 2014; Ispolatov et al., 2015). How- timated from a statistical model of exponential decrease ever, some of the apparently chaotic trajectories are with time of the proportion of apparently chaotic dynam- actually transient (Fig.1A and B). The fraction of tra- ics (model fits in Supplementary Fig.S2). For each dimen- jectories that exhibit such transient chaos strongly sionality d , 250 trajectories were run up to t = 1200 and classified based on their estimated Lyapunov exponents λ, depends on organismal complexity d (Fig. 1C), be- as described in the Methods. ing highest for d between 40 and 70 (approximately), where the proportion of trajectories that are chaotic is intermediate (Fig. S2, and Doebeli & Ispolatov, 2014; A changing environment may either increase or Ispolatov et al., 2015). The statistical models fitted to decrease the probability of chaos the proportion of chaotic trajectories in time predict that virtually all transient trajectories should even- We next investigated the effect of a changing environ- tually transition to fixed points or periodic cycles by ment. We tracked the proportion of trajectories that t = 3200 (Fig.1C). However before this transition, the were chaotic (up to time t = 1200) under sinusoidal phenotype may undergo very complex, random-like cycles in the optimal phenotype, with varying peri- dynamics, with no indication that they will eventu- ods and amplitudes. The proportion of chaotic tra- ally transition to a state that, once established, is quite jectories was strongly influenced by the regime of op- predictable (see Fig.S3). timum oscillation (Fig. 2A). Long periods of oscilla-

5 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. 2. Probability of chaos in a changing environment. The proportion of chaotic trajectories at time t = 1200 in an oscillating environment is shown against (A) the period and (B) the average speed of optimum oscillation, for different values of amplitude (colors). For each condition of optimum oscillation (period and amplitude), we report the esti- mate (dot, line) and standard error (shading) of the proportion of chaotic trajectories, out of 100 replicated simulations that used sets of parameters also used in the constant-environment simulations (with dimensionality d = 70). The average speed of optimum oscillation is calculated from equation (2) as 4 A /T . The observed proportion of chaos at t = 1200 (horizontal solid line), and the predicted proportion after all chaotick k transients have transitioned (dashed line; calculated as shown in Supplementary Fig.S2) are also represented for a constant environment with d = 70. While long periods cause the proportion of chaotic trajectories to increase relative to a constant environment, short periods of large amplitudes (fast oscillations) cause this proportion to decrease, even below what would be predicted through more rapid transition of transiently chaotic trajectories. tion increased the probability of chaos relative to a tive to a constant environment, while a fast optimum constant environment, for the same organismal com- (speed above 5 for d = 70, Fig.2B) decreases the prob- plexity (d = 70). For long enough periods, essentially ability of chaos. Furthermore, conditions that lead all trajectories became chaotic at dimensionality d = to a reduced probability of chaos relative to a con- 70, so the chaos-enhancing effect depended little on stant environment (frequent oscillations with broad the amplitude of oscillations. However at smaller di- amplitude) also correspond to strong environmental mensionality (d = 40), the probability of chaos was forcing on the evolutionary dynamics, causing sub- maximized for a period that depended on the ampli- stantial maladaptation and directional selection even tude of oscillations, decreasing for very large periods in a context without frequency dependence (Lande & when the amplitude was large (Fig.S6). Shannon, 1996), as shown in Supplementary Fig.S7. In contrast to this chaos-enhancing effect, a combi- nation of large amplitudes and short periods of opti- Strong environmental forcing renders chaotic mum oscillation led to a sharp decrease in the propor- trajectories more predictable tion of chaotic trajectories (Fig.2A). This decrease at time t = 1200 is not simply caused by an earlier tran- The predictability of evolution is not entirely captured sition out of chaos by transient trajectories: the ob- by the probability of chaos, even in a deterministic served proportion of chaotic trajectories can be sub- system as modeled here, because chaotic evolution- stantially lower than that projected in infinite time for ary trajectories need not be entirely unpredictable. a constant optimum condition. In fact these trajectories, despite looking erratic, are Part of the effect of the changing environment on constrained to remain near the optimal phenotype the probability of chaos is explained by the absolute imposed by stabilizing selection (Doebeli & Ispola- speed of the moving optimum. A simple metric of tov, 2014). When a changing external environment speed is the norm of the derivative of equation (2) rel- causes movements of the optimum, evolution nec- ative to time, whose average over a period is equal to essarily tracks this moving optimum to some extent, 4 A /T . We use this average value as our measure of even for chaotic trajectories, as illustrated in Fig. 3A optimumk k speed. A slow optimum (speed below 5 for and B. The predictability of evolution for those trajec- d = 70, Fig.2B) increases the probability of chaos rela- tories that are chaotic thus depends on how the in-

6 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

of phenotype on the environment is a measure of the predictability of evolutionary trajectories con- ditional on knowledge of the environment, since it measures the proportion of the total temporal vari- ance in phenotype that is explainable by tracking of the optimum. The predictability of chaotic evolu- tionary dynamics increases with larger amplitudes and longer periods of optimum oscillation (Fig. 4A; and see Supplementary Fig. S8 for regressions on optimum speed). Indeed, (i) evolutionary trajecto- ries track long-period oscillating optima more closely than they do short-period ones (Lande & Shannon, 1996), and (ii) if this optimum undergoes ample fluc- tuations, so will the phenotype, such that the tracking component of evolution will be substantial, as illus- trated in Fig.3B. The exact same pattern is found for the repeata- bility of evolutionary trajectories among replicates, as measured by the proportion of the total vari- ance in evolutionary trajectories attributable to tem- poral variation in the mean trajectory across repli- cates (Supplementary Fig.S9). The rationale for this Fig. 3. Chaotic evolutionary dynamics in changing en- vironments. Chaotic evolutionary trajectories (black in measure is that the mean trajectory captures the A and B) combine internally driven chaos with external tracking component of evolutionary change, while environmental forcing through tracking of the optimum. any additional variance around this trajectory is Chaotic oscillations can be either (A) longer or (B) shorter contributed by the internal dynamics caused by than the oscillations of the optimum (shown in orange), frequency-dependent selection. Repeatability thus depending on the periods of the latter (3 and 50, respec- has a very similar meaning to predictability, but un- tively). (C, D) Spectral analysis of these same time-series like the latter it does not require information about of evolving phenotype (using all traits as described in the Methods) show a peak of spectral density (blue star) at the the environment. Note also that repeatability is a frequency of oscillation that corresponds to the oscillating measure of cross-predictability of evolution across optimum. replicates, and hence a metric of parallel phenotypic evolution, as commonly reported in the laboratory and in the field (Lenormand et al., 2016). ternally driven dynamics due to intraspecific interac- The amplitude of the tracking component of phe- tions interplay with forcing by the external environ- notypic evolution (scaled to the amplitude of the opti- ment. mum oscillation) is quantified by the regression slope To investigate how tracking of the environment of phenotype on optimum. This relative amplitude affects the predictability of evolution, we regressed increases with the period of cycles in the optimum, the time series of the evolving phenotype on that tending towards 1 for long-period cycles of any am- of the optimum, for trajectories that are chaotic plitude (Fig.4B). In contrast for shorter periods of op- in a changing environment. Such regressions are timum oscillation (left half of Fig. 4B), evolutionary similar to phenotype-environment associations, as tracking of the environment is more moderate, and are commonly estimated empirically from time se- less efficient for larger amplitudes. ries of phenotypes and environments (review in e.g. The chaotic, non-predictable component of the Michel et al., 2014), and similarly across space (e.g. evolutionary dynamics is captured by the residuals Phillimore et al., 2010). Note that here, the pheno- of the regression of the phenotype on the optimum. type first needs to be resynchronized with the envi- The variance of residuals was lower under combina- ronment, to correct for the adaptational lag (Fig. S4, tions of large amplitudes and small periods of envi- Lande & Shannon, 1996). The R 2 of the regression ronmental change (Fig.4C), corresponding to fast op-

7 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. 4. The linear regression of phenotype on the moving optimum gives insights about the predictability of chaotic evo- lutionary dynamics. (A) The fraction of the total temporal variation in the evolving phenotype explained by movements of the optimum, as captured by the R 2 of the regression, is higher when the optimum oscillates with larger amplitudes and longer periods. (B) The ratio of amplitudes between the tracking component of oscillations in the evolving pheno- type and oscillations in the optimum, as estimated by slope of the regression, is smaller under short-period optimum oscillations. (C) Temporal variation in evolutionary dynamics introduced by chaos, beyond the variation attributable to tracking of the moving optimum, is captured by the variance of residuals in the regression. Conditions that allow for close tracking of the optimum in (B) also lead to dampened chaotic oscillations. We show the average (lines and points) and standard error (shading) over 100 simulations for each combination of amplitude and period of optimum oscillation. tima. Therefore, strong environmental forcing fur- Discussion ther increases the predictability of chaotic trajecto- ries by dampening the extent to which they oscillate chaotically around the optimum. This effect can be When investigating factors that reduce predictabil- seen in Fig.3A, where the trajectory departs less from ity of evolution, evolutionary biologists have mostly the optimum (due to chaos) than the one in Fig. 3B, focused on different sources of stochasticity (Crow with same amplitude but larger period. & Kimura, 1970; Lenormand et al., 2009; Sæther & Engen, 2015), while the possibility of chaos has re- ceived comparatively less attention. Doebeli & Is- polatov (2014) have recently shown that interactions Finally, we used spectral analysis, a general signal mediated by many traits can produce chaos in phe- processing approach, to investigate whether environ- notypic evolution. However, the implications for mental tracking leaves a signature in individual evo- the predictability of evolution should not be overem- lutionary time series. Similarly to the repeatability phasized. First, the condition for chaos to occur is analysis, this involves the investigation of the evolu- not simply frequency-dependent selection on many tionary dynamics without knowledge of the forcing traits: it also requires that the strength of intraspe- environment. For essentially all regimes of environ- cific interactions depends directly on the phenotypes mental change that we investigated, the frequency of of interactors, rather than only on their phenotypic oscillation with highest spectral density in the time match or distance (Doebeli & Ispolatov, 2014), while series of phenotypic evolution corresponded to that interaction of the latter type are more commonly used of the oscillating optimum, as illustrated for specific in models of evolutionary ecology. Second, we reveal cases in Fig.3C and D. The amplitude of the wave cor- that chaos can be transient in this model, such that responding to this frequency of oscillation, as esti- initially chaotic dynamics might not be observed af- mated from the spectral density, matched the ampli- ter some time. And third, forcing by a changing en- tude estimated from the regression analysis (Fig.4B) vironment, a ubiquitous driver of eco-evolutionary very well (Supplementary Fig. S5). This shows that dynamics (as exemplified by responses to climate even in a context where evolutionary dynamics can be change, Davis et al., 2005; Parmesan, 2006; Hoffmann largely chaotic, the strongest signal in the evolution- & Sgrò, 2011), can modify the predictability of evolu- ary time series is likely to be the predictable response tion in a system that may be chaotic in a constant en- to environmental change. vironment. Below we discuss this latter point further.

8 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Chaos vs. forcing (x = 0 in the model). This causes stronger interaction terms in equation (1) (and hence more chaos) rela- Strong environmental forcing (represented by a fast tive to a constant optimum at x = 0, because chaos- moving optimum) caused suppression of chaos rel- enhancing interactions are stronger with larger trait ative to a constant environment in our model. In values in this model (Doebeli & Ispolatov, 2014). the general literature on chaos (outside of evolution- ary biology), it has previously been demonstrated, Generality and relevance to natural popula- both theoretically and experimentally, that chaotic tions dynamics can be suppressed with even slight forc- ing, but this usually occurs when the period of the Our results are difficult to compare quantitatively to forcing oscillation aligns closely to one of the specific empirical measurements, because we relied on the resonance periods of the dynamics (Lima & Pettini, adaptive dynamics approach (to facilitate compari- 1990; Fronzoni et al., 1991). In contrast in our simu- son with the original model in a constant environ- lations, the proportion of chaotic trajectories was re- ment by Doebeli & Ispolatov, 2014), where time is not duced over a broad range of short periods and large measured in units of time or in generations, but in amplitudes of oscillation that jointly result in a fast terms of an implicit number of mutations fixed. In moving optimum. In fact, most of the chaos suppres- principle, this would suggest that the timescales of sion occurred for periods much shorter than the typ- evolutionary and environmental change in our model ical internal chaotic dynamics in a constant environ- are restricted to be slow, since they are limited by ment (Supplementary Fig.S10). One of the reasons for the time between independent fixation events. How- this discrepancy may be that we studied the effect of ever, several authors (Abrams et al., 1993; Waxman the moving optimum on a total of 250 different sets of & Gavrilets, 2005; Débarre et al., 2014) have high- interaction coefficients, instead of focusing on single lighted that the canonical equation of adaptive dy- defined chaotic system, as usually done in the namics (on which eq. (1) is based) is almost iden- literature. Another reason is that in our evolutionary tical to the equation for the response to selection in model, the is different (and in gen- quantitative genetics (Lande, 1976), but with the lat- eral more complex) than in models studied in physics, ter operating on much shorter time scale. Further- for instance as in Lima & Pettini (1990) and Fronzoni more, Ispolatov, Madhok & Doebeli (2016) demon- et al. (1991). strated that the chaotic of the original Doe- In the opposite regime of slow optimum, the pro- beli & Ispolatov (2014) paper can be closely matched portion of chaotic dynamics increased. Such an out- by individual-based simulations that allow for sub- come is not uncommon in the general literature on stantial polymorphism, and thus for much faster evo- chaos, as exemplified by the chaotic dynamics in- lutionary dynamics than under the classic adaptive duced on a pendulum with friction by externally im- dynamics assumptions (i.e., rare substitution events posed sinusoidal impulses (forced damped pendu- in otherwise monomorphic populations). This sug- lum, Ott, 2002). Such a phenomenon has also been gests that the relevant timescale of evolutionary and shown in models of population ecology. Rinaldi et al. ecological change in our model can be much faster (1993) explored seasonal oscillation of demographic than assumed by adaptive dynamics, e.g. that of mi- parameters in a predator-prey model, and found that crobial evolutionary experiments or long-term field such forcing easily led to quasiperiodic and chaotic surveys, for which it is well known that evolution- dynamics that did not occur in a constant environ- ary change can happen quickly (e.g. Hendry & Kin- ment. Similarly, Benincà et al. (2015) designed a nison, 1999; Campbell-Staton et al., 2017). Finally, model based on an empirical rocky shore ecosystem understanding of the timescale of these chaotic os- with non-transitive interactions of the rock-paper- cillations will help elucidate the importance of tran- scissor form, and showed that the model only led sience, which should depend on the probability that to the chaotic oscillations observed in nature when an evolving transient population is observed before it including the forcing effect of yearly seasonal tem- has time to transition. perature cycles on death rates. In our model, op- A crucial parameter of the model that is difficult to tima that move slowly cause repeated long excursions measure empirically is organismal complexity. The away from trait values where interactions are minimal number of traits that can be measured is virtually infi-

9 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license. nite, but some may be highly correlated, or have neg- ally populations in the wild should also be exposed ligible effects on fitness. From an evolutionary per- to another source of unpredictability: evolutionary spective, phenotypic complexity thus has to be de- stochasticity caused by genetic drift, the contingency fined with respect to its effects on fitness and selec- of mutations, or a randomly changing environment tion. Previous theory has shown that complexity de- (Crow & Kimura, 1970; Lenormand et al., 2009; Sæther fined in a similar way as here (number of traits un- & Engen, 2015). A more complete understanding der stabilizing selection) has important impacts on of the predictability of evolution would therefore re- the rate of adaptation (Fisher, 1930; Orr, 2000), speci- quire combining stochasticity and chaos to investi- ation and diversification (Doebeli & Ispolatov, 2010; gate their possible interactions, as advocated pre- Chevin et al., 2014; Débarre et al., 2014; Svardal et al., viously for population dynamics (Ellner & Turchin, 2014), or the drift load in a finite population (Poon 1995). For instance, stochastic factors have been & Otto, 2000; Tenaillon et al., 2007). Some of these shown to either increase or decrease (depending on predictions have been used to attempt to estimate or- the chaotic system) the time that transients take to ganismal complexity indirectly, through its emerging converge to their equilibrium states (Lai & Tél, 2010). effects on fitness effects of mutations. Very different While such an analysis is beyond our scope here, results have been obtained, with complexity ranging some preliminary statements can be made based on from very low (on the order of 1) to several orders of our results and those from the literature. Beyond magnitude for the same organism, depending of the just adding random variation among replicates (and underlying model used (Martin & Lenormand, 2006; thus directly reducing evolutionary predictability), Tenaillon et al., 2007). In any case, our results under stochasticity may interact with chaos in evolutionary a changing environment should apply whenever the dynamics, amplifying or reducing its importance. A complexity of frequency-dependent selection caused stationary stochastic environment is a type of forc- by intraspecific interactions is high enough to gen- ing that shares some similarities with deterministic erate chaotic dynamics in a constant environment cycles. Indeed, quantitative genetic models (Lynch (Doebeli & Ispolatov, 2014). & Lande, 1993; Lande & Shannon, 1996) have shown A possibility not explored in our study is that a that increasing the stationary variance (respectively changing environment alters the interaction strength autocorrelation) of a stochastic environment has sim- between individuals with given phenotypes, and thus ilar effects on the lag load (caused by phenotypic mis- the frequency-dependent component of selection in matches with the optimum) as increasing the am- equation (1). It is not entirely clear how to best plitude (respectively period) of cycling environment. model such an effect of the environment on inter- The results we report here could thus be used to guide action coefficients – while a moving optimum for interpretation about the outcomes from future mod- the frequency-independent component of selection els investigating the combined effects of stochastic- is well-established in models (reviewed by Kopp & ity and chaos on the predictability of evolution. An Matuszewski, 2014), and has some empirical support interesting challenge for empirical research would be (Chevin et al., 2015). We can however anticipate that to establish the time scales at which chaos versus environments leading to larger absolute values of the stochasticity dominate as sources of unpredictability interaction coefficients should increase the probabil- in evolution. ity of chaos. Acknowledgements Interacting sources of unpredictability in evo- lution We thank R. Gomulkiewicz, S. de Monte, and J. Pantel for insightful discussions, and three anony- We have focused for simplicity on effectively infi- mous reviewers for useful on a previous ver- nite populations in a fully deterministic environment, sion of the manuscript. ARC is funded by an Eras- such that any unpredictability in evolution has to mus Mundus Joint Master Degree scholarship from come from sensitivity to initial conditions character- the European Comission. FD is funded by a grant istic of chaotic dynamics. This is perhaps a good ap- from Agence Nationale de la Recherche (ANR-14- proximation for some experimental studies with mi- ACHN-0003-01). LMC is funded by a grant from the crobes in controlled environments, but more gener- European Research Council (ERC-2015-STG-678140-

10 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

FluctEvol). Dercole, F.& Rinaldi, S. (2008). Analysis of evolutionary pro- cesses: the adaptive dynamics approach and its applica- tions. Princeton University Press. Data Archiving Dercole, F.& Rinaldi, S. (2010). Evolutionary Dynamics Can Be Chaotic: A Fisrt Example. International Journal of A minimum code for simulation and data analy- Bifurcation and Chaos, 20, 3473–3485. sis is currently available at https://figshare.com/ Dieckmann, U. & Doebeli, M. (1999). On the origin of s/6637d1e0c6eb320e3247 and will be uploaded to species by sympatric speciation. Nature, 400, 354–357. Dieckmann, U. & Law, R. (1996). The dynamical theory Dryad. of : a derivation from stochastic ecological processes. Journal of mathematical biology, 34, 579–612. Doebeli, M. & Ispolatov, I. (2010). Complexity and diversity. References Science (New York, N.Y.), 328, 494–497. Doebeli, M. & Ispolatov, I. (2014). Chaos and unpre- Abrams, P.A. & Matsuda, H. (1997). Prey Adaptation as a dictability in evolution. Evolution, 68, 1365–1373. Cause of Predator-Prey Cycles. Evolution, 51, 1742. Ellner, S. & Turchin, P.(1995). Chaos in a Noisy World: New Abrams, P.A., Matsuda, H. & Harada, Y. (1993). Evolution- Methods and Evidence from Time-Series Analysis. The arily unstable fitness maxima and stable fitness minima American Naturalist, 145, 343–375. of continuous traits. Evolutionary Ecology, 7, 465–487. Ellner, S.P.,Geber, M.A. & Hairston, N.G. (2011). Does rapid Altenberg, L. (1991). Chaos from Linear Frequency- evolution matter? Measuring the rate of contemporary Dependent Selection. The American Naturalist, 138, 51– evolution and its impacts on ecological dynamics. Ecol- 68. ogy Letters, 14, 603–614. Benincà, E., Ballantine, B., Ellner, S.P.& Huisman, J. (2015). Fisher, R.A. (1930). The Genetical Theory Of Natural Selec- Species fluctuations sustained by a cyclic succession at tion. Oxford University Press. the edge of chaos. Proceedings of the National Academy Fronzoni, L., Giocondo, M. & Pettini, M. (1991). Exper- of Sciences, 112, 6389–6394. imental evidence of suppression of chaos by resonant Benincà, E., Huisman, J., Heerkloss, R., Jöhnk, K.D., parametric perturbations. Physical Review A, 43, 6483– Branco, P., Van Nes, E.H., Scheffer, M. & Ellner, S.P. 6487. (2008). Chaos in a long-term experiment with a plank- Gavrilets, S. & Hastings, A. (1995). Intermittency and Tran- ton community. Nature, 451, 822–825. sient Chaos from Simple Frequency-Dependent Selec- Campbell-Staton, S.C., Cheviron, Z.A., Rochette, N., tion. Proceedings of the Royal Society B: Biological Sci- Catchen, J., Losos, J.B. & Edwards, S.V. (2017). Winter ences, 261, 233–238. storms drive rapid phenotypic, regulatory, and genomic Geritz, S., Kisdi, E., Meszéna, G. & Metz, J. (1998). Evolu- shifts in the green anole lizard. Science, 357, 495–498. tionarily singular strategies and the adaptive growth and Chevin, L.M., Decorzent, G. & Lenormand, T.(2014). Niche branching of the evolutionary tree. Evolutionary Ecol- Dimensionality and the Genetics of Ecological Specia- ogy, 12, 35–57. tion. Evolution, 68, 1244–1256. Grant, P.R.& Grant, B.R. (2014). 40 Years of Evolution: Dar- Chevin, L.M., Visser, M.E. & Tufto, J. (2015). Estimating the win’s Finches on Daphne Major Island. Princeton Uni- variation, autocorrelation, and environmental sensitiv- versity Press. ity of phenotypic selection. Evolution, 69, 2319–2332. Grebogi, C., Ott, E. & Yorke, J.A. (1983). Crises, sudden Crow, J.F.& Kimura, M. (1970). An Introduction to Popula- changes in chaotic attractors, and transient chaos. Phys- tion Genetics Theory. Burgess Pub. Co. ica D: Nonlinear Phenomena, 7, 181–200. Davis, M.B., Shaw, R.G. & Etterson, J.R. (2005). Evolution- Hamilton, W.D. (1980). Sex versus Non-Sex versus Parasite. ary Responses to Changing Climate. Ecology, 86, 1704– Oikos, 35, 282–290. 1714. Hastings, A., Hom, C.L., Ellner, S., Turchin, P. & Godfray, Débarre, F., Nuismer, S.L. & Doebeli, M. (2014). Multidi- H.C.J. (1993). Chaos in Ecology: Is Mother Nature a mensional (co)evolutionary stability. The American Nat- Strange ? Annual Review of Ecology and Sys- uralist, 184, 158–71. tematics, 24, 1–33. Dercole, F., Ferrière, R., Gragnani, a. & Rinaldi, S. (2006). Hendry, A.P.& Kinnison, M.T. (1999). The Pace of Modern Coevolution of slow-fast populations: evolutionary slid- Life: Measuring Rates of Contemporary Microevolution. ing, evolutionary pseudo-equilibria and complex Red Evolution, 53, 1637. Queen dynamics. Proceedings. Biological sciences / The Hoffmann, A. & Sgrò, C. (2011). Climate change and evo- Royal Society, 273, 983–90. lutionary adaptation. Nature, 470, 479–485. Dercole, F., Ferriere, R. & Rinaldi, S. (2010). Chaotic Red Ispolatov, I., Madhok, V., Allende, S. & Doebeli, M. (2015). Queen coevolution in three-species food chains. Pro- Chaos in high-dimensional dissipative dynamical sys- ceedings. Biological sciences / The Royal Society, 277, tems. Scientific reports, 5, 12506. 2321–30.

11 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Ispolatov, I., Madhok, V. & Doebeli, M. (2016). Individual- in an age-structured population. Proceedings of the based models for adaptive diversification in high- Royal Society B: Biological Sciences, 279, 394–401. dimensional phenotype spaces. Journal of Theoretical Petchey, O.L., Pontarp, M., Massie, T.M., Kéfi, S., Ozgul, Biology, 390, 97–105. A., Weilenmann, M., Palamara, G.M., Altermatt, F., Kopp, M. & Matuszewski, S. (2014). Rapid evolution of Matthews, B., Levine, J.M., Childs, D.Z., Mcgill, B.J., quantitative traits: Theoretical perspectives. Evolution- Schaepman, M.E., Schmid, B., Spaak, P., Beckerman, ary Applications, 7, 169–191. A.P.,Pennekamp, F. & Pearse, I.S. (2015). The ecological Lai, Y.C. & Tél, T. (2010). Transient Chaos: Complex Dy- forecast horizon, and examples of its uses and determi- namics on Finite-Time Scales. Springer, New York. nants. Ecology Letters, 18, 597–611. Lande, R. (1976). Natural Selection and Random Genetic Phillimore, A.B., Hadfield, J.D., Jones, O.R. & Smithers, R.J. Drift in Phenotypic Evolution. Evolution, 30, 314. (2010). Differences in spawning date between popula- Lande, R., Engen, S. & Saether, B.E. (2003). Stochastic Pop- tions of common frog reveal local adaptation. Proceed- ulation Dynamics in Ecology and Conservation. Oxford ings of the National Academy of Sciences, 107, 8292–8297. University Press. Pikovsky, A., Rosenblum, M. & Kurths, J. (2003). Synchro- Lande, R. & Shannon, S. (1996). The role of genetic vari- nization: A Universal Concept in Nonlinear Sciences. ation in adaptation and population persistence in a Cambridge University Press, Cambridge. changing environment. Evolution, 50, 434–437. Poon, A. & Otto, S.P.(2000). Compensating for our Load of Lenormand, T., Chevin, L.m. & Bataillon, T. (2016). Parallel Mutations: Freezing the Meltdown of Small Populations. evolution: what does it (not) tell us and why is it (still) Evolution, 54, 1467–1479. interesting? In: Chance in Evolution (eds. Ramsey, G. & R Core Team (2015). R: A Language and Environment for Pence, C.). The University of Chicago Press, chap. 8. Statistical Computing. R Foundation for Statistical Com- Lenormand, T., Roze, D. & Rousset, F.(2009). Stochasticity puting, Vienna, Austria. in evolution. Trends in Ecology and Evolution, 24, 157– Rinaldi, S., Muratori, S. & Kuznetsov, Y. (1993). Multi- 165. ple attractors, catastrophes and chaos in seasonally per- Lima, R. & Pettini, M. (1990). Suppression of chaos by res- turbed predator-prey communities. Bulletin of Mathe- onant parametric perturbations. Physical Review A, 41, matical Biology, 55, 15–35. 726–733. Sæther, B.E. & Engen, S. (2015). The concept of fitness in Lynch, M. & Lande, R. (1993). Evolution and extinction in fluctuating environments. Trends in Ecology and Evolu- response to environmental change. Biotic Interactions tion, 30, 273–281. and Global Change, pp. 234–250. Shumway, R.H. & Stoffer, D.S. (2011). Time Series Anal- MacColl, A.D. (2011). The ecological causes of evolution. ysis and Its Applications - With R Examples. 3rd edn. Trends in Ecology and Evolution, 26, 514–522. Springer, New York. Martin, C.H. & Wainwright, P.C. (2013). Multiple Fitness Soetaert, K., Petzoldt, T. & Setzer, R.W. (2010). Solving Dif- Peaks on the Adaptive Landscape Drive Adaptive Radia- ferential Equations in R : Package deSolve. Journal of tion in the Wild. Science, 339, 208–211. Statistical Software, 33. Martin, G. & Lenormand, T. (2006). A general multivariate Sprott, J.C. (2001). Chaos and Time-Series Analysis. Oxford extension of Fisher’s geometrical model and the distri- University Press, Oxford. bution of mutation fitness effects across species. Evolu- Svardal, H., Rueffler, C. & Doebeli, M. (2014). Organismal tion; international journal of organic evolution, 60, 893– complexity and the potential for evolutionary diversifi- 907. cation. Evolution, 68, 3248–3259. May, R.M. (1976). Simple mathematical models with very Tenaillon, O., Silander, O.K., Uzan, J.P. & Chao, L. (2007). complicated dynamics. Nature, 261, 459–467. Quantifying Organismal Complexity using a Population Michel, M.J., Chevin, L.M. & Knouft, J.H. (2014). Evolu- Genetic Approach. PLoS ONE, 2, e217. tion of phenotype–environment associations by genetic Waxman, D. & Gavrilets, S. (2005). 20 Questions on Adap- responses to selection and phenotypic plasticity in a tive Dynamics. Journal of Evolutionary Biology, 18, temporally autocorrelated environment. Evolution, 68, 1139–1154. 1374–1384. Yorke, J.A. & Yorke, E.D. (1979). Metastable chaos: The Orr, H.A. (2000). Adaptation and the Cost of Complexity. transition to sustained chaotic behavior in the Lorenz Evolution, 54, 13–20. model. Journal of Statistical Physics, 21, 263–277. Ott, E. (2002). Chaos in Dynamical Systems. 2nd edn. Zimmer, C. (1999). Complex systems: Life After Chaos. Sci- Parmesan, C.N. (2006). Ecological and evolutionary re- ence, 284, 83–86. sponses to recent climate change. Annual Review of Ecology, Evolution and Systematics, 37, 636–637. Pelletier, F., Moyes, K., Clutton-Brock, T.H. & Coulson, T. (2012). Decomposing variation in population growth into contributions from environment and phenotypes

12 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Supplementary Information

Details of the model fixed for a given phenotype, and evolution happens through a series of invasions of a population of resi- We extend the evolutionary model in a constant envi- dent phenotypes by better adapted mutants that dif- ronment by Doebeli & Ispolatov (2014) to a fluctuat- fer by infinitesimally small phenotypic effects (Dieck- ing environment. The model takes as a starting point mann & Law, 1996; Geritz et al., 1998). Since mu- logistic population growth where the strength of den- tations are assumed to be rare, population dynam- sity dependence depends on phenotype-mediated ics are faster than evolutionary dynamics, such that interactions, the population size equilibrates at the carrying capac- ‚ R Œ ity of the resident before any new mutant invades (in ∂ N (y, t ) α(y,x)N (x, t )d x = r N (y, t ) 1 , (S1) other words, ecological and evolutionary time scales ∂ t K y − ( ) are decoupled). where N (y, t ) is the number of individuals of type y Using the adaptive dynamics assumptions above, at time t . The phenotype of an individual is repre- Doebeli & Ispolatov (2014) demonstrate that the in- sented by a vector x (or y) of length d , the number vasion fitness f (y,x) of a mutant with phenotype y in of traits under selection; d is called the dimensional- a population fixed for the resident phenotype x, can ity or complexity of the organism (Doebeli & Ispola- be written as tov, 2014). Interactions are mediated by phenotypes: α(y,x)K (x) an interaction kernel α y,x represents the fitness ef- f (y,x) = 1 . (S3) ( ) K (y) fects of interactions with individuals of phenotype x − on individuals of phenotype y. These interactions The rate and direction of evolutionary change at can either be positive (e.g. cooperation) or negative any time is then proportional to the selection gradi- (e.g. competition) depending on the sign of α (neg- ent, i.e. the partial derivative of invasion fitness (per ative and positive, respectively). The interaction ker- capita growth rate of a rare mutant) with respect to the invader’s phenotype (Dieckmann & Law, 1996; nel is standardized such that α(y,y)= 1 for all y, but the exact form of the interaction kernel does not have Geritz et al., 1998). If mutation effects are indepen- to be specified at the moment. Another component dent and of variance equal to one for all traits (which of fitness is due to adaptation to the current environ- can be obtained by proper rescaling and change of mental condition. It takes the form of a phenotype- coordinates, Martin & Lenormand, 2006; Doebeli & dependent carrying capacity K , causing stabilizing Ispolatov, 2014), the dynamics of evolution in the selection towards a multivariate optimal phenotype multidimensional phenotypic space depends solely θ . Specifically, we have on the multivariate selection gradient s(x) = (s1(x), s2(x), , sd (x)). Each component si (x) of this vector is ‚ d Œ 1 X the partial··· derivative of the invasion fitness in equa- K x exp x θ 4 . (S2) ( ) = 4 ( i i ) tion (S3) relative to trait i of the mutant, evaluated at − i =1 − the resident phenotype for that trait, which leads to We use a quartic function because it is the form as- sumed by Doebeli & Ispolatov(2014). A more general ∂ f (y,x) ∂ α(y,x) ∂ ln[K (x)] si (x) = = + . form could include weights for the different traits, and ∂ y ∂ y ∂ x i y=x − i y=x i even interactions between the traits, but we want to (S4) stay close to their original model. Following Doebeli & Ispolatov (2014), we assume that The size of the entire population is assumed to be the interaction kernel in equation (S3) is such that its large; reproduction is clonal; mutations are rare, and derivative in equation (S4) is a quadratic function of of small phenotypic effect. To study the evolution phenotypes. Note that this implies that α(y,x) itself of the mean phenotype in the population, and to fa- (rather than its derivative with respect to y) is a third- cilitate comparison of our results with those of Doe- order function of phenotypes, i.e. includes interac- beli & Ispolatov (2014), we conform to their adaptive tions between three traits, at least one of which be- dynamics approach (also known as invasion analy- longs to the focal individual and one to its interac- sis). Under this framework, the population is always tor. For simplicity, we do not consider interactions

13 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license. of even higher orders; including them would increase a distance 10 3 from x dt , and proceed the in- δ0 = − ( ) the likelihood of chaotic behavior due to the more tegration from this point for another timestep. This complex in the system (Ispolatov et al., process is iterated along the whole trajectory up to its 2015). end. The rate of divergence at each time step is calcu- A final important point about this model is that, if lated as   the interaction kernel depended only on the pheno- 1 δf λ = ln . (S5) typic difference between interactors rather than on dt δ0 their actual phenotypes, that is, if we had α(y,x) = The estimate of the largest Lyapunov exponent is f (z) (where z = y x and f () is a function that does given by the asymptotic value of the average Lya- not involve x nor−y), then the corresponding term punov exponent as the number of considered time of the selection gradient in equation (S4) would be points tends to infinity, λ¯ . However, since we are in- f 0 , which is not a function of z and thus cannot ∞ 0( ) terested in identifying transitions from chaotic to ei- be a function of x and y. Hence the first two sums ther periodic or equilibrium behavior, we used a local in equation (1) in the main text would be null if ¯ estimate of rates of divergence, λ(t ), defined as the av- α(y,x) = f (y x), which would preclude the occur- erage λ in a window of 200 time units preceding time rence of chaotic− dynamics, since stabilizing selection t (Supplementary Fig. S1). The length of this win- alone does not produce chaos in such a model. dow was chosen such that there is enough smooth- ing of the short-term fluctuations of λ, while allowing for identification of transitions (as in Figure S1B). For The Lyapunov exponent simplicity, we refer to this measure in the main text as the Lyapunov exponent λ, omitting both the bar and Chaotic dynamical systems can be identified by their t . Chaotic trajectories were easily distinguished from Lyapunov exponents, which measure the rate of ex- non-chaotic ones by visual inspection. Based on this ponential increase in the distance between initially criterion, we were able to categorize chaotic trajecto- ¯ close trajectories in phenotype space (Ott, 2002). The ries at a given time t if λ(t ) was larger than a thresh- main characteristic of chaotic systems is that, regard- old µ = 0.05 under a constant optimum, and µ = 0.02 less of how close a set of trajectories start, trajecto- under an oscillating optimum. Trajectories were clas- ¯ ries initially diverge with time if they do not have the sified as converging to an equilibrium if λ(t ) < µ, or ¯ same exact initial state. Chaotic systems are, there- to a periodic cycle if λ(t ) < µ. − fore, characterized by positive Lyapunov exponents (i.e. exponential rates of divergence). Dynamics that converge to cycles and fixed equilibrium states have zero and negative Lyapunov exponents, respectively. In multivariate systems, divergence can happen at different rates in different directions, but a positive rate of divergence in a single direction is sufficient for a system to be chaotic. Therefore, knowledge of the largest Lyapunov exponents is sufficient to iden- tify chaos. We numerically estimate the largest Lyapunov ex- ponents of all our simulated trajectories as described by Sprott (2001). Given a previously simulated tra- jectory x(0),x(dt ),x(2dt ), , we start by picking a point z0{ positioned in a random···} direction at a dis- tance 10 3 from x 0 . We then integrate the sys- δ0 = − ( ) tem from z0 for a single timestep dt the same way as done for the original trajectory. After this calcu- lation, the distance δf between the reached point zf and x(dt) is recorded. We finally reset point z0 to lie in the same direction that separates zf and x(dt), at

14 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

¯ Fig. S1. Calculation of the window-averaged Lyapunov exponent λ(t ). (A) The evolutionary trajectory for one single trait in a system of d = 70 is represented in black, under a constant optimum (orange). The dynamics transitions from chaos to a fixed point around time t = 700. (B) The Lyapunov exponent computed at each time point with equation (S5) varies substantially (gray line). However, when averaged over a window of 200 time units (in blue; calculated as described in the supporting text), the transition from chaos (λ> 0) to a fixed equilibrium (λ < 0) can be identified with some time lag.

15 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. S2. The proportion of trajectories categorized as chaotic (according to their window-averaged Lyapunov exponent ¯ λ(t )), out of 250 simulations under a constant optimum, decreases with time as some of them transition to either peri- odic cycles or fixed equilibria. Models of exponential decrease (red solid lines) were fit to the observed frequencies (as described in the Methods), and used to predict the asymptotic proportion of truly chaotic trajectories in infinite time (red dashed lines). Models were not fitted to dimensionalities d = 2 and 5 because of their insufficient number of chaotic trajectories. The black line in d = 5 is flat because the single chaotic trajectory observed did not transition during the ¯ simulation. The black lines in the other panels are jagged because the λ(t ) of individual trajectories are only estimates that can switch between chaos and non-chaos in time.

16 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. S3. Organismal complexity and the probability of (transient) chaos in a constant environment. The proportion of ¯ trajectories identified as fixed point, periodic or chaotic at the beginning of the simulations (classified by their λ(250)) is represented in solid lines, with the standard errors of binomial proportions shown as shading. The proportion of trajectories identified as chaotic decreases with time, as transiently chaotic trajectories reach their eventual equilibrium fixed point or limit cycle. The red dashed line shows the asymptotic proportion of chaotic trajectories (at infinite time), as estimated from the exponential decrease, over t = 1200 time units, of the proportion of trajectories identified as chaotic (as described in the Methods and shown in Figure S2). Note that this curve is more noisy than the others, owing to error in estimation of the asymptotic values represented in Fig. S2. For each explored value of dimensionality d , estimations of frequencies of each type of dynamics were made based on 250 trajectories that were run up to t = 1200, as described in the main text.

Fig. S4. Correction of phenotypic lag in the regression of the phenotype on the optimum. (A) Even for a chaotic evolu- tionary trajectory (black line), part of the variation is caused by tracking of the optimal phenotype that moves in response to the oscillating optimum (orange line). This tracking happens with a certain temporal lag (represented by the shaded ˆ interval). (B) By regressing the phenotype xˆt at time t on the optimum θt τ at an earlier time t τ (both projected on the direction of environmental change in the optimum), the lag can be estimated− by maximizing− the R 2 of the regres- sion (marked with a star) with respect to τ, over half a period of optimum oscillation. (C) The relationship between xˆt ˆ and θt τ corrected by the lag is represented for simulated values (dots), together with the corresponding regression line shown− in green. The slope of this line is expected to equal the ratio between the amplitude of the tracking component of phenotype and that of the oscillating optimum.

17 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. S5. Estimating the regression slope from the spectral density. On the x-axis, the regression slope of the phenotype on the optimum (after correction for the lag, as explained in Figure S4) is expected to approximate the ratio between the amplitudes of the tracking component of the phenotype, identified by the linear regression model, and the amplitude of optimum oscillation (as shown in Figure S4C). In the spectral analysis of the phenotypic time series, the peak spectral density can be used to identify the period of the tracking component, which equals that of the oscillating phenotype (as shown in Figure 3C and D). Given that the spectral density at any period equals half the squared amplitude of the trajectory’s oscillation at that period, the amplitude of the tracking component of the trajectories can be estimated from this peak spectral density—as well as the ratio between this amplitude and that of the oscillating optimum. Here we show that this estimation, done for each trajectory independently (points, colored according to the period of optimum oscillation), closely approximates the slope of the regression models. However, this is only possible by interpolating the time-series of phenotype to increase the number of data points and, thus, improve the estimation of the spectral density at the period of optimum oscillation as done by the Fast-Fourier algorithm used here (as described in the Methods). We have made several of these estimations, each time linear-interpolating the time-series to a larger number of timepoints, one extra timepoint at a time up to the double of the original number of points. For each of these interpolated time- series, the peak spectral density was calculated, and the largest of these values (among all interpolated time-series of a single trajectory) was selected to estimate the amplitude of the component of phenotypic evolution that tracks the moving optimum.

18 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. S6. Predictability of evolution in a system of lower dimensionality. Here we replicate the oscillating optimum analyses presented in the main text, but for systems of d = 40. (A) Similarly to results for d = 70, the proportion of trajectories that are chaotic is decreased in relation to that of constant environment for conditions of short periods and large amplitudes of oscillation (complete loss of chaos even occurred for amplitude 5.99 and periods 1.5 and 2). This proportion increased for longer periods as for d = 70, but this increase was not monotonic (compare with Figure (2)). Results for (B) the predictability of chaotic dynamics, (C) relative amplitude of tracking, and (D) variance of chaos, are qualitatively similar to those for d = 70. The dashed lines in A have the same meaning as in Figure (2), and the variables represented in B-D are defined as in Figure 4. We show the average (lines and points) and standard error (shading) over 100 simulations for each combination of amplitude and period of optimum oscillation. The 100 sets of interaction coefficients and initial phenotypes used here were taken arbitrarily from the 250 sets used in constant environment simulations for the same dimensionality.

19 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. S7. Effect of the strength of environmental forcing. We used a version of the model without frequency-dependent selection (interaction coefficients bi j and ai j k were set to zero) to measure how different patterns of optimum oscillation translate into intensities of environmental forcing on the system. Under frequency-independent selection, the evolu- tionary dynamics are led exclusively by the rightmost term in equation (S4). We defined forcing as sˆi (x ) , i.e. the absolute value of the scalar projection of the selection gradient in equation (S4) on the direction of environmental| | change (the diagonal of the phenotype space). This effectively measures the average magnitude of the selection pressure to which trajectories are submitted by the moving optimum. We solved the evolutionary dynamics numerically (as done in simu- lations with frequency dependence) until time t = 200, and computed the average forcing that trajectories experienced under the combinations of amplitudes and periods of optimum oscillation described in the main text. (A) A combina- tion of short periods and large amplitudes of oscillation leads to the strongest forcing scenario. To assess whether this measure of forcing can partly explain our results with frequency-dependent selection, we plotted against it (B) the de- crease in proportion of chaos (relative to a constant environment), (C) the predictability of evolutionary dynamics, (D) the relative amplitude of tracking, and (E) the variance of chaos. The dashed lines in B are the same as in Figure 2, and the variables represented in C-E are defined as in Figure 4. Each point represent the results for a single combination of amplitude and period of optimum oscillation. Points are colored by their respective amplitudes. We show the average (lines and points) and standard error (shading) over 100 simulations for each combination of amplitude and period of optimum oscillation.

20 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. S8. Linear regression of phenotype on the moving optimum against the average speed of optimum oscillation. The average speed of optimum oscillation (calculated from equation (2) as 4 A /T ) is higher for conditions of short period and high amplitude of oscillations. Predictability, relative amplitude of trackingk k and variance of chaos were measured as in Fig.4. We show the average (lines and points) and standard error (shading) over 100 simulations for each combination of amplitude and period of optimum oscillation.

Fig. S9. The repeatability of chaotic trajectories. The ratio of the variance through time of the mean trajectory (mean phenotype averaged across replicates) to the total variance of trajectories (across time and replicates) is shown for each condition of environmental oscillation. We used univariate phenotypic values obtained by scalar projections of the trajectories on the direction of optimum oscillation. The pattern observed is much similar to that of the predictability measured by the R 2 of the linear regression of the phenotype on the optimum (Fig.4 in the main text). Repeatability differs from our measure of predictability because it does not rely on knowledge of the optimal phenotype.

21 bioRxiv preprint doi: https://doi.org/10.1101/222471; this version posted November 21, 2017. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY-NC-ND 4.0 International license.

Fig. S10. The average spectral density of evolutionary trajectories in constant environment describes the typical range of periods at which the phenotype oscillates. Among all explored values of period of optimum oscillation (vertical lines) those that led to reduction in the proportion of chaos in relation to the constant environment (as seen in Figure 2, and here marked by vertical dashed lines) are much shorter than the typical oscillations of the system in constant environ- ment. The mean spectral density (solid wiggly line) and its associated standard error of the mean (shading) were calcu- lated based on the 250 trajectories run in constant environment for d = 70. The spectrum was calculated as described in the main text, for the projection of the phenotypic vector along the diagonal of the phenotype space.

22