Skip to main content
G3: Genes | Genomes | Genetics logoLink to G3: Genes | Genomes | Genetics
. 2020 Sep 8;10(11):3959–3967. doi: 10.1534/g3.120.401575

A Faster and More Accurate Algorithm for Calculating Population Genetics Statistics Requiring Sums of Stirling Numbers of the First Kind

Swaine L Chen *,2, Nico M Temme †,1
PMCID: PMC7642932  PMID: 32900901

Abstract

Ewen’s sampling formula is a foundational theoretical result that connects probability and number theory with molecular genetics and molecular evolution; it was the analytical result required for testing the neutral theory of evolution, and has since been directly or indirectly utilized in a number of population genetics statistics. Ewen’s sampling formula, in turn, is deeply connected to Stirling numbers of the first kind. Here, we explore the cumulative distribution function of these Stirling numbers, which enables a single direct estimate of the sum, using representations in terms of the incomplete beta function. This estimator enables an improved method for calculating an asymptotic estimate for one useful statistic, Fu’s Fs. By reducing the calculation from a sum of terms involving Stirling numbers to a single estimate, we simultaneously improve accuracy and dramatically increase speed.

Keywords: Population genetics statistics, Evolutionary inference, Stirling numbers of the first kind, Asymptotic analysis, Numerical algorithms, Cumulative distribution functions


The dominant paradigm in population genetics is based on a comparison of observed data with parameters derived from a theoretical model (Casillas and Barbadilla 2017; Nielsen 2001). Specifically for DNA sequences, many techniques have been developed to test for extreme relationships between average sequence diversity (number of DNA differences between individuals) and the number of alleles (distinct DNA sequences in the population). In particular, such methods are widely used to predict selective pressures, where certain mutations confer increased or decreased survival to the next generation (Nielsen 2001). Such selective pressures are relevant for understanding and modeling practical problems such as influenza evolution over time (Grenfell et al. 2004) and during vaccine production (Chen et al. 2019); adaptations in human populations, which may impact disease risk (Wollstein and Stephan 2015; Quintana-Murci 2016); and the emergence of new infectious diseases and outbreaks (Wu et al. 2016).

Many population genetics tests are therefore formulated as unidimensional test statistics, where the pattern of DNA mutations in a sample of individuals is reduced to a single number (Nielsen 2001; Casillas and Barbadilla 2017; Fu 1997). Such statistics are heavily informed by combinatorial sampling and probability distribution theories, many of which are built upon the foundational Ewens’s sampling formula (Ewens 1972), which describes the expected distribution of the number of alleles in a sample of individuals, given the nucleotide diversity.

Ewens’s sampling formula not only was a seminal result for population genetics, but also established connections with combinatorial stochastic processes, algebra, and number theory (Crane 2016). For population genetics, in particular, Ewens’s sampling formula provided a key analytical result that finally enabled mathematical tests of the neutral theory of evolution (Crane 2016; Nielsen 2001). It has given rise to several classical population genetics tests for neutrality, including the Ewens-Watterson test, Slatkin’s exact test, Strobeck’s S, and Fu’s Fs (Fu 1997; Strobeck 1987). Calculation of subsets of this distribution are useful for testing deviations of observed data from a null model; such subsets often require the calculation of Stirling numbers of the first kind (hereafter referred to simply as Stirling numbers). In particular, Fu’s Fs has recently been shown to be potentially useful for detecting genetic loci under selection during population expansions (such as an infectious outbreak) both in theory and in practice (Wu et al. 2016). However, Stirling numbers rapidly grow large and thus explicit calculation can easily overwhelm the standard floating point range of modern computers.

In previous work, an asymptotic estimator for individual Stirling numbers was used to solve the problem of computing Fu’s Fs for large datasets, which are now becoming common due to rapid progress in DNA sequencing technology (Chen 2019). Without such improved numerical methods, Fu’s Fs calculations for data sets as small as 170 sequences can cause overflow, preventing the use of these statistics for genome-wide screens of selection. This algorithm based on estimating individual Stirling numbers solved problems of numerical overflow and underflow, maintained good accuracy, and substantially increased speed compared with other existing software packages (Chen 2019). However, there was still a need to estimate multiple Stirling numbers (up to half the total number of sequences). Here, we explore the potential for further increasing both accuracy and speed in calculating Fu’s Fs by using a single estimator for the entire sum, which involves multiple Stirling numbers.

