{'fraction_non_alphanumeric': 0.03621911304535482, 'fraction_numerical': 0.009855051613135274, 'mean_word_length': 4.69054441260745, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Explicit probability of fixation formula for mutual competitors in a stochastic population model under competitive trade-offs

We study the probability of fixation in a two-species stochastic competition model by analyzing the associated backward Kolmogorov equation (BKE). Using an assumption that fitness differences occur on a naturally arising small scale, we derive an approximation to the BKE that exploits both the small fitness differences and a fast timescale within the dynamics. Our approximation allows us to analytically find an explicit formula for the probability of fixation, through which we can easily examine the effects of parameter changes. Finally, we use our result to study fitness tradeoffs within a competitive environment and show that certain tradeoff strategies are beneficial while the population exists at high frequencies, but harmful at low frequencies, and vice versa. As a specific biological example, we show that our results agree with the invasion strategy of {\em Salmonella Typhimurium}.

The difference in competitive fitness between two species competing for the same ecological niche is often very small [20,21]. On the other hand, fitness differences have substantial effects on the outcome of such competition. An important principle in evolutionary theory that affects competitive fitness is that of tradeoffs: one trait cannot increase without another decreasing [32]. For example, Salmonella Typhimurium expresses a virulence factor that bolsters their defense against the mammalian immune response at the cost of reduced growth rate [38,16,43]. Extracellular polymeric substance-producing cells in Vibrio cholerae populations allow for cells to bind together in biofilms and enhance the competitive fitness of their clonemates against non-producers, but this at the cost of reduced dispersal ability [28]. The algae species Chlorella vulgaris similar demonstrates a tradeoff between defense against grazing rotifers and ability to compete for resources [42,23]. In each example, one component of the species' competitive fitness is sacrificed in favor of another. We aim to study such tradeoffs theoretically, building on recent mathematical tools.
Deterministic mathematical modeling struggles to capture the effects of small fitness changes. In the classic Lotka-Volterra competition model, the outcome of a competitive interaction between two species is entirely determined by model parameters and initial conditions. Consequently, this theory predicts that a small invading population with a small competitive advantage will never outcompete an established population, a result that is at odds with empirical evidence [2,39].
Both classic and modern theoretical work in stochastic population genetics has focused on competition with a constant total population size, most notably using Wright-Fisher or Moran processes [19,22,1,11,34,35,9,10,12] Recent emphasis has been given to models that relax the constant population size assumption, and describe ecological competition using Markov chains or stochastic differential equations [27,4,18,3,5,6,8]. Such stochastic models have the inherent advantage over their deterministic counterparts that the result of competition is determined only up to a probability distribution, allowing for a more nuanced investigation into the effects of model parameters. The probability that one population outcompetes the other, often called the probability of fixation, is therefore a central quantity in these studies. An important technique in analyzing multidimensional stochastic systems is dimension reduction. One successful method of dimension reduction involves identifying slow and fast manifolds of the system, then collapsing the dynamics onto the slow manifold along the fast manifold [7,5,31].
Following these recent studies, we investigate the probability of fixation and average time to fixation in a stochastic competition model with fluctuating population size. We identify a natural slow timescale defined by a single model parameter, and exploit the fast time scale to derive an approximation to the backward Kolmogorov equation that allows us to calculate an explicit expression for the probability of fixation as a function of the initial frequency of the competitive populations. We use our approximation to investigate the effects of fitness differences on fixation probability and on the average time to fixation. We then explore the effects of competitive tradeoffs by coupling model parameters and show that the predictions produced by the model agree with the invasion dynamics of Salmonella Typhimurium. Our results provide a quantification of the effects of small parameter changes in a competitive system that cannot be captured by deterministic dynamics.

Model
We consider the classic Lotka-Volterra competition model between two species, denoted X and Y , as a Markov process. The dynamics are defined by mass action kinetics. In particular, both species reproduce and die constant rates given by Inter-and intraspecific competition rates defined by These mass action kinetics can be expressed as a continuous time Markov process with transition rates where P ± s (N x , N y ) denotes the transition rate of population s ∈ {X, Y } to increase/decrease by one assuming that X = N x and Y = N y . The parameter M is assumed to be large and controls the stationary population size [18,8].
Our goal is to quantify the effects of small fitness differences between the two competitive species on their respective probabilities of fixation; that is, the probability that one species goes extinct while the other persists. To this end, we will hereafter assume that f x = f y +f = f +f , α y = α x +α = α +α, d x = d y = d, and K x = K y = K, where λ and µ are small and all parameters are positive except for potentiallyf andα. The fitness difference between species X and Y is therefore assumed to stem from unequal growth and interspecific competition rates, while death and interspecific competition rates are assumed to be equal between competitors. Moreover, we define the rescaled, approximately continuous variables x = N x /M and y = N y /M . Reaction rates 12 expressed in terms of these new variables are given in Supplementary Information Section 1.
The process defined by reactions 12 can be expressed concisely as a master equation (see Supplementary Information Section 1). For M large, the master equation can be approximated by the forward Kolmogorov equation (FKE; see Supplementary Information Section 1) [14]. From this FKE, the usual deterministic Lotka-Volterra competition model can be recovered: where the dot over the variables on the left hand side represents the derivative with respect to rescaled time τ = M t. Note that the deterministic system does not otherwise depend on M , and in this way M defines a natural time-scale for the dynamics. System 4 is a classic starting point for many mathematical models of ecological competition [37,40,41,43]. Under fairly general parameter conditions, system 4 has four equilibria in the nonnegative quadrant: (x, y) = (0, 0), ((f +f )K, 0), (0, f K), and (x * , y * ), where both x * and y * are positive (see Fig 1). Straightforward linear stability analysis reveals that if α(α +α) < 1/K 2 , the interior equilibrium (x * , y * ) is asymptotically stable, and competition beginning with positive x and y always results in coexistence. If, on the other hand, α(α +α) > 1/K 2 (that is, interspecific competition is stronger than intraspecific competition), then the interior equilibrium is a saddle point, while the two single-species steady states ((f +f )K, 0) and (0, f K) are both stable. The outcome of competition in this case is determined entirely by which side of the stable manifold (called the separatrix, given by the dark blue curve in Fig  1) the initial conditions (x 0 , y 0 ) are on (see example trajectories in Fig 1). The stable manifold of the deterministic Lotka-Volterra competition model 4 varies continuously with parameters, meaning small changes in parameters yield small changes in the shape and position of the curve. Consequently, small competitive advantages can have negligible effects on the mathematical model, especially when considering competition between an established population and a small invading cohort, while such advantages can in principle play very important roles in nature.

Backward Kolmogorov equation
Our primary goal is to determine the probability that one species outcompetes the other by driving it to extinction. To do so, we consider the backward Kolmogorov equation (BKE; see Supplementary Information Equation 5). Given appropriate boundary conditions, steady state solutions of the BKE give the probability that either species goes extinct while the other persists, which we call the probability of fixation, given the initial conditions x = x 0 and y = y 0 [14,29,8]. To ease calculation and interpretation, we follow [8] and define the variables z = x + y and p = x/(x + y), then rewrite the BKE in terms of z and p, given by Supplementary Information Equation 6.

Dimension reduction
Fitness differences between species competing for the same niche are often small [20,21]. We therefore assume that the fitness difference parametersf andα are small. In particular, we assumef = λ/M ,α = −µ/M , and α − 1/(2K) = A/M . The competition rate parameter is chosen to be negative for future convenience. The last assumption requires the difference between inter-and intraspecific competition rates be small. With these assumptions, the BKE can be written up to order O(1/M ) by With the small-difference assumptions on model parameters above, the deterministic system 4 can be written in terms of p and z as follows: The dynamics of system 6 occur on two timescales: the fast dynamics of order O(1) and the slow dynamics of order O(1/M ). Dropping the slow dynamics, the system reduces to the one This indicates that the system approaches the manifold defined by x + y = z = 2K(f − d) before competitive dynamics play a significant role. Moreover, simulations of the Markov process given by equations 12 show the state variable z quickly approaches the value 2K(g − d), while p remains nearly constant (see Fig 2). The probability of fixation therefore likely does not depend heavily on the initial value of z, and we consequently set u z = u zz = 0 (for similar methods, see [3,6,27]). With this final approximation, the BKE we consider is  Figure 2: Sample trajectories of stochastic LV model. All simulations are implemented using a Gillespie algorithm [13,15].
. The probability of fixation for species x is then approximated by solutions to the boundary value problem Integrating equation 8 twice, we find which can alternatively be written in terms of error functions as follows From either form 9 or 21, it can be seen that in the "neutral" case, (with λ = µ = A = 0, the probability of either population fixating is equal to that species' initial frequency: u(p) = p. This agrees with past work [8]. Another form of neutral competition is characterized by µ = λ = 0 with A = 0. In this case, both species grow at the same rate and have the same competition rates, but the inter-and intraspecific competition rates differ. The fixation probability u(p) is plotted for varied λ, µ, and A in Figure 3. Unsurprisingly, increasing λ results in a uniform advantage for population X over all initial proportions p, as does increasing the rate at which X kills Y , corresponding to negative µ values. This can be seen analytically in the A = 0 case by taking the second derivative of u(p) (See Supplementary Information Section 3). When A = λ = µ = 0, the probability of fixation is the identity line, u(p) = p. When A > 0 and µ = λ = 0, u(p) is an s-shaped curve, lowering the probability of fixation for initial frequencies of p < 0.5 and increasing the probability for p > 0.5 compared to the neutral (A = 0) case.

Mean time to fixation
The average time to fixation is an important quantity in ecological processes [26,30,25,17,9]. We can use equation 9 to approximate the average time for X to fixate given that it outcompetes Y . This quantity is given by where T (p) satisfies the boundary value problem (see Supplementary Information for details). Figure 4 shows examples of numerically generated solutions of boundary value problem 11 over varied λ, µ, and A.
For the above analysis, we assume that the system starts on the manifold defined by z = 2K(f − d). Starting away from this manifold causes the average time to fixation to increase by approximately the average amount of time it takes the system to reach

Fitness trade-offs: Salmonella Typhimurium
We now use our results above to study the effects of fitness tradeoffs. We focus on tradeoffs between growth rate and interspecific competition rates by writing µ = ρλ. Increasing growth rate consequently comes at a cost of diminished competitive fitness, and vice versa. Any tradeoff between these rates is likely not one-for-one, and the parameter ρ > 0 allows us to modulate the relative change between the two parameters. For ρ very small or large, the resulting effects on the probability of fixation should closely match those in the uncoupled case ( Figure 3). In particular, for ρ small, increasing λ will result in an increase in the growth rate with little negative change in µ, resulting in an overall competitive advantage for X. On the other hand, for ρ large, increasing λ will result in a substantial loss in the X populations's competitive ability, causing a disadvantage for X. For intermediate ρ, however, the effects of the tradeoff become more complicated. By differentiating u(p) with respect to λ, we can determine the range of ρ over which increasing λ has a non-uniform effect on the probability of fixation over varied initial proportion p (see Supplementary Information Section 5). Choosing such a ρ, the probability of fixation for small, positive λ results in a higher probability for small p, but a lower probability for large p.  Figure 5 shows the probability of fixation of population X over initial proportion p for varied λ, with µ = ρλ and ρ = 0.2. For λ > 0, X gains an advantage for small p relative to λ = 0, but loses this advantage for large p. For λ < 0, the opposite is true. This implies that advantageous competitive strategies depend on the initial frequencies. Biologically, this could correspond to whether a population is invading a new environment with a small initial population, or defending with a large established population.
A known example of a species that changes competitive strategies throughout competition is the bacterial species Salmonella Typhimurium. These bacteria exploit the immune response of mammalian hosts to displace native commensal microbiota from the intestinal wall, on which they colonize and grow [36,33,38,43]. Intriguingly, despite the competitive advantage conferred by virulence, Salmonella Typhimurium maintains bistable expression of its virulence factor, resulting in a subpopulation of avirulent cells that cannot trigger inflammation, but are faster growing than their virulent counterparts [38]. These avirulent bacteria are able to activate the virulence factor and "switch" into the virulent population, and this activation rate increases over the late-logarithmic phase of growth [38]. Consequently, the Salmonella Typhimurium population begins with a larger proportion of fast-growing, avirulent bacteria, and, after they begin to grow, begin sacrificing reproduction rate in order to trigger the host's inflammatory immune response, resulting in a higher interspecific competition rate against the commensal bacteria. While the stochastic Lotka-Volterra model considered here is only a crude approximation of the competitive dynamics between Salmonella Typhimurium and the commensal gut bacteria, the general behavior qualitatively matches the prediction we produced through our analysis: when there is a tradeoff between growth and competition rates, fast growth is beneficial for small frequencies, while stronger competition is beneficial for larger frequencies.

Discussion
We have derived an explicit formula to approximate the probability of fixation in ecological competition as defined by the stochastic Lotka-Volterra model. Our approximation resulted from two important observations. First, we identified a natural timescale, exploiting which we produced an approximation to the backward Kolmogorov equation. Second, we argued that the fast dynamics of the population size, z = x + y, bring the system close to the manifold z = 2K(f − d) before the frequency of population X changes much from its initial state. This second observation allowed us to eliminate the fast z variable, collapsing the backward Kolmogorov equation into a second order, one dimensional partial differential equation, the steady state of which defines the probability of fixation, which we can explicitly find. This probability of fixation offers a more nuanced interpretation of competitive strategies than the results from considering deterministic systems of differential equations. Small fitness differences often have little effect on the dynamics of a deterministic system, which can greatly underestimate the importance of such differences. By considering a stochastic model, we can quantitatively track the effect that small fitness differences induce on the probability of fixation.
The explicit formula derived from our approximation allows us to quantify the effects of fitness tradeoffs in competition. Such tradeoffs are common in nature and result from an inability to simultaneously optimize every fitness trait [32]. Here we considered the tradeoff between growth rate and interspecific competition rate, though the same method used here can be used to analyze other tradeoffs between any number of fitness parameters. We showed the tradeoffs do not necessarily have a uniformly beneficial or detrimental effect on fixation probability. In particular, Fig 5 shows that fitness tradeoffs can be beneficial for some range of initial frequency p but harmful for others. We argued that this is consistent with the invasion strategy used by Salmonella Typhimurium, in which the early presence of fast-growing avirulent phenotypes confers a competitive advantage over the host's native commensal bacteria, while a late increase in slow-growing virulent Salmonella triggers the host's immune response, differentially displacing the commensals, thereby increasing the interspecific competition rate of the Salmonella population.
The analysis we performed and approximations we made here are general enough to be applied to a range of problems in which a fast manifold exists and populations differ by small parameter perturbations. Recent work on such problems was considered in [6]. A natural question is how much faster must the dynamics be along a fast manifold than along the complementary manifolds. If, for example, the Lotka-Volterra system did not quickly approach the manifold z = 2K(f − d), then how would the dimension reduction argument affect the accuracy of the resulting probability of fixation? Such questions can likely be answered by adapting multi-timescaling methods from continuous time dynamical systems to stochastic models [24].

Stochastic model
We consider a stochastic Lotka-Volterra model between two competitive species denoted X and Y . Let P ± s (N x , N y ) denote the transition rate of population s ∈ {X, Y } to increase/decrease by one assuming that X = N x and Y = N y . Both populations are assumed to reproduce at a constant rate proportional to their respective population sizes, f x N x and f y N y . Both populations naturally die at rate d x N x and d y N y , respectively. Finally, both populations die due to both inter-and intraspecific competition. These deaths are due to interactions with other individuals, and we assume mass-action kinetics. We write the interspecific competition rates as α x and α y , respectively, and the intraspecific rates as 1/K x and 1/K y . The parameters K x and K y are directly proportional to the species' carrying capacities in the deterministic model derived from this process. We write these dynamics as a continuous time Markov process with transition rates The parameter M is borrowed from [18,8]. The authors of those papers note that M determines the system size, but we will show that M defines a natural timescale that separates the first and second order mass-action dynamics. Moreover, we will presently use M to separate the timescales that occur due to small fitness differences between the two populations. The master equation associated with 12 is where u(N x , N y , t) is the probability that X(t) = N x and Y (t) = N y . Following the method detailed in [18], we define x = N x /M and y = N y /M , thereby allowing us to treat the population sizes are approximately continuous. The transition rates in terms of x and y are Note that if we rescale time by a factor of M , the only M only appears in the intraspecific competition terms. The Master equation associated with 13 is ∂u ∂t (x, y, t) =P + x (x − 1/M, y)u(x − 1/M, y, t) + P − x (x + 1/M, y)u(x + 1/M, y, t) + P + y (x, y − 1/M )u(x, y − 1/M, t)+ P − y (x, y + 1/M )u(x, y + 1/M, t) − P + x (x, y) + P − x (x, y) + P + y (x, y) + P − y (x, y) u(x, y, t).
Taylor expanding each transition rate and state probability in 1/M yields Inserting these expansions into the master equation [14] and dropping all terms of order O 1 M 3 , we obtain the Forward Kolmogorov (Fokker-Planck) Equation where u = u(x, y, t).

Backward Kolmogorov Equation
The probability density function u(x, y, t) more precisely should be written u(x, y, t; x 0 , y 0 ), where x 0 and y 0 are the initial values of x(t) and y(t). The probability density satisfies the following Backward Kolmogorov Equation [14]:

Change of variables
Our goal is to determine the probability of fixation of either species. It is useful to transform the system from x and y into z = x + y and p = x/(x + y) [8].
Under this transformation, using the derivatives the Backward Kolmogorov Equation [16] becomes where z and p are understood to be the initial values z = x 0 + y 0 and p = x 0 /(x 0 + y 0 ) and the subscripted variables represent differentiation with respect to those variables.
In order to quantify the probability of fixation in terms of relative competitive advantage, we write f y = f, We further assume that intraspecific competition rates are the same between both species; that is K = K x = K y . Inserting these into the BKE 17, we have Approximation to the BKE In equation 18, the dynamics are split into two timescales: order one and order 1/M . M therefore defines a natural timescale separation within the stochastic process. We therefore assume that the fitness differences occur on order 1/M , as follows: where λ, µ, and A are all O(1). The last condition assumes that the difference between inter-and intraspecific competition rates is small. Under these assumptions, we can write 18 as Dropping all terms of order 1/M 2 , we have the approximate BKE

Probability of fixation
We seek to determine the probability of fixation of population X given initial frequency p and initial summed population size z; that is, the probability that y(t * ) = 0 and x(t * ) > 0 for any time t * > 0. This probability, u(p, z) is given by the steady state solution of 18. Using our approximation 19, we seek solutions of We note that the only dynamics in 19 that are of order one are those given by z[g − d − z/(2K)]. These fast dynamics quickly collapse the system near the simplex defined by z = x + y = 2K(g − d) while the frequency p remains approximately constant (see Fig 2). This implies that changes in the initial value z likely do not affect the probability of fixation much. Under this final assumption, the second-order differential equation we solve to approximate the probability that population X outcompetes population Y is where the probability of fixation is now a function of p only, u(p), we treat z = 2K(f − d) as a constant, and with boundary conditions u(0) = 0 and u(1) = 1. Dividing Eq [20] by p(1 − p) and integrating once, we have where B is a constant of integration, and consequently, after applying the boundary conditions, which can alternatively be written in terms of error functions as follows Formula 21 is particularly useful when assessing the response of u(p) to parameter perturbations when A = 0. In the base case with λ = µ = 0, the probability of fixation is the identity line, u(p) = p. When λ is increased or µ decreased off of zero, the second derivative of u(p) is positive, and consequently the perturbed u(p) is above the identity line for all p, meaning the change in λ or µ uniformly increases the probability that X fixates. A similar argument shows that decreasing λ or increasing µ uniformly decreases u(p) over all p.

Average time to fixation
We now use our approximation to the probability of fixation to approximate the average time to fixation. Let u(p, t) be the probability that X fixates by time t (and therefore the probability of fixation is u(p) = lim t→∞ u(t, p)). Then ∂u ∂t is proportional to the probability that X fixates at exactly time t. If In particular, since the probability of fixation if X has initial proportion p, the properly normalized probability density function of the time to fixation is The average time to fixation given initial proportion p is therefore given by Following [26], we define Applying the backward Kolmogorov operator to both sides of 22, we have or more concisely, The average time to fixation given initial frequency p is then given by Note that t p is the time to fixation given that population X outcompetes Y . A similar derivation shows that the unconditional time to fixation, T u (p), satisfies the boundary value problem with boundary conditions T u (0) = T u (1) = 0 [14].

Fitness trade off
To study the effects of fitness tradeoffs, we write µ = ρλ, where ρ is a proportionality constant. The probability that X fixates given initial frequency p is now where the explicit dependence on λ is written to ease analysis below. For ρ sufficiently small, increasing λ will result in an increase in the growth rate with little negative change in µ, resulting in an overall competitive advantage for X. On the other hand, for ρ large, increasing λ will result in a substantial loss in the X populations's competitive ability, causing a disadvantage for X across all initial frequencies. For intermediate ρ, however, the effects of the tradeoff are more difficult to predict. To elucidate these effects, we consider ∂u(p,λ) ∂λ λ=0 over varied p and ρ. Wherever this derivative is positive, increasing λ increases the probability that X outcompetes Y , and wherever it is negative, increased λ decreases the probability. The derivative is cumbersome to write, but its positivity is determined by the quantity If σ > 0, the derivative is positive, if σ < 0, the derivative is negative. The curve defined by σ = 0 is plotted in Figure 6. This curve defines the p value at which increasing λ has no initial effect on the probability of fixation for the corresponding value of ρ. At any p value to the left of the curve for fixed ρ, increasing λ increases the probability of fixation of X. To the right, increasing λ decreases the probability of fixation. For any ρ below the lower dashed horizontal line, increasing λ uniformly increases the probability of fixation for any initial frequency p, and for any ρ above the upper dashed horizontal line, increasing λ uniformly decreases the probability across all p. Note that this method works for any A, not only for the neutral case of A = 0.