Resource competition shapes biological rhythms and promotes temporal niche differentiation in a community simulation

Abstract Competition for resources often contributes strongly to defining an organism's ecological niche. Endogenous biological rhythms are important adaptations to the temporal dimension of niches, but how other organisms influence such temporal niches has not been much studied, and the role of competition in particular has been even less examined. We investigated how interspecific competition and intraspecific competition for resources shape an organism's activity rhythms. To do this, we simulated communities of one or two species in an agent‐based model. Individuals in the simulation move according to a circadian activity rhythm and compete for limited resources. Probability of reproduction is proportional to an individual's success in obtaining resources. Offspring may have variance in rhythm parameters, which allow for the population to evolve over time. We demonstrate that when organisms are arrhythmic, one species will always be competitively excluded from the environment, but the existence of activity rhythms allows niche differentiation and indefinite coexistence of the two species. Two species which are initially active at the same phase will differentiate their phase angle of entrainment over time to avoid each other. When only one species is present in an environment, competition within the species strongly selects for niche expansion through arrhythmicity, but the addition of an interspecific competitor facilitates evolution of increased rhythmic amplitude when combined with additional adaptations for temporal specialization. Finally, if individuals preferentially mate with others who are active at similar times of day, then disruptive selection by intraspecific competition can split one population into two reproductively isolated groups separated in activity time. These simulations suggest that biological rhythms are an effective method to temporally differentiate ecological niches and that competition is an important ecological pressure promoting the evolution of rhythms and sleep. This is the first study to use ecological modeling to examine biological rhythms.


| INTRODUC TI ON
An ecological niche is the particular "space" a species occupies in an ecosystem, comprising a diversity of concepts including the physical environment where it lives, the resources it uses, its interactions with other species, and the adaptations it has evolved to exploit the niche. Both theory and evidence indicate that competition is a major factor which determines species' niches (Caro & Stoner, 2003;Tilman, 2004). Competitors for a resource generally will adjust to avoid each other, differentiating their niches by adapting to utilize different types of resources, thus avoiding the depletion of shared resources (exploitative competition) (Maurer, 1984) as well as costly acts of aggression and territorial exclusion (interference competition) (Amarasekare, 2002).
Time is one dimension which defines a niche. Most species live in environments dominated by a day-night cycle and a seasonal cycle, though other cycles such as tides can also strongly define an ecosystem (Gibson, 1967). A temporal niche is defined by both abiotic elements such as light intensity and temperature (Ouyang, Andersson, Kondo, Golden, & Johnson, 1998;Yerushalmi & Green, 2009), as well as by predictable temporal patterns of other organisms (Castillo-Ruiz, Paul, & Schwartz, 2012). Adaptions for a specific temporal niche include specializations in vision, coat color, temperature regulation, and importantly, biological rhythms, that is, physiological and behavioral traits which cycle regularly according to an internal biological clock. In this article, we consider activity rhythms through the lens of ecological niche theory, viewing them as a way partition niches among competitors and examining how competition shapes the expression of these biological clocks. Time can thus be viewed as a sort of resource or space which is partitioned by organisms in response to competition (Kronfeld-Schor & Dayan, 2003), both interspecific (between different species) and intraspecific (between members of the same species) (Begon, Townsend, & Harper, 2006).
A variety of field studies have observed evidence of temporal partitioning between putative competitors. For example, a community of three sympatric species of insectivorous bats were observed to have activity profiles which are displaced from each other, suggesting that they avoid each other (Kunz, 1973). While Argentinian pampas foxes are normally nocturnal, they show a modified half-nocturnal half-diurnal profile in a region where they overlap with crab-eating foxes (Di Bitetti, Di Blanco, Pereira, Paviolo, & Pírez, 2009). Other examples of apparent temporal partitioning have been seen at watering holes (Adams & Thibault, 2006;Valeix, Chamaillé-Jammes, & Fritz, 2007), in desert gerbils (Ziv, Abramsky, Kotler, & Subach, 1993), carabid beetles (Kamenova, Tougeron, Cateine, Marie, & Plantegenest, 2015), and large African carnivores (Hayward & Slotow, 2009). Stronger evidence comes from seminatural manipulation experiments. Common spiny mice are nocturnal and golden spiny mice are diurnal in areas where the two species coexist, but when the common spiny mice are experimentally removed, the originally diurnal golden spiny mice shift into nocturnality, suggesting that this species was pushed into diurnality by the competing species (Kronfeld-Schor & Dayan, 2003). It should be recognized that these examples all occur at the behavioral and ecological timescale, that is, they are "temporary" displacements from the species' genetically determined preferred activity time. Although certain pairs of taxa are suggestive of evolutionary-level temporal partitioning-nocturnal owls and diurnal hawks, for instance, or the hypothesized nocturnal origin of mammals (Heesy & Hall, 2010)-the role of competition in causing these evolutionary divergences is near impossible to establish conclusively. Nonetheless, it is probable that temporal shifts at the behavioral/ecological level cause selection for alleles suited for the new time period, eventually translating into long-term changes at the genetic/evolutionary level.
In this work, we explore ways in which competition in ecological niche theory can be applied to biological rhythms, using agent-based simulation of a community of two species who compete for limited resources in an environment. We first demonstrate that circadian rhythms are a form of niche differentiation, which allows two species to stably coexist without competitive exclusion, and that two rhythmic species will quickly differentiate their circadian phases to avoid competition. We show that arrhythmicity is preferred when there is no interspecific competitor present, but the presence of interspecific competition greatly facilitates the development of strong activity rhythms. Finally, we show that if organisms have assortative mating based on circadian timing, then intraspecific competition can drive the division of one population into two mating groups, contributing to speciation.