Methods

General definitions and theory

We take a population of n individuals, each of which carries a particular DNA sequence Di (referred to as the allele of individual i). We define a metric, dist(Di,Dj) to be the number of positions at which sequence Di differs from Dj. Then, we denote the average pairwise nucleotide difference as θπ (hereafter referred to simply as θ), defined as:

θ=2n(n+1)i=1n1j=i+1ndist(Di,Dj). (1)

We also define a set of unique alleles Dui{Di} which have the property of (ij)(dist(Dui,Duj)>0). The ordinality of {Dui} is denoted m, i.e., the number of distinct alleles in the data set.

Building upon on Ewens’s sampling formula (Fu 1997; Ewens 1972), it has been shown that the probability that, for given n and θ, at least m alleles would be found, is

Sn,m(θ)=1(θ)nk=mn(1)nkSn(k)θk,θ>0, (2)

where (θ)n is the Pochhammer symbol, defined by

(θ)0=1,(θ)n=θ(θ+1)(θ+n1)=Γ(θ+n)Γ(θ). (3)

Sn(k) is a Stirling number and is defined by:

(θ)n=k=0n(1)nkSn(k)θk, (4)

Fu’s Fs is then defined as:

Fs=lnSn,m(θ)1Sn,m(θ). (5)

Fu’s Fs thus measures the probability of finding a more extreme (equal or higher) number of alleles than actually observed. It requires computing a sum of terms containing Stirling numbers, which rapidly become large and therefore impractical to calculate explicitly even with modern computers (Chen 2019).

Because of the relation in (4), the statistics quantity Sn,m(θ) satisfies 0Sn,m(θ)1. Also, this relation and (3) show that (1)nmSn(m) are non-negative. We have the special values

Sn(n)=1(n0),Sn(0)=0(n1),Sn(1)=(1)n1(n1)!(n1). (6)

There is a recurrence relation

Sn+1(k)=Sn(k1)nSn(k), (7)

which easily follows from (4). For a concise overview of properties, with a summary of the uniform approximations, see (Gil et al. 2007, §11.3).

We introduce a complementary relation

Tn,m(θ)=1Sn,m(θ)=1(θ)nk=0m1(1)nkSn(k)θk, (8)

leading to an alternate calculation for Fu’s Fs of

Fs=lnSn,m(θ)1Sn,m(θ)=ln1Tn,m(θ)Tn,m(θ). (9)

The recent algorithm considered in (Chen 2019) is based on asymptotic estimates of Sn(m) derived in (Temme 1993), which are valid for large values of n, with unrestricted values of m(0,n). It avoids the use of the recursion relation given in (7).

In the present paper we derive an integral representation of Sn,m(θ) and of the complementary function Tn,m(θ), for which we can use the same asymptotic approach as for the Stirling numbers without calculating the Stirling numbers themselves. From the integral representation we also obtain a representation in which the incomplete beta function occurs as the main approximant. In this way we have a convenient representation, which is available as well for many classical cumulative distribution functions. We show numerical tests based on a first-order asymptotic approximation, which includes the incomplete beta function. In a future paper we give more details on the complete asymptotic expansion of Sn,m(θ), and, in addition, we will consider an inversion problem for large n and m: to find θ either from the equation Sn,m(θ)=s, when s(0,1) is given, or from the equation Fs=f, when f is given.

Remarks on computing Sn,m(θ)

When computing the quantity Fs defined in (5), numerical instability may happen when Sn,m(θ) is close to 1. In that case, the computation of 1S suffers from cancellation of digits. For example, take n=100, θ=39.37, m=31. Then Sn,m(θ)0.99872, and Fs becomes about 6.6561 when using the first relation in (9). However, when we calculate Tn,m(θ)=0.002689 and use the second relation, then we obtain the more reliable result Fs5.9160.

We conclude that, when Sn,m(θ)0.5, it is better to switch and obtain Tn,m(θ) from the sum in (8) and Fs using the second relation in (9). A simple criterion to decide about this can be based on using the saddle point z0 (see Remark 1 below).

