Abstract
The isolation-with-migration (IM) model is commonly used to make inferences about gene flow during speciation, using polymorphism data. However, Becquet and Przeworski (2009) report that the parameter estimates obtained by fitting the IM model are very sensitive to the model's assumptions (including the assumption of constant gene flow until the present). This paper is concerned with the isolation-with-initial-migration (IIM) model of Wilkinson-Herbots (2012), which drops precisely this assumption. In the IIM model, one ancestral population divides into two descendant subpopulations, between which there is an initial period of gene flow and a subsequent period of isolation. We derive a very fast method of fitting an extended version of the IIM model, which also allows for asymmetric gene flow and unequal population sizes. This is a maximum-likelihood method, applicable to data on the number of segregating sites between pairs of DNA sequences from a large number of independent loci. In addition to obtaining parameter estimates, our method can also be used to distinguish between alternative models representing different evolutionary scenarios, by means of likelihood ratio tests. We illustrate the procedure on pairs of Drosophila sequences from approximately 30,000 loci. The computing time needed to fit the most complex version of the model to this data set is only a couple of minutes. The R code to fit the IIM model can be found in the supplementary files of this paper.
1 Introduction
The 2-deme isolation-with-migration (IM) model is a population genetic model in which, at some point in the past, an ancestral population divided into two subpopulations. After the division, these subpopulations exchanged migrants at a constant rate until the present. The IM model has become one of the most popular probabilistic models in use to study genetic diversity under gene flow and population structure. Although applicable to populations within species, many researchers are using it to detect gene flow between diverging populations and to investigate the role of gene flow in the process of speciation. A meta-analysis of published research articles that used the IM model in the context of speciation can be found in Pinho and Hey (2010).
Several authors have developed computational methods to fit IM models to real DNA data. Some of the most used programs are aimed at data sets consisting of a large number of sequences from a small number of loci. This is the case of MDIV (Nielsen and Wakeley, 2001), IM (Hey and Nielsen, 2004; Hey, 2005), IMa (Hey and Nielsen, 2007) and IMa2 (Hey, 2010), which rely on Bayesian MCMC methods to estimate the model parameters and are computationally very intensive.
In the past decade, the availability of whole genome sequences has increased significantly. Very large data sets consisting of thousands of loci, usually from just a few individuals, became available for analysis, and such multilocus data sets are more informative than their single locus counterparts. In fact, as the sample size for a single locus increases, the probability that an extra sequence adds a deep (i.e. informative) branch to the coalescent tree quickly becomes negligible (see, e.g., Hein et al., 2005, p. 28-29). This new type of data set is also much more suitable for likelihood inference: if at each locus the observation consists only of a pair or a triplet of sequences, the coalescent process of these sequences is relatively simple and can more easily be used to derive the likelihood for the locus concerned. Furthermore, if the loci studied are distant from each other, observations at different loci can be considered independent and thus the likelihood of a whole set will consist of the product of the likelihoods for the individual loci.
For these reasons, some of the most recent theoretical papers and computer implementations of the IM model are aimed at data sets consisting of a small number of sequences at a large number of loci. Wang and Hey (2010) and Zhu and Yang (2012), for example, developed maximum-likelihood methods based on numerical integration. Computationally less intensive methods of fitting the IM model were studied by Lohse et al. (2011), who used moment generating functions, and Andersen et al. (2014), who resorted to matrix exponentiation and decomposition.
Despite all the progress, several authors have recently pointed out some limitations of the IM model. Becquet and Przeworski (2009) report that the parameter estimates obtained by fitting the IM model are highly sensitive to the model’s assumptions – including the assumption of constant gene flow until the present. Strasburg and Rieseberg (2011) and Sousa et al. (2011) note that the gene flow timing estimates reported in the literature, based on the IM model and obtained with the IMA2 program, have extremely wide confidence intervals, as the time of gene flow is non-identifiable in the IM model.
As a step to overcome these limitations, Wilkinson-Herbots (2012) studied an extension of the IM model, the isolation-with-initial-migration (IIM) model, which is more realistic than the IM model in the context of speciation. Broadly speaking, the IIM model is an IM model in which gene flow ceased at some point in the past. Explicit formulae for the distribution of the coalescence time of a pair of sequences, and the distribution of the number of nucleotide differences between them, are derived in Wilkinson-Herbots (2012). These analytic results enable a very fast computation of the likelihood of a data set consisting of observations on pairs of sequences at a large number of independent loci. However, for mathematical reasons this work was limited to the case of symmetric migration and equal subpopulation sizes during the migration period.
In this paper, we study a more general IIM model which allows for asymmetric gene flow during the migration period. It also allows for unequal subpopulation sizes during gene flow, as well as during the isolation stage. Both this model and other simpler models studied in this paper assume haploid DNA sequences, which accumulate mutations according to the infinite sites assumption (Watterson, 1975). An extension to the Jukes-Cantor model of mutation is feasible but beyond the scope of this paper.
We first describe, for different versions of the IIM model, an efficient method to compute the likelihood of a set of observations on the number of different nucleotides between pairs of sequences (also termed the number of pairwise differences). Each pair of sequences comes from a different locus and we assume free recombination between loci and no recombination within loci. Secondly, we illustrate how to use this method to fit the IIM model to real data. The data set of Drosophila sequences from Wang and Hey (2010), containing over 30,000 observations (i.e. loci), is used for this purpose. Finally, we demonstrate, using this data set, how different models, representing different evolutionary scenarios, can be compared using likelihood ratio tests.
2 Theory and methods
For the purposes of the present paper, and from a forward-in-time perspective, the isolation-with-migration (IM) model makes the following assumptions: a) until time τ0 ago (τ0 > 0), a population of DNA sequences from a single locus followed a Wright-Fisher haploid model (Fisher, 1930; Wright, 1931); b) at time τ0 ago, this ancestral population split into two Wright-Fisher subpopulations with constant gene flow between them. If we take an IM model and add the assumption that, at time τ1 ago (0 < τ1 < τ0), gene flow ceased, we get an isolation-with-initial-migration (IIM) model. Figure 1 illustrates the fullest IIM model dealt with in this paper.
In the IIM model of Figure 1, the population sizes are given inside the boxes, in units of DNA sequences. All population sizes are assumed constant and strictly positive. The parameters a, b, c1 and c2 indicate the relative size of each population with respect to subpopulation 1 during the migration stage. For example, if 2Nanc is the number of sequences in the ancestral population, then a = 2Nanc/2N. Between times τ0 and τ1 ago (two time parameters in units of 2N generations) there is gene flow between the subpopulations: in each generation, a fraction mi of subpopulation i are immigrants from subpopulation j (i, j ∈ {1,2} with i ≠ j), i.e. mi is the migration rate per generation from subpopulation i to subpopulation j backward in time. Within each subpopulation, reproduction follows the neutral Wright-Fisher model and, in each generation, restores the subpopulations to their original sizes, i.e. reproduction undoes any decrease or increase in size caused by gene flow (this assumption of constant population size is common and usually reflects restrictions on food and habitat size).
Under the IIM model, the genealogy of a sample of two DNA sequences from the present subpopulations can be described by successive Markov chains, working backward in time. We will define these in the simplest possible way, using the smallest state space necessary for the derivation of the coalescence time distribution. Hence, during the isolation stage (until time τ1 into the past) and the migration stage (between τ1 and τ0), the process can only be in state 1 – both lineages in subpopulation 1 –, state 2 – both lineages in subpopulation 2 –, state 3 – one lineage in each subpopulation –, or state 4 – in which lineages have coalesced. After τ1, the lineages have either coalesced already – state 4 –, or have not – state 0. Only states 1, 2 and 3 can be initial states, according to whether we sample two sequences from subpopulation 1, two sequences from subpopulation 2, or one sequence from each subpopulation. When the genealogical process starts in state i (with i ∈ {1,2,3}), the time until the most recent common ancestor of the two sampled sequences is denoted T(i), whereas S(i) denotes the number of nucleotide differences between them.
If time is measured in units of 2N generations and N is large, the genealogical process is well approximated by a succession of three continuous-time Markov chains, one for each stage of the IIM model (Kingman, 1982a,b; Notohara, 1990). We refer to this stochastic process in continuous time as the coalescent under the IIM model. During the isolation stage, the approximation is by a Markov chain defined by the generator matrix with i ∈ {1,2} being the initial state (Kingman, 1982a,b). If 3 is the initial state, the lineages cannot coalesce before τ1. During the ancestral stage, the genealogical process is approximated by a Markov chain with generator matrix (Kingman, 1982a,b). In between, during the migration stage, the approximation is by a Markov chain with generator matrix (Notohara, 1990). In this matrix, Mi/2 = 2Nmi represents the rate of migration (in continuous time) of a single sequence when in subpopulation i. The rates of coalescence for two lineages in subpopulation 1 or 2 are 1 and 1/b respectively. Note that state 3 corresponds to the second row and column, and state 2 to the third row and column. This swap was dictated by mathematical convenience: the matrix Qmig should be as symmetric as possible because this facilitates a proof in the next section.
2.1 Distribution of the time until coalescence under bidirectional gene flow (M1 > 0, M2 > 0)
To find , the density of the coalescence time T(i) of two lineages under the IIM model, given that the process starts in state i and there is gene flow in both directions, we consider separately the three Markov chains mentioned above. We let and denote the times until absorption of the time-homogeneous Markov chains defined by the generator matrices , Qmig and Qanc respectively. And we let the corresponding pdf’s (or cdf’s) be denoted by and (or and ). Then can be expressed in terms of the distribution functions just mentioned: for i ∈ {1,2}. If 3 is the initial state,
The important conclusion to draw from these considerations is that to find the distribution of the coalescence time under the IIM model, we only need to find the distributions of the absorption times under the simpler processes just defined.
A Markov process defined by the matrix Qanc, and starting in state 0, is simply Kingman’s coalescent (Kingman, 1982a,b). For such a process, the distribution of the coalescence time is exponential, with rate equal to the inverse of the relative population size:
A Markov process defined by , i ∈ {1, 2}, is again Kingman’s coalescent, so
Finally, with respect to the ‘structured’ coalescent process defined by the matrix Qmig, we prove in the Appendix that, for i ∈ {1,2,3}, where Vij is the (i, j) entry of the (non-singular) matrix V, whose rows are the left eigenvectors of Qmig. The (i, j) entry of the matrix V-1 is denoted by . The λj (j ∈ {1,2,3}) are the absolute values of those eigenvalues of Qmig which are strictly negative (the remaining one is zero). Since the λj are real and strictly positive, the density function of is a linear combination of exponential densities.
Substituting the pdf’s from equations (6), (7) and (8) into the equations (4) and (5), and denoting by A the three by three matrix with entries , we obtain for i ∈ {1,2}, and
If M1 = M2 and b = 1 (i.e. in the case of symmetric gene flow and equal subpopulation sizes during the gene flow period), results (9) and (10) above simplify to the corresponding results in Wilkinson-Herbots (2012) - in this case, the coefficient Ai3 in the linear combination is zero for i ∈ {1,2,3}.
2.2 Distribution of the time until coalescence under unidirectional gene flow, and in the absence of gene flow
If either M1 or M2 is equal to zero, or if both are equal to zero, the above derivation of is no longer applicable, as the similarity transformation in part (ii) of the proof is no longer defined (see the denominators in some entries of the matrix D). In this section, we derive , the density of the absorption time of the Markov chain defined by the matrix Qmig given in equation (3), starting from state i, when one or both the migration rates are zero. Again, this is all we need to fill in equations (4) and (5) and obtain the distribution of the coalescence time of a pair of DNA sequences under the IIM model. Having gene flow in just one direction considerably simplifies the coalescent. For this reason, we resort to moment generating functions, instead of eigendecomposition, and derive fully explicit pdf’s.
2.2.1 Migration from subpopulation 2 to subpopulation 1 backward in time (M1 = 0, M2 > 0)
Let again be defined as the absorption time of the Markov chain generated by Qmig, now with M1 = 0 and M2 > 0, given that the initial state is i ∈ {1,2,3}. A first-step argument gives the following system of equations for the mgf of :
Solving this system of equations and applying a partial fraction decomposition, the distributions of and can be expressed as linear combinations of exponential distributions:
Thus we obtain the following pdf’s: for t > 0.
The pdf of the coalescence time of a pair of DNA sequences under an IIM model with M1 = 0 and M2 > 0 can now be easily derived by comparing the above expressions with equation (8): is given by equations (9) and (10) above, but now with and
2.2.2 Migration from subpopulation 1 to subpopulation 2 backward in time (M1 > 0, M2 = 0)
In the opposite case of unidirectional migration, and using the same derivation procedure, we find that:
As a result, the pdf of the coalescence time of a pair of sequences under the IIM model, , is again given by equations (9) and (10), now with and
2.2.3 Distribution of the time until coalescence under an IIM model with M1 = M2 = 0
In this case, the IIM model reduces to a complete isolation model where both descendant populations may change size at time τ1 into the past. The distribution of the absorption time corresponding to Qmig will now be either exponential, if both sampled sequences are from the same subpopulation (i.e. for i ∈ {1,2}), or coalescence will not be possible at all until the ancestral population is reached, if we take a sequence from each subpopulation (i.e. if i = 3). It follows that the pdf of the coalescence time of a pair of sequences in the IIM model is given by equations (9) and (10) with and
2.3 The distribution of the number S of segregating sites
Let S(i) denote the number of segregating sites in a random sample of two sequences from a given locus, when the ancestral process of these sequences follows the coalescent under the IIM model and the initial state is state i (i ∈ {1,2,3}). Recall the infinite sites assumption and assume that the distribution of the number of mutations hitting one sequence in a single generation is Poisson with mean μ. As before, time is measured in units of 2N generations and we use the coalescent approximation. Given the coalescence time T(i) of two sequences, S(i) is Poisson distributed with mean θT(i), where θ = 4Nμ denotes the scaled mutation rate. Since the pdf of T(i), , is known, the likelihood L(i)of an observation from a single locus corresponding to the initial state i can be derived by integrating out T(i): where γ is the vector of parameters of the coalescent under the IIM model, that is, γ = (a, b, c1, c2,τ1,τ0, M1, M2). There is no need to compute this integral numerically: because , has been expressed in terms of a piecewise linear combination of exponential or shifted exponential densities, we can use standard results for a Poisson process superimposed onto an exponential or shifted exponential distribution.
The equations (18) and (29) of Wilkinson-Herbots (2012) use this superimposition of processes to derive the distribution of S under a mathematically much simpler IIM model with symmetric migration and equal subpopulation sizes during the period of migration. These equations can now be adapted to obtain the pmf of S under each of the migration scenarios dealt with in this paper. The changes accommodate the fact that the density of the coalescence time during the migration stage of the model is now given by a different linear combination of exponential densities, where the coefficients in the linear combination, as well as the parameters of the exponential densities, are no longer the same. The pmf of S has the following general form: for i ∈ {1,2} and for s ∈ {0,1,2,3,…}. As defined in Section 2.1, under bidirectional migration λ = (λ1,λ2,λ3) is the vector of the absolute values of the strictly negative eigenvalues of Qmig and . If migration occurs in one direction only, with M1 = 0 and M2 > 0, the matrix A and the vector λ are those given in Section 2.2.1. In the remaining cases, when M1 > 0 and M2 = 0 or when there is no gene flow, A and λ are given in Sections 2.2.2 and 2.2.3 respectively. In the special case of M1 = M2 and b = 1, equations (11) and (12) reduce to the results of Wilkinson-Herbots (2012).
2.4 The likelihood of a multilocus data set
Recall that, for our purposes, an observation consists of the number of nucleotide differences between a pair of DNA sequences from the same locus. To jointly estimate all the parameters of the IIM model, our method requires a large set of observations on each of the three initial states (i.e. on pairs of sequences from subpopulation 1, from subpopulation 2, and from both subpopulations). To compute the likelihood of such a data set, we use the assumption that observations are independent, so we should have no more than one observation or pair of sequences per locus and there should be free recombination between loci, i.e. loci should be sufficiently far apart.
Let each locus for the initial state i be assigned a label ji ∈ {1i, 2i, 3i,…, Ji}, where Ji is the total number of loci associated with initial state i. Denote by θji = 4Nμji the scaled mutation rate at locus ji, where μji is the mutation rate per sequence per generation at that locus. Let θ denote the average scaled mutation rate over all loci and denote by the relative mutation rate of locus ji. Then θji = rjiθ. If the relative mutation rates are known, we can represent the likelihood of the observation at locus ji simply by L(γ, θ; sji). By independence, the likelihood of the data set is then given by
In our likelihood method, the rji are treated as known constants. In practice, however, the relative mutation rates at the different loci are usually estimated using outgroup sequences (Yang, 2002; Wang and Hey, 2010).
3 Results
3.1 Simulated data
We generated two batches of data sets by simulation, each batch having one hundred data sets. Each data set consists of thousands of independent observations, where each observation represents the number of nucleotide differences between two DNA sequences belonging to the same locus, when the genealogy of these sequences follows an IIM model. In batch 1 each data set has 40,000 observations: 10,000 observations for initial state 1 (two sequences drawn from subpopulation 1), 10,000 for initial state 2 (two sequences drawn from subpopulation 2), and 20,000 for initial state 3 (one sequence from each of the two subpopulations). In batch 2 each data set has 800,000 observations: 200,000 for initial state 1, 200,000 for initial state 2, and 400,000 for initial state 3.
The data sets shown in this section were generated using the following parameter values: a = 0.75, θ = 2, b = 1.25, c1 = 1.5, c2 = 2, τ0 = 2 and τ1 = 1, M1 = 0.5 and M2 = 0.75. Each observation in a data set refers to a different genetic locus j, and hence was generated using a different scaled mutation rate θj for that locus. For batch 1, we first fixed the average mutation rate over all sites to be θ = 2. Then, a vector of 40,000 relative size scalars rj was randomly generated using a Gamma(15,15) distribution. The scaled mutation rate at locus j was then defined to be θj = rjθ, where rj denotes the relative mutation rate at locus j, that is, the relative size of θj with respect to the average mutation rate, θ. All data sets in batch 1 were generated using the same vector of relative mutation rates. The generation of the 800,000 mutation rates θj used in batch 2 was carried out following the same procedure.
When fitting the IIM model to data sets generated in this manner, the relative mutation rates rj are included as known constants in the log-likelihood function to be maximised. So, as far as mutation rates are concerned, only the average over all loci is estimated (i.e. the parameter θ). To increase the robustness and performance of the fitting procedure (see also Wilkinson-Herbots (2015) and the references therein), we found the maximum-likelihood estimates for a reparameterised model with parameters θ, θa = θa, θb = θb, θc1 = θc1, θc2 = θc2, V = θ (τ0 – τ1), T1 = θτ1, M1 and M2.
The boxplots of the maximum-likelihood estimates obtained for both batches of simulated data are shown in Figure 2. For each parameter, the boxplot on the left refers to batch 1 and the one on the right to batch 2. From the boxplots of time and population size parameters, it is seen that the estimates are centred around the true parameter values. Estimates for the migration rates are skewed to the right for batch 1, possibly because the true parameter values for these rates are closer to the boundary (zero) than the ones for population sizes and splitting times. For all types of parameters, increasing the sample size will decrease the variance of the maximum-likelihood estimator, as would be expected from using the correct expressions for the likelihood. In the case of the migration rate parameters, increasing the sample size eliminates most of the skewness.
Figure 3 shows a pair of normal Q-Q plots for each of three parameters: θc1 (a size parameter), T1 (a time parameter) and M1 (a migration parameter). The estimates in the top and bottom Q-Q plots are based on batch 1 and batch 2 respectively. It is clear from the figure that the distributions of the maximum-likelihood estimators of θc1, T1 and M1 become increasingly Gaussian as we increase the number of observations (compare top and bottom Q-Q plots). This is also true for the estimators of the remaining parameters (results not shown here). In addition, we can also observe that the distributions of the estimators of time and population size parameters have already a reasonably Gaussian shape for a sample size of 40,000 observations (batch 1, top plots). Again, this is true for the estimators of the remaining time and size parameters.
3.2 The data from Wang and Hey (2010)
3.2.1 Maximum-likelihood estimation
To illustrate our method, we apply it to a real, multilocus data set from two closely related species of Drosophila. The data set from Wang and Hey (2010) includes an alignment of sequences covering 30247 loci, which consists of two D. simulans assemblies, one D. melanogaster assembly and one D. yakuba assembly. It also includes a smaller alignment of sequences, spanning only 378 loci, which consists of two D. melanogaster assemblies and one D. yakuba assembly. We will call this last alignment the ‘Hutter subset’, because it was first studied by Hutter et al. (2007). The larger alignment will be termed the ‘Wang subset’. Our models are fitted to the D. melanogaster and D. simulans sequences from both subsets. The D. yakuba sequences are only used as outgroup sequences, to estimate the relative mutation rates at the different loci and to calibrate time.
To estimate the relative mutation rates rji, we use the ad hoc approach proposed by Yang (2002), which was also used in Wang and Hey (2010) and Lohse et al. (2011). Estimates are computed by means of the following method-of-moments estimator: where J is the total number of loci, and is the average of the numbers of nucleotide differences observed in pairs of one ingroup sequence and one outgroup sequence, at locus ji.
Since our method uses only one pair of sequences at each of a large number of independent loci, and requires observations for all initial states, the following procedure was adopted to select a suitable set of data. According to the genome assembly they stem from, sequences in the Wang subset were given one of three possible tags: ‘Dsim1’, ‘Dsim2’ or ‘Dmel’. To each of the 30247 loci in the Wang subset we assigned a letter: loci with positions 1, 4, 7,… in the genome alignment were assigned the letter A; loci with positions 2, 5, 8,… were assigned the letter B; and loci with positions 3, 6, 9,…, the letter C. A data set was then built by selecting observations corresponding to initial states 1 and 3 from the Wang subset (we used the Dsim1-Dsim2 sequences from loci A, the Dmel-Dsim1 sequences from loci B, and the Dmel-Dsim2 sequences from loci C), whilst observations corresponding to initial state 2 were obtained from the Hutter subset by comparing the two D. melanogaster sequences available at each locus.
Table 1 contains the maximum-likelihood estimates for the models shown in Figure 4. Note that the parameters of time and population size have been reparameterised as in section 3.1, and recall that M1 and M2 are the scaled migration rates backward in time. In the diagrams, the left and right subpopulations represent D. simulans and D. melanogaster respectively.
3.2.2 Model selection
In this section, we use likelihood ratio tests to determine which of the models listed in Table 1 fits the data of Wang and Hey (2010) best. For reasons which we now explain, the use of such tests in the present situation is not straightforward.
We wish to apply a standard large-sample theoretical result which states that, as the number of observations increases, the distribution of the likelihood ratio test statistic given by where approaches a χ2 distribution. In equation (15), Φ0 denotes the parameter space according to the null hypothesis (H0). This space is a proper subspace of Φ, the parameter space according to the alternative hypothesis (H1). The number of degrees of freedom of the limiting distribution is given by the difference between the dimensions of the two spaces.
A list of sufficient regularity conditions for this result can be found, for example, in Casella and Berger (2001, p. 516). Two of them are clearly not met in the present problem. All models under study assume independent, but not identically distributed observations. In fact, the pmf of an observation changes according to which species the sequences are taken from (i.e. according to the initial state) and to which locus they belong to (because each locus has its own rate of mutation). In some cases, the pairwise comparison of models is also affected by another problem: every point of Φ0 is a boundary point of Φ. In other words, if H0 is true, the vector of true parameters ϕ* ∈ Φ0, whichever it might be, is on the boundary of Φ. This irregularity is present, for example, when M1 = M2 = 0 according to H0 and M1, M2 ∈ [0, ∞) according to H1.
Both these irregularities have been dealt with in the literature. As to the first one, even if observations are not identically distributed, both the maximum-likelihood estimator and the likelihood ratio test statistic still approach their respective limiting distributions if Lyapunov’s condition is satisfied. This requires the very mild assumption that Var(Sji) is both bounded and bounded away from zero. It also requires E|Sji – E(Sji)|3to be bounded (Pawitan, 2001, pp. 233-234). This last condition is satisfied if θji is bounded, which again is a rather mild assumption. The applicability of the central limit theorem is also supported by the simulations in section 3.1, which show that the distribution of the maximum-likelihood estimator indeed approaches normality as we increase the number of observations, so the lack of identically distributed observations should not compromise the applicability of large sample results in the procedures of model selection described in this paper.
The second irregularity, that is, the problem of having parameters on the boundary, has been the subject of papers such as Self and Liang (1987) and Kopylev and Sinha (2011). The limiting distribution of the likelihood ratio test statistic under this irregularity has been derived in these papers, but only for very specific cases. In most of these cases, the use of the naive distribution, with r being the number of additional free parameters according to H1, turns out to be conservative, because the correct null distribution is a mixture of distributions with v ≤ r. Our analysis of the data of Wang and Hey (2010) involves two likelihood ratio tests with parameters on the boundary (ISO vs. IM1, and IM1 vs. IIM1), so we need to check that the naive distribution is also conservative in these cases. This was verified in a short simulation study which we now describe.
We generated 100 data sets from the ISO model, each one consisting of 40,000 observations, and fitted both the ISO model (H0) and the IM1 model (H1) to obtain a sample of 100 realisations of the likelihood ratio test statistic. A Q-Q plot (Figure 5, left boxplot) shows that the estimated quantiles of the null distribution are smaller than the corresponding theoretical quantiles of the χ2 distribution with 2 degrees of freedom (the difference between the dimensions of Φ0 and Φ in this particular case). In other words, the use of the naive χ2 distribution is conservative in this case. Using instead of the correct null distribution, at a significance level of 5%, the null hypothesis (i.e. the ISO model) was falsely rejected in only 1 out of the 100 simulations performed.
A similar simulation was carried out with respect to another pair of nested models: the IM1 model (now as H0), in which τ1 = 0, and the IIM1 model (H1), in which τ1 ≥ 0. Again the naive χ2 distribution (this time with only one degree of freedom) was found to be conservative (Figure 5, right boxplot). And once more, only in one out of the 100 simulations performed is the null hypothesis (the IM1 model) falsely rejected at the 5% significance level, if is used instead of the correct null distribution.
To select the model that best fitted the data of Wang and Hey (2010), we performed the sequence of pairwise comparisons shown in Table 2. For any sensible significance level, this sequence of comparisons leads to the choice of IIM2 as the best fitting model. In fact, assuming the naive χ2 as the null distribution, a significance level as low as 1.2 × 10−74 is enough to reject H0 in each of the three tests. However, since for this model (see Table 1), a final (backward) comparison is in order: that between IIM2 and IIM3 (which corresponds to fixing M1 at zero in IIM2). The nested model in this comparison has one parameter less and, as can be seen in Table 1, has the same likelihood. So, in the end, we should prefer IIM3 to IIM2.
3.2.3 Confidence intervals for the selected model
The Wald confidence intervals are straightforward to calculate whenever the vector of estimates is neither on the boundary of the model’s parameter space, nor too close to it. In that case, it is reasonable to assume that the vector of true parameters does not lie on the boundary either. As a consequence, the vector of maximum-likelihood estimators is consistent and its distribution will approach a multivariate Gaussian distribution as the sample size grows (see, for example, Pawitan, 2001, p. 258). The confidence intervals can then be calculated using the inverted Hessian matrix.
In the case of the data of Wang and Hey (2010), the vector of estimates of the selected model (IIM3) is an interior point of the parameter space. Assuming that the vector of true parameters is also away from the boundary, we computed the Wald 95% confidence intervals shown in Table 3 using the inverted Hessian. In agreement with our assumption, we note that none of the confidence intervals include zero.
For large sample sizes, and for true parameter values not too close to the boundary of the parameter space, the Wald intervals are both accurate and easy to compute. To check how well the Wald intervals for the IIM3 model fare against the more accurate (see Pawitan, 2001, pp. 47-48), but also computationally more expensive, profile likelihood intervals, we included these in Table 3. The two methods yield very similar confidence intervals for all parameters except θb. The cause of this discrepancy should lie in the fact that we only had pairs of D. melanogaster sequences available from a few hundred loci (θb is the size of the D. melanogaster subpopulation during the migration stage).
3.2.4 Conversion of estimates
The conversion of the point estimates and confidence intervals to more conventional units is based on the estimates of Powell (1997) of the duration of one generation (g = 0.1 years) and the speciation time between D. yakuba and the common ancestor of D. simulans and D. melanogaster (10 million years); see also Wang and Hey (2010) and Lohse et al. (2011). Using these values, we estimated μ, the mutation rate per locus per generation, averaged over all loci, to be .
In Tables 4, 5 and 6, we show the converted estimates for the best fitting model IIM3. The effective population size estimates, in units of diploid individuals, are all based on estimators of the form , for example, the estimate of the ancestral population effective size Na is given by . The estimates in years of the time since the onset of speciation and of the time since the end of gene flow are given by and respectively. With respect to gene flow, we use as the estimator of the fraction of subpopulation 1 that migrates to subpopulation 2 in each generation, forward in time, and as the estimator of the number of migrant sequences from subpopulation 1 to subpopulation 2 in each generation, also forward in time.
If g and are treated as constants, then each of the estimators just given can be expressed as a constant times a product - or a ratio - of the estimators of non-converted parameters. For example, we have that and
Hence if we denote the vector of estimators of the converted parameters by , then , where W is a diagonal matrix and . Because is a maximum-likelihood estimator (of a reparameterised model), it approaches, as the sample size increases, a multivariate Gaussian distribution with some covariance matrix Σ; hence also approaches a multivariate Gaussian distribution, but with covariance matrix WΣWT. To calculate the Wald confidence intervals of Tables 4, 5 and 6, we reparameterised the IIM model in terms of ϕ = (M2b/θ, θa,…)T and found as the inverse of the observed Fisher information. An estimate of WΣWT followed trivially.
Profile likelihood confidence intervals were also computed for the parameterisation ϕ = (M2b/θ, θa,…)T. Then, if û (or Î) is the vector of estimated upper (or lower) bounds for the parameters in ϕ, Wû (or WÎ) will be the vector of estimated upper (or lower) bounds for the converted parameters. This follows from the likelihood ratio invariance - see, for example, Pawitan (2001, p. 47-48).
4 Discussion
We have described a fast method to fit the isolation-with-initial-migration model to large data sets of pairwise differences at a large number of independent loci. This method relies essentially on the eigendecomposition of the generator matrix of the process during the migration stage of the model: for each set of parameter values, the computation of the likelihood involves this decomposition. Nevertheless, the whole process of estimation takes no more than a couple of minutes for a data set of tens of thousands of loci such as that of Wang and Hey (2010). The implementation of the simpler IIM model of Wilkinson-Herbots (2012), with R code provided in Wilkinson-Herbots (2015), is even faster than the more general method presented here, since it makes use of a fully analytical expression for the likelihood (avoiding the need for eigendecomposition of the generator matrix), but it relies on two assumptions which we have dropped here, and which are typically unrealistic for real species: the symmetry of migration rates and the equality of subpopulation sizes during the gene flow period. When compared to implementations of the IM model based on numerical integration (such as MDIV, IM, IMa and IMa2), our method is considerably faster, as it does not require the use of high-performance computing resources. It is also more appropriate for studying different species (rather than subpopulations within the same species) than any IM model method, because it drops the assumption of gene flow until the present.
Due to the number of parameters, it is not feasible to assess the performance of our method systematically over every region of the parameter space. However, our experience with simulated data sets suggests that there are two cases in which the variances of some estimators become inflated, in particular the variances of the estimators associated with the gene flow period . One of such cases arises whenever V is very small or T1 is very large, making it very unlikely that the genealogy of a pair of sequences under the IIM model is affected by events that occurred during the gene flow period. The second case arises when the values of the scaled migration rates are greater than one, so that the two subpopulations during the period of gene flow resemble a single panmictic population. In either of these cases, the very process of model fitting can become unstable, that is, the algorithm of maximisation of the likelihood may have difficulty converging.
It is not the goal of this paper to draw conclusions regarding the evolutionary history of Drosophila species. We used the data of Wang and Hey (2010) with the sole objective of demonstrating that our method can be applied efficiently and accurately to real data. In Table 7, we list both our estimates and those of Wang and Hey (2010) for a six-parameter isolation-with-migration model (the IM1 model – see Figure 4). The same table contains the estimates for our best-fitting IIM model. Our parameter estimates for the IM model agree well with those of Wang and Hey (2010). The reason that they do not match exactly lies in the fact that we have omitted the ‘screening procedure’ described in Wang and Hey (2010) and have therefore not excluded some of the most divergent sequences in the data set. It should also be borne in mind that our model of mutation is the infinite-sites model, whereas Wang and Hey (2010) have worked with the Jukes-Cantor model. Furthermore, our choice of sequence pairs was somewhat different: Wang and Hey (2010) randomly selected a pair of sequences at each locus, whereas we followed the procedure described in Section 3.2.1 above.
There are some notable differences between the estimates for both IM models and those for the IIM model: under the IIM model, the process of speciation is estimated to have started earlier (3.6 million years ago instead of 3.0 or 3.2 million years ago), to have reached complete isolation before the present time (1.5 million years ago), and to have a higher rate of gene flow (0.064 sequences per generation instead of 0.013 or 0.012 sequences).
The method we used assumes that relative mutation rates are known (see section 3.2.1). In reality, we must deal with estimates of these rates, and this introduces additional uncertainty which is not reflected in the standard errors and confidence intervals obtained. However, it should be noted that, in principle, this uncertainty can be reduced to any extent desired: the method-of-moments estimator of the relative mutation rates – given by equation (14) – is a consistent estimator, so increasing the number of observations will get us arbitrarily close to the true value of the parameter. Ideally, these observations should stem from outgroup sequences only, to avoid any dependence between the estimates of relative mutation rates and the observations on ingroup pairwise differences (this was not possible here since the Wang and Hey (2010) data included exactly one outgroup sequence for each locus).
Some assumptions of our IIM model, such as the infinite-sites assumption and the assumption of free recombination between loci and no recombination within loci, may not be sensible for some real data sets. The appropriateness of other assumptions, for example those regarding the constant size of populations or the constant rate of gene flow, will depend on the actual evolutionary history of the species or populations involved. How robust the IIM model is to severe violations of its assumptions is a question which lies beyond the scope of this paper. It is nevertheless obvious that, in any case, the IIM model is more robust than any model nested in it, including the IM model and models of complete isolation.
As long as the data consist of pairwise differences, the method of eigendecomposition is easily applicable to several other models of speciation. This is true for any model nested in the full IIM model; and it should also be true for any model that consists of a sequence of island models (with or without gene flow) and Wright-Fisher populations.
Supplementary material
In the ancillary files of this paper, we provide the R code to fit the IIM model and other simpler models, including the IM model, to data sets consisting of observations on the number of segregating sites between pairs of DNA sequences from a large number of independent loci.
Acknowledgements
We thank Ziheng Yang for some valuable discussions and helpful suggestions. We thank Yong Wang, Jody Hey, Nick Barton and Konrad Lohse for kindly providing the Drosophila DNA sequence data. This research was supported by the Engineering and Physical Sciences Research Council (grant number EP/K502959/1).
Appendix Proof of equation (8):
This proof has three parts. Part (i) proves the result under two assumptions: a) Qmig has three strictly negative eigenvalues and one zero eigenvalue, all of them real; and b) Qmig is diagonalizable. Part (ii) proves assumption a). Part (iii) proves assumption b). To simplify the notation, we denote Qmig by Q throughout the proof.
(i)
Consider the continuous-time Markov chain defined by the matrix Q. Let Pij(t), the (i, j) entry of the matrix P(t), be the probability that the process is in state j at time t into the past, given that the process starts in state i. P(t) can be calculated by solving the following initial value problem: where I4 is the four by four identity matrix. Under the assumptions that Q is diagonalizable and that its eigenvalues are real, the solution to this initial value problem is given by: where B denotes the diagonal matrix containing the real eigenvalues (βj, j ∈ {1,2,3,4}, of Q, and V is the matrix of left eigenvectors of Q. Note that Pi4(t) is the probability that the process has reached coalescence by time t, if it started in state i. In other words, it is the cdf of : where is the ith row vector of V−1, and v.4 the 4th column vector of V. Differentiating, we get the pdf:
If we denote the eigenvalue equal to zero by β4, and the remaining eigenvalues are strictly negative, this pdf can be written as a linear combination of exponential densities: where λj, = |βj| for j ∈ {1,2,3}.
(ii)
As Q is given by equation (3), its characteristic polynomial, 𝒫Q(β), is of the form β × 𝒫Q(r)(β), where Q(r) is the three by three upper-left submatrix of Q, that is:
Thus the eigenvalues of Q are the solutions to β × 𝒫Q(r)(β) = 0. Consequently, one of them is zero (β4, say) and the remaining three eigenvalues are also eigenvalues of Q(r). Now consider the similarity transformation
Because S is a symmetric matrix, its eigenvalues are real. Therefore, all the eigenvalues of Q(r) are real (a similarity transformation does not change the eigenvalues). S is also a negative definite matrix, since its first, second and third upper-left determinants are respectively negative, positive, and negative. Hence its eigenvalues are all strictly negative, and so are the eigenvalues of Q(r). Hence Q has one zero eigenvalue (β4) and three real, strictly negative eigenvalues (β1,β2 and β3).
(iii)
Being a symmetric matrix, S has three independent eigenvectors. A similarity transformation preserves the number of independent eigenvectors, so Q(r) has three independent eigenvectors as well. We denote by V(r) the matrix whose rows are the left eigenvectors of Q(r).
By definition, any left eigenvector vj of Q satisfies the system of equations x(Q – Iβj) = 0, where x = [x1 x2 x3 x4]. The first three linear equations of this system are identical to x(r)(Q(r) – Iβj) = 0, for j ∈ {1,2,3} and x(r) = [x1 x2 x3], which is solved by . So this implies that, for βj ∈ {β1, β2, β3}, any row vector x in ℝ4 that has as its first three elements will solve the first three equations of the system, whatever the value of x4. If , that vector will be an eigenvector of Q, because it also solves the fourth equation of the system: for βj ∈ {β1,β2,β3}. For the case of βj = β4 = 0, a row eigenvector is [0 0 0 1]. Collecting these row eigenvectors in a single matrix, we get V. So,
If the matrix V can be shown to be invertible, then Q is diagonalizable. This will be the case if the system xV = 0 can only be solved by x = [0 0 0 0]. Now since the three by three upper-left submatrix of V, V(r), is full-ranked, x1 = x2 = x3 = 0 is a necessary condition for xV = 0. But then x4 = 0, from the last equation of the system. Thus we have shown that Q is diagonalizable. ෦
Footnotes
email: rui.costa.11{at}ucl.ac.uk