| Environment and organisms
A community of two species in an environment was simulated using Python (code available at https://datad ryad.org/stash/ datas et/ doi:10.5061/dryad.gf1vh hmmj). The environment consisted of 60 spaces, where each space may contain a resource, contain an individual organism, contain multiple individuals, or be empty (Figure 1a).
An individual moves by jumping to another random space, and if it moves to a space which contains a resource, the resource is consumed. Six hundred resources per day are added randomly to the K E Y W O R D S biological rhythms, circadian rhythms, competition, ecological modeling, sleep, speciation, temporal niche spaces of the environment at a constant rate. These resources can represent food but can also represent resources in general including water, territory, and the access to those resources.
An organism's amount of movement varies across the day following a circadian activity rhythm, which is modeled as a cosine wave with two parameters: amplitude, ranging from 0 to 1, and phase angle, ranging from 0° to 360° (Figure 1b). The number of moves performed between times t 0 and t 1 is: where m is the number of moves, M total is the total number of moves per day = 20, A is the amplitude, and φ is the phase angle. The number of moves were calculated in 10 time steps per day (t 1 -t 0 = 36). We believe a sinusoidal activity rhythm is a reasonable approximation, and a more flexible activity pattern would in fact make temporal segregation easier to achieve. Though an organism's activity profile varies according to its circadian rhythm parameters, the total number of moves is fixed at 20 moves per day; we hold total movement and energy expenditure constant so that the primary variable of interest is the timing of movement. Each animal has the capacity to store energy; 2 units of energy is expended per day for movement and metabolism, and 0.5 energy is gained when the animal consumes a resource (Figure 1c). Animals die if their energy reaches zero, or if they reach 12 days of age.
Values for arena size, energy expenditure, resource value, and death age are somewhat arbitrary and were chosen at reasonable numbers which limited computational load (mostly determined by population size).

| Reproduction
Depending on the scenario, simulations are run either with one or two species in the environment. Throughout the day at a constant rate, pairs of animals belonging to the same species are randomly chosen to mate. The probability of an individual being chosen for mating is proportional to its energy; animals which have acquired more energy thus tend to have better fitness. During each mating, one offspring is produced, to whom each parent donates 1/3 of its energy. In some scenarios, the circadian amplitude and phase of all animals remain fixed at the same values, while in other scenarios, there is variation in the circadian parameters, which are acted on by natural selection to cause evolution. In the case of variable parameters, the child's amplitude is the mean of the parents' ±0.04 SD, and the child's phase angle is the circular mean of the parents' ±0.04*360° SD (Figure 1d). Matings occur at a frequency such that the population of animals would increase by 10% each day if no animals died. In our two-species simulation scenarios, when not testing The environment consists of 60 spaces, which are occupied by resources and moving organisms of one or two species. (b) Activity profiles are modeled as cosine waves with two properties, amplitude and phase angle. Two example profiles are shown. Regardless of changes in circadian parameters, the number of moves per day is fixed at 20 (equivalent to the area under each curve). (c) Individuals gain energy when consuming resources and expend energy on movement, metabolism, and reproduction. Reproductive fitness is proportional to an individual's stored energy. (d) Offspring's amplitude and phase-angle parameters are the mean of the parents and receive 1/3 of the stored energy from each parent. If testing trait evolution, a small normally distributed variance ε is added to the offspring's traits. (e) For some simulations, we added a specialization parameter, representing evolutionary adaptations to a specific time of day. Resource acquisition is more efficient at circadian peak hours and less efficient at the circadian trough. (f) For some simulations, we added assortative mating to test speciation. Individuals only can mate with others who have similar phase angles, and the probability of two individuals mating is proportional to how much their mating windows overlap competitive exclusion, we stabilized the population levels so that random population fluctuations would not cause one species to disappear by chance. For this, a target population ratio was set (usually 1:1), and the species with a population below target reproduces slightly more, and the species with a higher population reproduces slightly less, proportional to the difference in population. When testing the effect of uneven population sizes on amplitude strength, the population ratio was set to 2:1 and 9:1.
For each species, r adj. is the adjusted population growth rate, which depends on the default growth rate r = 0.1, k is the target fraction of the population which is composed of this species (k = 0.5 for a 1:1 ratio), p is the population of the this species, and P total is the population of all species. The number of progeny in a time step t 0 to t 1 is thus: These were calculated in 10 time steps per day (t 1 -t 0 = 36°).

| Specialization
Besides circadian activity rhythms, organisms evolve physiological and behavioral traits to specialize for a certain time of day. These adaptations make resource acquisition more energy efficient during their specialized hours, but often at the cost of less efficient activity during nonspecialized hours. We introduced a specialization term to model this, such that the efficiency of gathering resources varies over the day according to a cosine wave and that the peak time of efficiency coincides with peak time of activity ( Figure 1e).
where E adj. is the energy acquired from a resource adjusted by specialization, E orig . = 0.5 is the normal energy value of a resource, S is the specialization value, t is the time, and φ is the organism's phase angle.
Thus, for example when S = 0.2, the organism acquires 20% more energy from a resource at its circadian peak and 20% less at its circadian trough.

| Assortative mating
To study speciation, the standard simulation parameters were modified to model assortative mating. We assume that mating must occur in a 9-hr (135°) time window which is fixed relative to the organism's overall phase angle, and the probability of mating between two individuals is proportional to the amount of overlap of their mating windows, ranging from 0 to 1 (Figure 1f). In other words, individuals which have a phase difference of nine hours or more do not mate, and the probability of mating increases linearly as the phase difference approaches zero. We define a "cross-group mating" metric (CGM) to measure reproductive segregation in the population. To calculate this, we first define an overlap matrix of mating windows, that is, the matrix where each cell M ij is the mating-window overlap between individuals i and j. K-means clustering is used on the overlap matrix to define two clusters of individuals. The CGM is the mean of the overlap values between individuals of different clusters; this is equivalent to the probability that a given mating is between individuals from different clusters. Cross-group mating of 0 thus indicates complete reproductive isolation of two groups. If an organism encounters a resource, it consumes that resource and gains energy, which is in turn used for movement, basal metabolism, and reproduction ( Figure 1c). Death occurs if an individual's energy drops to zero or if the individual reaches an age limit. Organisms reproduce sexually, and the probability of an individual reproducing is proportional to its energy. During reproduction, the resulting offspring's amplitude and phase are the means of the parents' traits.

| Methods summary
When testing the evolution of a trait, the offspring's trait is the parents' mean plus or minus a small random variance (Figure 1d), which naturally results in natural selection and evolution.

| Rhythmic activity prevents competitive exclusion
The competitive exclusion principle asserts that two species cannot occupy the same ecological niche indefinitely; if two species exist in exactly the same niche, then one species will eventually outcompete the other and become the sole occupier of the niche. We modeled this scenario by simulating two species with no circadian rhythms, that is, with amplitude = 0. The two species are constantly active at a moderate level and thus have no differentiation of temporal niches.
In this situation, one species invariably dies out (Figure 2a

| Character displacement of phase angle
Having shown that being active at opposite phases is favorable for the coexistence of two species, we ask whether species can evolve over time to reach such a state of temporal separation. When two similar species occupying similar niches are found in the same geographical area, the differences between them tend to become accentuated in order to distinguish their niches, in a phenomenon known as character displacement (Grant & Grant, 2006). We tested whether two circadian-rhythmic species would display character displacement on a temporal axis. In this scenario, all individuals started with approximately the same phase angle at the beginning of the simulation, and the offsprings' phase angles were allowed to vary and thus evolve, while amplitudes were fixed at 1.
The two species' phase angles of activity did indeed diverge over time in the simulation (Figure 3a). After starting at 0° separation, the mean phase-angle difference between the two species grew and eventually reached the maximum of 180° and remained so thereafter (Figure 3b). The source of selective pressure is the difference in resource availability between peak and peak-adjacent times. During times of peak activity, available resources are quickly consumed and resource density is thus very low, while in times adjacent to the peak, less resources are consumed, and resource density is higher (Figure 3c). The result of this time-resource gradient is that individuals whose phase angles are at the edges of the population distribution have access to a more resource-dense environment and thus gain more energy (Figure 3d). Since stored energy is proportional to reproduction probability, the individuals at distribution's edges reproduce more, and the species' mean phase angle is shifted.

| Intraspecific competition causes temporal niche expansion by arrhythmicity
Previous work has shown that when interspecific competition is absent, the population's niche width tends to expand, as competition within the species pushes individuals to exploit a greater range of resources (Sjödin, Ripa, & Lundberg, 2018). We tested whether this pattern would be true for the temporal niche. Indeed, when rhythm amplitude was allowed to vary, the amplitude steadily decreased to near-zero levels, representing the transition from a temporal specialist to a generalist strategy. To clarify, a broad circadian niche does not necessarily imply the absence of sleep or sleep-like rest; these organisms could follow a cathemeral pattern in which sleep is scattered throughout the day.

F I G U R E 2
Circadian rhythms prevent competitive exclusion. (a) When two species with no activity rhythms (amplitude = 0) are placed in the environment, one species will always die out. An example of an individual trial is displayed. (b) Summary of 40 trials. Since the two species' population levels tend to be symmetric, only the species which is excluded is plotted for clarity. The trials were sorted by the day that competitive exclusion is reached, and the median (20th) trial is represented by the dark line, while the 4th, 12th, 28th, and 36th trials are represented by faint lines. (c) When two species have circadian rhythms (amplitude = 1) and are active at the same time of day, one species will always die out, as before.  adaptations allow an animal to acquire more resources per unit energy expenditure during their specialized "on" phase, but often at the cost of being less efficient during their "off" phase. A temporally specialized organism would thus incur costs when adopting a generalist activity rhythm. To model these temporal adaptations, we added a specialization term to the simulation. The degree of specialization over the day follows a cosine wave such that at specialization = 0.1, an animal acquires an additional 10% energy from consuming a resource during its circadian peak and 10% less energy during the trough. For simplicity, we assume that the phase angle of the specialization wave matches exactly that of the cosine wave of circadian activity, as opposed to modeling them as separate phenotypes, which would naturally converge to match phase angles anyways so that organisms are most specialized when they are most active.
We found that specialization must be quite high to overcome competition's negative selection for amplitude (Figure 4). At low levels of specialization, the equilibrium amplitude is positively correlated with the degree of specialization. Only when specialization is at least 0.75 does the resulting amplitude approach 1 (Figure 4c). This is rather intense specialization, indicating that resource acquisition is seven times more efficient during the peak than during the trough. This suggests that, in an environment where resource availability is roughly constant throughout the day, intraspecific competition is a strong factor selecting for arrhythmicity.
When a population is freed from competition, the subsequent niche expansion could occur through increasing the niche width within individuals, or through increasing the variance between individuals who are still relatively specialized. Whereas low rhythm amplitude represents within-individual niche expansion, we also observed between-individual niche expansion, represented the greater range of phase angles when amplitude is high (Figure 4d).
When amplitude is low, there is no selective pressure to promote interindividual variance, so sexual reproduction pulls the population toward the mean.

| Intraspecific competition allows rhythmicity to develop
While intraspecific competition acts to prevent rhythmicity, we asked whether a competitor species would cause rhythmicity to develop. When specialization = 0, organisms did not show a trend toward either high or low rhythmicity (Figure 5a). Since the two spe- The final equilibrium amplitudes depend on relative population numbers. When the blue species is twice as numerous as the orange, its final amplitude remains lower than the orange's. (d) When the blue species is nine times as numerous as the orange, blue's amplitude remains low while orange's is high around 0.7 (Figure 5c). If species A is set to be nine times as numerous as species B, species A's amplitude remains only at 0.2, demonstrating that intraspecific rather than interspecific competition is the much stronger force in determining its equilibrium amplitude.
This also demonstrates that a dominant species which has even mild rhythms can strongly determine the rhythms of minor competitors which have smaller populations. In total, these results suggest that the presence of competitors is a strong factor promoting the expression of biological rhythms.

| Population splitting by differentiation of phase
The single-species scenario illustrated that intraspecific competition causes expansions in both within-individual and between-individual niche widths. Could an increase in between-individual variation cause the population to split into two distinct groups? This would in effect cause speciation, or at least contribute strongly to the ecological divergence and reproductive isolation which are precursors to full speciation. To test this, assortative mating was introduced to the model. Individuals only mate with a partner whose phase differs by less than 9 hr (135°), and the probability of choosing a given partner increases linearly as the phase difference decreases to zero.
Amplitudes were fixed at 1 for this test.
We found that, with the addition of assortative mating, the population did indeed segregate into two groups (Figure 6a). We defined a cross-group mating value (CGM) to quantify reproductive isolation, where low CGM indicates high reproductive isolation.
The CGM tended to stay constant for some time and then drop suddenly ( Figure 6b). This suggests that there is a threshold effect, such that once the conditions occur for a secondary population to escape "gene flow" with the main population, full reproductive isolation quickly follows. To separate from the main population, there must be enough individuals at the far edges of the phase distribution to sustain a "breeding population," such that a tipping point is reached where individuals in the incipient secondary population become more likely to breed within its own population rather than the main population. Once this tipping point is reached, the secondary population quickly splits off from the main group. Given the random nature of mate selection and progeny's phase variance in our model, the conditions where this happens occurs stochastically, explaining the large variance in speciation time in the simulations.
Population splitting was not guaranteed for all parameter settings. Conditions necessary to achieve speciation in this model are somewhat constrained, which is unsurprising given the high barriers to sympatric speciation in nature (Via, 2001). The time-resource gradient must be quite strong to reach the necessary levels of density-dependent disruptive selection, and thus, population splitting will not occur for low resource regeneration rates or low-population levels. A smaller mating window of course also promotes reproductive isolation. Higher variance in offsprings' phases also promotes reproductive isolation by increasing the chance of a breakaway group to escape "gene flow" with the rest of the population. A long lifespan also favors speciation, since individuals at the edges of the distribution then have more time to build up an energy surplus.

| Population splitting versus individual expansion
Intraindividual niche expansion will tend to oppose speciation, since a decrease of rhythm amplitude would weaken the time-resource gradient and broaden mating windows. Conversely, speciation into two populations occupying opposite niches will remove selective pressure for broad individual niches since the time-resource gradient would be erased (analogous to the last case in Figure 3c). Faced with intraspecific competition, which of these two mutually exclusive paths will a population take? Results suggest that it depends heavily on the relative flexibility of the amplitude or phase traits.
We set standard deviations of phase angle and amplitude to various test values, with a higher standard deviation resulting in quicker evolution of that trait. When phase standard deviation was high and amplitude standard deviation was low, populations were more likely to speciate; conversely, when phase standard deviation was low and amplitude standard deviation was high, populations tended to become arrhythmic (Table 1). This is the first modeling study to how selective pressure from other organisms favors the evolution of biological rhythms. While other modeling studies have examined the "internal" forces which make rhythms and sleep physiologically efficient (Hellwegera, 2010;Schmidt, 2014;Schmidt, Swang, Hamilton, & Best, 2017), none have looked at interindividual interactions.

| Timescales of analysis
Though we framed our model in terms of organisms evolving genotypically over time, niche partitioning can equally occur at the timescale of individual behavior or ecological community (Mrosovsky & Hattar, 2005), and the conclusions of this study can easily be generalized to subevolutionary timescales and mechanisms. Many animals are known to switch their temporal niches depending on various environmental factors (Hut et al., 2012); for example, the aforementioned studies on minks, spiny mice (Gutman & Dayan, 2005), and foxes (Di Bitetti et al., 2009) (Baron & Reid, 2014;Ouyang et al., 1998;Rüger & Scheer, 2009) suggests clear selective mechanisms by which behavioral displacements can translate into genetic/evolutionary changes.
The simulation was framed in terms of circadian rhythms, but the results could equally apply to other endogenous biological rhythms like seasonal (circannual) rhythms. A major difference between the daily and seasonal timescales is that individuals can adjust their daily behavior to a new time through nongenetic mechanisms, whereas this is probably less common at longer timescales, though it certainly depends heavily on the particular mechanisms governing these rhythms.

| Competitive exclusion and character displacement
In our model, we demonstrated that competitive exclusion is unavoidable if two species share an ecological niche. Two species which are temporally separated are much more likely to coexist for extended periods of time. Additionally, we show that two circadianrhythmic species which initially are active at the same phase evolve to be active at opposite times of day in order to avoid competition for resources. The most likely direct natural analog of this scenario is the introduction of a new species to a region already occupied by another similar species. This could happen, for example, through the breakdown of geographical barriers, chance migration to a new area (Lomolino, 2000), introduction by humans, or climate changeinduced range shifts (Thomas, 2010). The invasive American mink in the United Kingdom offers a good real-life example: Originally nocturnal when first introduced, the mink largely switched to diurnality when the native otters and polecats recovered their population levels (Harrington et al., 2009). The previously mentioned studies in Argentinian foxes (Di Bitetti et al., 2009) and desert spiny mice (Kronfeld-Schor & Dayan, 2003) also demonstrate niche switching.

| Intraspecific competition and niche expansion
Intraspecific competition is hypothesized to increase the niche width in a population, especially in situations where a population is released from competition from other species, which could occur after migration or introduction to a new region, for instance (Lister, 1976;Bolnick, 2001). Our single-species simulations demonstrate this phenomenon for temporal niches.
Niche expansion can happen either by increasing the variance of resource type usage between individuals (Svanbäck & Bolnick, 2006;Van Valen, 1965) or by increasing the range of resource usage of each individual (Bolnick et al., 2010). Interindividual expansion appears to be the more common pattern in nature in general (Bolnick, Svanbäck, A few studies in fish have observed offset patterns of diel feeding activity between individuals, with larger dominant individuals feed at preferred times while subordinates being pushed to other times (Alanärä, Burns, & Metcalfe, 2001;Reebs, 2002). This suggests that preexisting heterogeneities in the population such as social dominance could predispose niche expansion to occur between rather than within individuals. We are aware of only one study to observe temporal niche expansion in the wild; American minks which were introduced to a remote island with no competitors were observed to have expanded temporal niches compared to their mainland counterparts (Crego, Jiménez, & Rozzi, 2018); it is unknown whether this was due more to inter-or intraindividual expansion. Intraspecific competition is also likely to play a role in instances of temporal niche expansion after release from predation (McCauley et al., 2012).
Predator-free space may be seen as a type of resource, which becomes more abundant after removal of the predator. Though never specifically examined, it is reasonable to suspect that intraspecific competition could then drive the subsequent niche expansion observed after predator release.
Arrhythmic/cathemeral activity patterns appear to be somewhat common in nature (Roll, Dayan, & Kronfeld-Schor, 2006;van Schaik & Griffiths, 1996). However, besides the aforementioned observation of invasive minks (Crego et al., 2018), there have not been any other experiments or observations to directly test competition's role in causing temporal niche expansion. We suggest that this phenomenon is not uncommon and may explain the behavior and evolution of a number of these arrhythmic animals.

| Competition facilitates emergence of rhythms
The presence of an interspecific competitor erases the advantage that arrhythmicity had in a single-species scenario. A small amount of time-of-day specialization (theoretically, any amount of specialization) can then cause organisms to evolve high amplitudes. We only modeled exploitative competition here, where fitness differences were only driven by differential access to resources. If interference competition were also present, for example if a cost was incurred every time an individual encountered an allospecific, then development of rhythm amplitude would most likely occur even more quickly.
As previously mentioned, the comparison between invasive minks on an island and mainland minks is an instance of apparent competition-mediated niche expansion/contraction (Crego et al., 2018), but we are not aware of any studies which has observed competition inducing increased amplitude. Again, we believe this phenomenon does exist broadly, but has simply not been observed yet. Another potential real-life analog is if two arrhythmic species existing in a constant environment-cave-dwelling fishes for example (Kavanau, 1998)-are suddenly exposed to a cycling environment and are thus pushed to temporally differentiate.

| Speciation
When individuals were limited to mating with other individuals who were active at similar times of day, intraspecific competition could cause a single population to separate into two groups which were largely reproductively isolated, in effect causing speciation. This is specifically a case of sympatric speciation, in which new species arise without geographic separation. Speciation required high levels of density-dependent selection (i.e., a strong time-resource gradient) to occur. This is not surprising given that sympatric speciation in general is believed to be quite difficult to achieve in nature, such that its existence at all was questioned before recent decades (Via, 2001).
A theoretical problem against sympatric speciation is that the phenotype which improves fitness usually has no effect on mate choice, and thus even when disruptive selection exists, there is no mechanism for it to translate to mating preferences. However, speciation by time (allochronic speciation) has an advantage here because it is a "magic" trait (Servedio, Doorn, Kopp, Frame, & Nosil, 2011), that is, it has fitness effects which are acted on by natural selection, and it is also directly responsible for assortative mating.
A recent review (Taylor & Friesen, 2017) finds good evidence for dozens of allochronic speciation events, with most cases occurring at the seasonal rather than the circadian time span, but although intraspecific competition is known to play a role in promoting speciation in general (Bolnick, 2004;Laland & Sterelny, 2006), it is unclear how important intraspecific competition was in these specific cases of allochronic speciation. In a study of Madeiran storm petrels, the authors hypothesize that competition for food and nest space may have led to allochronic separation into hot-and cool-season breeding populations (Monteiro & Furness, 1998). Besides competition, allochronic speciation can occur by other reasons too, such as temporal isolation (Hendry & Day, 2005), environmental changes (Yamamoto & Sota, 2012), or a founder effect (Santos et al., 2007); temporal separation can also be secondary to another adaptation (Ragland, Sim, Goudarzi, Feder, & Hahn, 2012) or serve to reinforce reproductive isolation. Intraspecific competition can act alongside these other mechanisms to produce allochronic speciation.

| Sleep
The question of why sleep exists is one of the big questions of biology. Traditionally framed something of a paradox that an animal would abandon motor and sensory activity for several hours per day, it is perhaps not so mysterious after all when considering that temporal niches exist. External pressures, whether they be competition or other environmental forces, push animals to specialize for a time of day. Internal pressures, such as energy conservation (Siegel, 2009), the need to perform restorative functions, and the separation or coordination of clashing or synergistic physiological processes (Baron & Reid, 2014;Schmidt, 2014;Schmidt et al., 2017), also encourage the evolution of sleep, or at least a rest period. Especially with external and internal pressures combined, sleep/rest appears to be an unsurprising evolutionary consequence. Stated colloquially, "if I can't be active right now, then I might as well rest. If rest is efficient, then I might as well do it when I can't be active." As to why a defined sleep state exists rather than simply circadian-mediated inactivity, we propose that true sleep can be viewed as an adaptation to delay rest. Urgent circumstances sometimes interrupt an animal's regularly scheduled rest, and thus, the defining feature of true sleep, sleep homeostasis ("sleepiness"), encourages animals to later pay back the lost rest. Another feature of true sleep is that it is a relatively distinct mode with a well-defined sleep-wake boundary. In unpredictable environments, such a clear distinction allows animals to maximize rest when the opportunity is available, rather than a slow transition between rest and sleep.

| Methodology and future directions
We intentionally created a model without distinct day and night phases, so that it would be more generalizable to a variety of hypothetical conditions. Nevertheless, for most organisms, the changes between day and night represent a major division in the environment (van Schaik & Griffiths, 1996), and thus, alternative models may explicitly include this. Activity patterns other than cosine waves, or testing the variable of daily total activity, could also be interesting.
We decided not to use a genetic model of circadian rhythms, opting instead to model only phenotypes with a constant distribution. We do not believe this is a weakness because it is more or less equivalent to a situation of polygenic inheritance with many genes.
However, a genetic model may have some advantages such as allowing a clearer look at population genetics. Additional models have been developed to explain the theoretical benefits of sleep and circadian rhythms from the point of view of internal physiological organization (Schmidt, 2014;Schmidt et al., 2017), and it could be interesting to integrate models of these "internal" benefits of rhythms with the "external" ecological benefits modeled here.

ACK N OWLED G M ENTS
Vance Gao was supported by a NIH T32 grant (HL 007909) and the I-SITE ULNE ERC Generator grant.

CO N FLI C T O F I NTE R E S T
The authors report no conflicts of interest.

O PE N R E S E A RCH BA D G E S
This article has been awarded Open Materials, Open Data Badges.

DATA AVA I L A B I L I T Y S TAT E M E N T
The Python code and all relevant data for this project may be found