A second point is numerical overflow when n is large, because Sn(m) rapidly becomes large when m is small with respect to n. For example, when n=10, m=5 we have

S10(5)=n!(m+5)(m+4)(3m2+23m+38)11520(m1)!=269325. (10)

Therefore, it is convenient to scale the Stirling number in the form Sn(k)/n!. In addition, the Pochhammer term (θ)n in front of the sum in (2) will also be large with n; we have (1)n=n!.

We can write the sum in (2) in the form

Sn,m(θ)=n!(θ)nk=mn(1)nkS^n(k)θk,S^n(k)=Sn(k)n!. (11)

Leading to a corresponding modification in the recurrence relation in (7) for the scaled Stirling numbers:

S^n+1(m)=1n+1(S^n(m1)nS^n(m)). (12)

To control overflow, we can consider the ratio

fn(θ)=n!(θ)n=Γ(n+1)Γ(θ)Γ(θ+n). (13)

This function satisfies fn(θ)1 if θ1. For small values of n we can use recursion in the form

fn+1(θ)=n+1n+θfn(θ),n=0,1,2,,f0(θ)=1. (14)

For large values of n and all θ>0, we can use a representation based on asymptotic forms of the gamma function.

It should be observed that using the recursions in (7) and (12) is a rather tedious process when n is large. For example, when we use it to obtain S100(m) for all m(0,100], we need all previous Sn(m) with n99 for all m(0,n]. A table look-up for S^n+1(m) in floating point form may be a solution. When n is large enough, the algorithm mentioned in (Chen 2019) evaluates each needed Stirling number by using the asymptotic approximation derived in (Temme 1993).

Data availability

Code implementing the new estimator for Fu’s Fs in R is available at https://github.com/swainechen/hfufs.

Results And Discussion

Analytical results

The new algorithm is based on the following results, which we describe in two theorems.

Theorem 1. The statistics quantity Sn+1,m+1(θ) introduced in (2) has the representation as an integral in the complex z-plane

Sn+1,m+1(θ)=θm(θ+1)n12πiCR(z+1)nzmdzzθ,R>θ, (15)

where n and m are positive integers, 0mn, θ is a real positive number, and CR is a circle at the origin with radius R>θ. The symbol (α)n denotes the Pochhammer symbol introduced in (3).

Observe that we have raised in Sn,m(θ) the parameters n and m with unity; this is convenient in the mathematical analysis. The proof of this theorem will be given in the Appendix (Proof of Theorem 1).

Corollary 1. The complementary quantity Tn+1,m+1(θ) introduced in (8) has the representation

Tn+1,m+1(θ)=θm(θ+1)n12πiCR(z+1)nzmdzθz,R<θ. (16)

The main asymptotic result is given in the second theorem.

Theorem 2. Sn+1,m+1(θ) has the representation

Sn+1,m+1(θ)=Ix(m,nm+1)+Rn+1,m+1(θ),x=τ1+τ,τ>0, (17)

where Ix(p,q) is the incomplete beta function defined by

Ix(p,q)=1B(p,q)0xtp1(1t)q1dt, (18)

with

0<x<1,p>0,q>0,B(p,q)=Γ(p)Γ(q)Γ(p+q). (19)

The term Rn+1,m+1(θ) is a function of which we give a one-term approximation in (32).

Corollary 2. The complementary quantity Tn+1,m+1(θ) has the representation

Tn+1,m+1(θ)=I1x(nm+1,m)Rn+1,m+1(θ),1x=11+τ. (20)

This follows from Theorem 1 and the complementary relation of the incomplete beta function

Ix(p,q)=1I1x(q,p). (21)

Note also that the incomplete beta function in (17) has the representation (see (Paris, 2010, §8.17(i)))

Iτ1+τ(m,nm+1)=(1+τ)nj=mn(nj)τj, (22)

and from the complementary relation in (21) it follows that the function in (20) has the expansion

I11+τ(nm+1,m)=(1+τ)nj=0m1(nj)τj. (23)

The representation in this theorem in terms of the probability function Ix(p,q) shows the characteristic role of Sn,m(θ) as a cumulative distribution function of the Stirling numbers. The representation can also be viewed as an asymptotic representation in which the incomplete beta function is the main approximant.

The proof of Theorem 2 can be found in the Appendix (Proof of Theorem 2), but we give here some preliminary information about functions used in the proof to explain the definition of the parameter τ in (17). It is a function of θ and arises in certain transformations of the integral given in Theorem 1. For this we need the function

φ(z)=ln((z+1)n)mlnz=lnΓ(z+n+1)lnΓ(z+1)mlnz, (24)

and its derivative

φ(z)=ψ(z+n+1)ψ(z+1)mz,ψ(z)=Γ(z)Γ(z). (25)

With the function φ(z) we can write (15) in the form

Sn+1,m+1(θ)=eφ(θ)2πiCReφ(z)dzzθ,R>θ. (26)

Then the saddle point of the integral in (26) follows from the equation

φ(z)=ψ(z+n+1)ψ(z+1)mz=0,ψ(z)=Γ(z)Γ(z). (27)

There is a positive saddle point z0 when 0<m<n.

Next to these functions we introduce a function for complex values of a variable t:

χ(t)=nln(1+t)mlnt,χ(t)=(nm)tmt(1+t)=(nm)tt0t(1+t), (28)

where t0=mnm. These functions are related by

φ(z)φ(z0)=χ(t)χ(t0), (29)

with condition sign(zz0)=sign(tt0). In this way, using this relation as a transformation of the variable z to t, we can write (26) as

Sn+1,m+1(θ)=eχ(τ)2πiCReχ(t)f(t)dt,f(t)=1zθdzdt=1zθχ(t)φ(z). (30)

The parameter τ in Theorem 2 is defined as the positive solution of the equation

φ(θ)φ(z0)=χ(τ)χ(t0),sign(θz0)=sign(τt0). (31)

In Figure 1 we show the graphs of φ(z)φ(z0) (Figure 1A) and χ(t)χ(t0) (Figure 1B) for n=100, m=38. For these values the saddle points are z022.81 and t0=19310.61. The sign condition sign(zz0)=sign(tt0) for the relation in (29) means that the left branches of the convex curves correspond with functions values for z(0,z0] and t(0,t0], and the right branches with values for z[z0,) and t[t0,). Clearly, we have a one-to-one relation between the positive z and t-variables.

Figure 1.

Figure 1

Graphs of φ(z)φ(z0) (A) and χ(t)χ(t0) (B) for n=100, m=38, with z022.81 and t0=19310.61.

A first-order approximation of the function Rn+1,m+1(θ) in (17) and (20) reads

Rn+1,m+1(θ)eχ(τ)(nm1)g(t0),n,0<m<n, (32)

where

g(t0)=f(t0)1t0τ,f(t0)=1z0θχ''(t0)φ''(z0), (33)

and the function f(t) is defined in (30). The value f(t0) follows from evaluating dz/dt (see (30)) at t0, by observing that both functions φ'(z) and χ'(t) vanish when tt0 (hence, zz0). Then, l’Hôpital’s rule can be used to obtain f(t0).

In Figure 2 we show the error curves δ(Fs,Fs) in (34) for Fu’s Fs (9) for θ[10,400]. We show examples for n=100, m=75 (Figure 2A) and n=500, m=275 (Figure 2B). The solid curves are for Fs when using Sn+1,m+1(θ)Iτ/(1+τ)(m,nm+1), the dashed curves when using Sn+1,m+1(θ)Iτ/(1+τ)(m,nm+1)+Rn+1,m+1(θ) with the asymptotic estimate given in (32). For ease of visualization, the error δ(Fs,Fs) has been multiplied by a factor 10 or 100 in Figure 2. We have used the following mollified error function

δ(Fs,Fs)=|FsFsmax(|Fs|,1)|, (34)

where Fs is the approximation of Fs. This mollified error is exactly the relative error unless |Fs| is small. Because Fs will vanish when Sn+1,m+1(θ)=12 (which also means that θ is near the transition value z0137.98 (in Figure 2A) and z0251.58 (in Figure 2B) (see Remark 1)), we cannot use relative error for all θ>0. This explains the non-smooth curves in Figure 2.

Figure 2.

Figure 2

Mollified error in estimating Fu’s Fs for θ(10,400), m=75 and n=100 (A) and for m=275 and n=500 (B). The data for the dashed curves are multiplied by a factor of 10 (A) and 100 (B), to make the error curves visible in the figures. Refer to the text for further details.

The final estimator is based on the representations in (17) and (20) and the first order approximation in (32), which are used to calculate Fu’s Fs with one of the two relations in (9) depending on whether Sn,m(θ)0.5, decided as described above.

Implementation and numerical results

We first summarize the steps to compute Fu’s Fs by using (9) and the first-order approximations (see (32) and (17) or (20))

Sn+1,m+1(θ)Iτ1+τ(m,nm+1)+eχ(τ)(nm1)g(t0), (35)

or

Tn+1,m+1(θ)I11+τ(nm+1,m)eχ(τ)(nm1)g(t0), (36)

for large n, m(0,n) and θ>0.

  • 1 Compute the saddle point z0, the positive zero of φ'(z); see (27).

  • 2 With t0=m/(nm), the positive zero of χ'(t) (see (28)), compute τ, the solution of the equation (see (31))
    χ(τ)=χ(t0)+φ(θ)φ(z0), (37)
    with φ(z) defined in (24) and χ(t) defined in (28). When θ=z0 there is one solution τ=t0. When τt0 there are two positive solutions, and we take the one that satisfies the condition sign(θz0)=sign(τt0).
  • 3 When θ<z0, hence τ<t0, compute the approximation of Sn+1,m+1(θ) by using (35), and Fs from the first relation in (9).

  • 4 When θ>z0, hence, τ>t0, compute the approximation of Tn+1,m+1(θ) by using (36), and Fs from the second relation in (9).

In Table 1, we show the relative errors in the computation of Fs defined in (5). The values of n, m, and θ correspond with those in Table 1 of (Chen 2019). The asymptotic result is from (35). Computations were done with Maple, with Digits = 16. The “exact” values were obtained by using Maple’s code for Stirling1(n,m), which computes the Stirling numbers of the first kind.

Table 1. Relative errors in the computation of Fs defined in (5) using the asymptotic estimator in (35).

n/m θ Fs, asymptotic Fs, exact rel. error
25/20 9.39 −6.83168 −6.8294578 0.33×103
50/31 9.61 −10.13052 −10.1290263 0.15×103
100/40 9.37 −10.23064 −10.2298131 0.81×104
250/67 8.96 −26.41607 −26.4155959 0.18×104
500/95 9.04 −46.76268 −46.76238956 0.63×105
1000/152 9.07 −112.42500 −112.4248080 0.17×105
2001/213 9.03 −192.21835 −192.2182390 0.60×106

We additionally performed a comparison with the recently published algorithm in (Chen 2019). We performed 10,000 calculations with each algorithm and compared the results with an exact calculator. As expected, since the previous algorithm required estimating a Stirling number for each term of the sum, while the current asymptotic estimate directly calculates the sum, both error and compute speed were improved. Relative error for the single term estimate in (35) was well controlled at <0.001 for nearly 99% of the calculations; for 411 calculations where the previous hybrid estimator had an error >0.001, the estimate in (35) was more accurate in all but one case (n=157,m=4,θ=43.59732; 3.08e-3 relative accuracy using (Chen 2019); 3.32e-3 relative accuracy using (35)) (Figure 3). Further analysis of the relative error demonstrated that it peaks at intermediate values of m/n, depending on θ. These correspond to parameter choices near the transition values m=m0, where t approaches t0 and z approaches z0 in the calculation; notably, they remain well controlled (all values <0.001 mollified error) regardless of θ. The asymptotic behavior (lower relative error) can also be seen as both n and m increase in Figure 3B.

Figure 3.

Figure 3

(A) Comparison of relative error of the estimator from (Chen 2019) and the single term asymptotic estimator in (35). Relative error for each is calculated against the arbitrary precision implementation described in (Chen 2019). In total, 10,000 calculations were performed with n randomly sampled from a uniform distribution between 50 and 500; m between 2 and n; and θ between 1 and 50. A solid diagonal line is drawn at y=x. Dotted lines are drawn at a relative error of 0.001. Numbers within each quadrant defined by the dotted lines indicate the number of points in each quadrant. The red dot indicates the one case where the relative error was >0.001 and the error of (35) was greater than the estimator from (Chen 2019). (B) Comparison of mollified error (34) as a function of m. For this plot, we fixed n=100 (solid lines) or 500 (dotted lines) and θ(10,500) (as indicated by different line colors).

The fewer calculations led to a clear improvement in calculation speed (median 54.6x faster; Figure 4). The speedup also depends on the parameter choices; in general, the speed advantage is greater when the hybrid calculator requires many calculations (namely, when m is small relative to n, as the hybrid calculator performs the sum in (2)) (Figure 4B).

Figure 4.

Figure 4

(A) Comparison of run times between the hybrid algorithm from (Chen 2019) and the single term asymptotic estimator in (35). 100 iterations were run, each with 10,000 calculations; the time elapsed for each set of 10,000 calculations was recorded and plotted here. The same set of parameters were used for each algorithm. The order of running the algorithms was alternated with each iteration. The dark horizontal line indicates the median, the box indicates the first and third quartiles, the whiskers are drawn at 1.5x the interquartile range, and outliers are represented by open circles. The median for the hybrid algorithm is 62.64 s; the median for the asymptotic algorithm is 1.17 s. (B) Detailed benchmarking for n=100 (open violins) or 500 (gray violins), m(0.1n,0.2n,,0.9n), and θ(10,500). Fold speedup (ratio of the time taken for the hybrid calculator to that taken for the aysmptotic estimator) is plotted on the y-axis. Each dot represents one set of parameters; the violin plots summarize the density of points on the y-axis. Times were calculated for 100 iterations of each estimator for the same parameter values.

Conclusion

The rapid growth of sequencing data has been an enormous boon to population genetics and the study of evolution. Traditional population genetics statistics are still in common use today. The statistics Fu’s Fs and Strobeck’s S have been difficult to calculate on modern, large data sets using previous methods; we now further improve both accuracy and speed for the calculation of Fu’s Fs for such data sets, using the main estimator in (35). Our plan for a paper about the ability to invert the calculation provides additional future directions in understanding the performance of these statistics. Therefore, the methods used herein may be useful for the development of new statistics that more effectively capture different types of selection.

Acknowledgments

The authors thank the reviewers for their helpful comments and suggestions. SLC acknowledges Shyam Prabhakar and members of the Chen lab for fruitful discussions. NMT acknowledges CWI, Amsterdam, for scientific support; he thanks Edgardo Cheb–Terrab (Maplesoft) for his help with the Maple code. SLC was supported by the National Medical Research Council, Ministry of Health, Singapore (grant numbers NMRC/OFIRG/0009/2016 and NMRC/CIRG/1467/2017). NMT was supported by the Ministerio de Ciencia e Innovación, Spain, projects MTM2015-67142-P (MINECO/FEDER, UE) and PGC2018-098279-B-I00 (MCIU/AEI/FEDER, UE).

APPENDIX

Proof of Theorem 1

We use the integral representation of the Stirling numbers that follows from the definition given in (4). That is, by using Cauchy’s formula,

(1)nmSn(m)=12πiCR(z)ndzzm+1, (38)

where CR is a circle around the origin with radius R. We can take R as large as we like. As in (Temme, 1993, §3), it is convenient to proceed with

(1)nmSn+1(m+1)=12πiCR(z+1)ndzzm+1. (39)

Using the definition of Sn,m'(θ) in (2) we have

Sn+1,m+1(θ)=1(θ)n+1k=m+1n+1(1)n+1kSn+1(k)θk=1(θ+1)nk=mn(1)nkSn+1(k+1)θk, (40)

and using (39) we obtain

Sn+1,m+1(θ)=1(θ+1)nk=mnθk2πiCR(z+1)nzk+1dz. (41)

We can take R>θ to have |θ/z|<1 on the circle CR, and we can perform the summation to , because all terms with k>n do not give contributions. In this way we obtain the requested integral representation

Sn+1,m+1(θ)=θm(θ+1)n12πiCR(z+1)nzmdzzθ,R>θ. (42)

This concludes the proof of Theorem 1.

Corollary 1 now follows by using the theory of integrals of analytical functions on complex contours. We have assumed that R>θ, but we can take R<θ while picking up the residue at z=θ. The result is

Sn+1,m+1(θ)=1θm(θ+1)n12πiCR(z+1)nzmdzθz,R<θ. (43)

This gives the relation in Corollary 1.

Remark 1. When θ crosses the value z0, Sn+1,m+1(θ) becomes (almost) 12. Especially when the parameters m and n are large, Sn+1,m+1(θ) starts with very small values for small θ, becomes close to 12 when θ=z0, and quickly becomes 1 as θ increases. We call z0 the transition value for θ.

For fixed values of n and θ, there is also a transition value for m; refer to this transition value as m0. When n is large, Sn+1,m+1(θ) starts at values near 1 for small m, it becomes about 12 when m nears m0, and it becomes quickly small as mn.

Proof of Theorem 2

The relation in (29) between the functions φ(z) (see (24)) and χ(t) (see (28)) can be used as a transformation of the variable z to t, as in (Temme, 1993, §3). The result is the integral representation in (30). In Figure 1 we have shown the relationship between z and t.

The function f(t) in (30) has a pole in the t-domain; refer to this pole as t=τ. This then corresponds with the pole at z=θ in the z-domain. The relation between τ and θ follows from the transformation given in (29). In other words, τ is defined by the equation

φ(θ)φ(z0)=χ(τ)χ(t0),sign(θz0)=sign(τt0), (44)

where the sign-convention follows from the one used for (29). We can express the existence of the pole of the function f(t) defined in (30) by writing

f(t)=1zθdzdt=tτzθdzdt1tτ. (45)

In asymptotic analysis, the presence of such a pole is of great interest, especial when (in the t-domain) the saddle point (here t0) is close to a pole (here τ), or even when these points coalesce. See, for example, (Temme, 2015, Chapter 21). Usually, the error function is introduced to handle the asymptotic analysis; in the present case, we use an incomplete beta function. We split off the pole from f(t) and write

f(t)=Atτ+g(t), (46)

where we assume that g(t) is well defined at t=τ. To find A we use the analytical relation in (29) between t and z, in particular at z=θ (or t=τ). Applying l’Hôpital’s rule, we find that tτzθdzdt1 as tτ, which gives A=11. Hence, substituting this form of f(t) in (30), we find

Sn+1,m+1(θ)=eχ(τ)2πiCS(t+1)ntmdttτ+eχ(τ)2πiC(t+1)ntmg(t)dt. (47)

The radius of the circle CS in the first integral is larger than τ. For the second integral, we take a circle C around the origin such that the singularities of g(t) are outside the circle.

In Proof of the incomplete beta relation below, we prove that the first integral in (47) can be evaluated in terms of the incomplete beta function as shown in Theorem 2. We can then write (47) as

Sn+1,m+1(θ)=Iτ1+τ(m,nm+1)+Rn+1,m+1(θ), (48)

where

Rn+1,m+1(θ)=eχ(τ)2πiCS(t+1)ntmg(t)dt. (49)

A first-order approximation of (49) follows from replacing g(t) by its value at the saddle point t0. This gives

Rn+1,m+1(θ)eχ(τ)(nm1)g(t0), (50)

where

g(t0)=f(t0)1t0τ,f(t0)=1z0θχ''(t0)φ''(z0). (51)

This expression of f(t0) follows from (33). In a future publication we will give details about the complete asymptotic expansion of the term Rn+1,m+1(θ).

Proof of the incomplete beta relation

We give a proof of the claim that the incomplete beta function in (48) equals the first integral in (47). That is,

eχ(τ)2πiCS(t+1)ntmdttτ=Iτ1+τ(m,nm+1), (52)

where CS is a circle at the origin with radius larger than τ. We have, using the definition of χ(t) in (28),

eχ(τ)2πiCS(t+1)ntmdttτ=(1+τ)nτm2πiCS(t+1)ntm+1dt1τ/t=(1+τ)nk=0nmτk+m12πiCS(t+1)ntm+k+1dt=(1+τ)nk=0nmτk+m(nm+k)=(1+τ)nj=mnτj(nj), (53)

which is the relation in (22). In the second line we have used a finite number of terms of the infinite expansion of 1/(1τ/t) because terms with k>nm do not give a contribution.

Footnotes

Communicating editor: A. Kern

Literature Cited

  1. Casillas S., and Barbadilla A., 2017.  Molecular population genetics. Genetics 205: 1003–1035. 10.1534/genetics.116.196493 [DOI] [PMC free article] [PubMed] [Google Scholar]
  2. Chen H., Alvarez J. J. S., Ng S. H., Nielsen R., and Zhai W., 2019.  Passage adaptation correlates with the reduced efficacy of the influenza vaccine. Clin. Infect. Dis. 69: 1198–1204. 10.1093/cid/ciy1065 [DOI] [PubMed] [Google Scholar]
  3. Chen S. L., 2019.  Implementation of a Stirling number estimator enables direct calculation of population genetics tests for large sequence datasets. Bioinformatics 35: 2668–2670. 10.1093/bioinformatics/bty1012 [DOI] [PubMed] [Google Scholar]
  4. Crane H., 2016.  Rejoinder: The ubiquitous Ewens sampling formula. Stat. Sci. 31: 37–39. 10.1214/15-STS544 [DOI] [Google Scholar]
  5. Ewens W. J., 1972.  The sampling theory of selectively neutral alleles. Theor. Popul. Biol. 3: 87–112. 10.1016/0040-5809(72)90035-4 [DOI] [PubMed] [Google Scholar]
  6. Fu Y. X., 1997.  Statistical tests of neutrality of mutations against population growth, hitchhiking and background selection. Genetics 147: 915–925. [DOI] [PMC free article] [PubMed] [Google Scholar]
  7. Gil, A., J. Segura, and N. M. Temme, 2007 Numerical Methods for Special Functions Society for Industrial and Applied Mathematics (SIAM), Philadelphia, PA. 10.1137/1.9780898717822 [DOI] [Google Scholar]
  8. Grenfell B. T., Pybus O. G., Gog J. R., Wood J. L., Daly J. M. et al. , 2004.  Unifying the epidemiological and evolutionary dynamics of pathogens. Science 303: 327–332. 10.1126/science.1090727 [DOI] [PubMed] [Google Scholar]
  9. Nielsen R., 2001.  Statistical tests of selective neutrality in the age of genomics. Heredity 86: 641–647. 10.1046/j.1365-2540.2001.00895.x [DOI] [PubMed] [Google Scholar]
  10. Paris R. B., 2010.  Incomplete gamma and related functions, pp. 173–192 in NIST Handbook of Mathematical Functions, chap 8. Edited by F.W.J. Oliver, D.W. Lozier. R.F. Boisvert, and C.W. Clark. U.S. Dept., Commerce, Washington, DC, http://dlmf.nist.gov/8. [Google Scholar]
  11. Quintana-Murci L., 2016.  Understanding rare and common diseases in the context of human evolution. Genome Biol. 17: 225 10.1186/s13059-016-1093-y [DOI] [PMC free article] [PubMed] [Google Scholar]
  12. Strobeck C., 1987.  Average number of nucleotide differences in a sample from a single subpopulation: A test for population subdivision. Genetics 117: 149–153. [DOI] [PMC free article] [PubMed] [Google Scholar]
  13. Temme N. M., 1993.  Asymptotic estimates of Stirling numbers. Stud. Appl. Math. 89: 233–243. 10.1002/sapm1993893233 [DOI] [Google Scholar]
  14. Temme, N. M., 2015 Asymptotic methods for integrals, volume 6 of Series in Analysis. World Scientific Publishing Co. Pte. Ltd., Hackensack, NJ. [Google Scholar]
  15. Wollstein A., and Stephan W., 2015.  Inferring positive selection in humans from genomic data. Investig. Genet. 6: 5 10.1186/s13323-015-0023-1 [DOI] [PMC free article] [PubMed] [Google Scholar]
  16. Wu Z., Periaswamy B., Sahin O., Yaeger M., Plummer P. et al. , 2016.  Point mutations in the major outer membrane protein drive hypervirulence of a rapidly expanding clone of Campylobacter jejuni. Proc. Natl. Acad. Sci. USA 113: 10690–10695. 10.1073/pnas.1605869113 [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

Code implementing the new estimator for Fu’s Fs in R is available at https://github.com/swainechen/hfufs.


Articles from G3: Genes|Genomes|Genetics are provided here courtesy of Oxford University Press

RESOURCES