Abstract

Sophisticated inferential tools coupled with the coalescent model have recently emerged for estimating past population sizes from genomic data. Recent methods that model recombination require small sample sizes, make constraining assumptions about population size changes, and do not report measures of uncertainty for estimates. Here, we develop a Gaussian process-based Bayesian nonparametric method coupled with a sequentially Markov coalescent model that allows accurate inference of population sizes over time from a set of genealogies. In contrast to current methods, our approach considers a broad class of recombination events, including those that do not change local genealogies. We show that our method outperforms recent likelihood-based methods that rely on discretization of the parameter space. We illustrate the application of our method to multiple demographic histories, including population bottlenecks and exponential growth. In simulation, our Bayesian approach produces point estimates four times more accurate than maximum-likelihood estimation (based on the sum of absolute differences between the truth and the estimated values). Further, our method’s credible intervals for population size as a function of time cover 90% of true values across multiple demographic scenarios, enabling formal hypothesis testing about population size differences over time. Using genealogies estimated with ARGweaver, we apply our method to European and Yoruban samples from the 1000 Genomes Project and confirm key known aspects of population size history over the past 150,000 years.

FOR a single nonrecombining locus, neutral coalescent theory predicts the set of timed ancestral relationships among sampled individuals, known as a gene genealogy (Kingman 1982; Hudson 1983, 1990; Tajima 1983). In the coalescent model with variable population size, the rate at which two lineages have a common ancestor (or coalesce) is a function of the population size in the past. Here we denote the population size trajectory by N(t), where t is time in the past, and use the term local genealogy to describe ancestral relationships at one nonrecombining locus. When analyzing multilocus sequences, a single local genealogy will not represent the full history of the sample. Instead, the set of ancestral relationships and recombination events among a sample of multilocus sequences can be represented by a graph, known as the ancestral recombination graph (ARG), which depicts the complex structure of neighboring local genealogies and results in a computationally expensive model for inferring N(t) (Griffiths and Marjoram 1997; Wiuf and Hein 1999).

Recent studies have leveraged approximations for the coalescent with recombination—the sequentially Markov coalescent (SMC) (McVean and Cardin 2005) and its variant SMC′ (Marjoram and Wall 2006; Chen et al. 2009)—both of which model local genealogies as a continuous-time Markov process along sequences (Figure 1). The difference between the SMC and the SMC′ is that the SMC models only the class of recombination events that alter local genealogies of the sample; in general, the SMC′ is a better approximation to the ARG than the SMC (Chen et al. 2009; Wilton et al. 2015). Because of these features, in this work we rely on the SMC′ to model local genealogies with recombination.

Figure 1

SMC′ hidden Markov model for inferring population size trajectories, drawn according to Rasmussen et al. (2014) to highlight notation specific to our study. (A) Observed sequence data in a segment of length L from five individuals. Three loci are shown delimited by recombination breakpoints b1 and b2. Only the derived mutations at polymorphic sites are shown. (B) Corresponding local genealogies gi for each locus i. The five sampled individuals are depicted as solid black circles. Local genealogies have a Markovian degree-1 dependency. Each intercoalescent time (the time interval between coalescent events denoted as open circles) provides information about past population size (number of solid gray circles at a given time point). Moving from left to right after recombination breakpoint b1, the pruning location p1 is selected from genealogy g0 and the pruned branch is regrafted back on the genealogy (solid blue circle). The coalescent event of g0 depicted as a solid red circle in g1 is deleted. This creates the next genealogy g1. The process continues until L. At L, the population size trajectory N(t) (depicted as a black curve superimposed on g2) can be inferred.

Under the coalescent and SMC′ models, population size trajectories and sequence data are separated by two stochastic processes: (i) a state process that describes the relationship between the population size trajectory and the set of local genealogies and (ii) an observation process that describes how the hidden local genealogies are observed through patterns of nucleotide diversity in the sequence data. The observation process includes mutation and genotyping error while the state process models coalescence. Population size trajectories are then inferred from sequence data, using these coalescent-based hidden Markov models. In this study, we restrict attention to the state process and present a novel Bayesian approach for inferring population size trajectories from local genealogies. We solve a number of key modeling and inference problems and thus provide a basis for developing efficient algorithms to infer population parameters from sequence data directly.

Whole-genome inference of population size trajectories has been hampered by the enormous state space of local genealogies for large sample sizes. The pioneering pairwise sequentially Markov coalescent (PSMC) method of Li and Durbin (2011) employed the SMC to infer N(t) from a sample of size 2 (n=2). In this method, time is discretized and the population size trajectory is piecewise constant. Subsequent methods for samples larger than 2 similarly rely on the discretization of time. The natural extension of the PSMC to n>2 is the multiple sequentially Markovian coalescent (MSMC) (Schiffels and Durbin 2014). However, the MSMC models only the most recent coalescent event of the sample; thus MSMC’s estimation of population sizes is limited to very recent times. Other recent methods propose efficient ways of exploring the state space of hidden genealogies for n>2 (Sheehan et al. 2013; Rasmussen et al. 2014), yet also rely on discretizing the state space of local genealogies and assume a piecewise constant trajectory of population sizes.

Gaussian process-based Bayesian inference of population size trajectories has proved to be a powerful and flexible nonparametric approach when applied to a single local genealogy (Palacios and Minin 2013; Lan et al. 2015). The two main advantages of the Gaussian process (GP)-based approach are (i) it does not require a specific functional form of the population size trajectory (such as constant or exponential growth) and (ii) it does not require an arbitrary specification of change points in a piecewise constant or linear framework.

In this article, we overcome the limitations of existing methods—discretizing time, assuming a piecewise constant trajectory, and reporting only point estimates for past population sizes—by introducing a Bayesian nonparametric approach with a GP to model the population size trajectory as a continuous function of time. More specifically, we model the logarithm of the population size trajectory a priori as a Gaussian process (the log ensures our estimates are positive). As mentioned above, we assume that local gene genealogies are known. For our Bayesian approach, we develop a Markov chain Monte Carlo (MCMC) method to sample from the posterior distribution of population sizes over time. Our MCMC algorithm uses the recently developed algorithm, split Hamiltonian Monte Carlo (splitHMC) (Shahbaba et al. 2014; Lan et al. 2015). To compare our Bayesian GP-based estimation of population size trajectories with a piecewise constant maximum-likelihood-based estimation (e.g., Li and Durbin 2011; Sheehan et al. 2013; Schiffels and Durbin 2014), we implement the expectation-maximization (EM) algorithm within our framework and compute the observed Fisher information to obtain confidence intervals of the maximum-likelihood estimates.

Finally, we address a key problem for inference of population size trajectories under sequentially Markov coalescent models: the efficient computation of transition densities needed in the calculation of likelihoods. Here, we express the transition densities of local genealogies in terms of local ranked tree shapes (Tajima 1983) and coalescent times and show that these quantities are statistically sufficient for inferring population size trajectories either from sequence data directly or from the set of local genealogies. The use of ranked tree shapes allows us to exploit the state process of local genealogies efficiently since the space of ranked tree shapes has a smaller cardinality than the space of labeled topologies (Sainudiin et al. 2014).

Methods: SMC′ Calculations

Following notation similar to that in Rasmussen et al. (2014) (Table 1), a realization of the embedded SMC′ chain consists of a set of m local genealogies (g0,g1,,gm1),  m1 recombination breakpoints at chromosomal locations (b1,b2,,bm1), and m1 pruning locations (p1,p2,,pm1), where pi=(ui,wi) indicates the time of the recombination event ui and the branch wi where recombination happened in genealogy gi1 (Figure 1). Genealogy g0 corresponds to the genealogy of n sequences that contains the set of timed ancestral relationships among the n individuals for the chromosomal segment (0,b1]. Genealogy gi corresponds to the genealogy of the same n sequences for the chromosomal segment (bi,bi+1] for i=1,2,,m2. Finally, tji denotes the time when two of j lineages coalesce in genealogy gi, measured in units of generations before present.

Notation for the SMC′ model used in this work

Table 1
Notation for the SMC′ model used in this work
SymbolDescription
Parameters
 ρRecombination rate per site per generation
N(t)Effective population size trajectory with time measured in units of N0 generations
 τHyperparameter that controls the smoothness of the log-Gaussian process prior on N(t)
Notation specific to SMC′ chain
 LLength of observed sequences
biChromosomal location of the ith recombination breakpoint
 mNo. local genealogies corresponding to m1 recombination events
si+1=bi+1biSegment length for local genealogy i
giLocal genealogy for the segment (bi1,bi]
Notation specific to local genealogy
 nSample size or no. sequences
liTotal tree length of local genealogy gi
Ai(t)Piecewise constant function of the number of ancestral lineages at time t in local genealogy gi
tjiCoalescent time in genealogy gi when two of j lineages coalesce. Ai(tji)=j;  Ai(tji+)=j1.
ti=(tni,tn1i,,t2i)Vector of coalescent times of genealogy gi
pi=(ui,wi)Pruning location along local genealogy gi
uiTime when the recombination event happened along the height of the genealogy gi
wiLineage on genealogy gi1 where the recombination event happened
wiNew lineage added on genealogy gi where the recombination event happened
tnewiCoalescent time in genealogy gi when the lineage wi coalesces
tdeliCoalescent time in genealogy gi1 that no longer exists in genealogy gi
ciLineage on genealogy gi that coalesces with lineage wi
Fj,kiNo. free lineages in local genealogy gi that do not coalesce in the time interval (tj+1i,tki)
Ii(t)Piecewise constant function that takes values in {0,1,2} indicating no. ancestral lineages at time t in genealogy gi where the pruning event would produce a visible transition to gi+1
Discretization
 dNo. change points at which N(t) is estimated
x=(x1,,xd)Times at which N(t) is estimated
SymbolDescription
Parameters
 ρRecombination rate per site per generation
N(t)Effective population size trajectory with time measured in units of N0 generations
 τHyperparameter that controls the smoothness of the log-Gaussian process prior on N(t)
Notation specific to SMC′ chain
 LLength of observed sequences
biChromosomal location of the ith recombination breakpoint
 mNo. local genealogies corresponding to m1 recombination events
si+1=bi+1biSegment length for local genealogy i
giLocal genealogy for the segment (bi1,bi]
Notation specific to local genealogy
 nSample size or no. sequences
liTotal tree length of local genealogy gi
Ai(t)Piecewise constant function of the number of ancestral lineages at time t in local genealogy gi
tjiCoalescent time in genealogy gi when two of j lineages coalesce. Ai(tji)=j;  Ai(tji+)=j1.
ti=(tni,tn1i,,t2i)Vector of coalescent times of genealogy gi
pi=(ui,wi)Pruning location along local genealogy gi
uiTime when the recombination event happened along the height of the genealogy gi
wiLineage on genealogy gi1 where the recombination event happened
wiNew lineage added on genealogy gi where the recombination event happened
tnewiCoalescent time in genealogy gi when the lineage wi coalesces
tdeliCoalescent time in genealogy gi1 that no longer exists in genealogy gi
ciLineage on genealogy gi that coalesces with lineage wi
Fj,kiNo. free lineages in local genealogy gi that do not coalesce in the time interval (tj+1i,tki)
Ii(t)Piecewise constant function that takes values in {0,1,2} indicating no. ancestral lineages at time t in genealogy gi where the pruning event would produce a visible transition to gi+1
Discretization
 dNo. change points at which N(t) is estimated
x=(x1,,xd)Times at which N(t) is estimated
Table 1
Notation for the SMC′ model used in this work
SymbolDescription
Parameters
 ρRecombination rate per site per generation
N(t)Effective population size trajectory with time measured in units of N0 generations
 τHyperparameter that controls the smoothness of the log-Gaussian process prior on N(t)
Notation specific to SMC′ chain
 LLength of observed sequences
biChromosomal location of the ith recombination breakpoint
 mNo. local genealogies corresponding to m1 recombination events
si+1=bi+1biSegment length for local genealogy i
giLocal genealogy for the segment (bi1,bi]
Notation specific to local genealogy
 nSample size or no. sequences
liTotal tree length of local genealogy gi
Ai(t)Piecewise constant function of the number of ancestral lineages at time t in local genealogy gi
tjiCoalescent time in genealogy gi when two of j lineages coalesce. Ai(tji)=j;  Ai(tji+)=j1.
ti=(tni,tn1i,,t2i)Vector of coalescent times of genealogy gi
pi=(ui,wi)Pruning location along local genealogy gi
uiTime when the recombination event happened along the height of the genealogy gi
wiLineage on genealogy gi1 where the recombination event happened
wiNew lineage added on genealogy gi where the recombination event happened
tnewiCoalescent time in genealogy gi when the lineage wi coalesces
tdeliCoalescent time in genealogy gi1 that no longer exists in genealogy gi
ciLineage on genealogy gi that coalesces with lineage wi
Fj,kiNo. free lineages in local genealogy gi that do not coalesce in the time interval (tj+1i,tki)
Ii(t)Piecewise constant function that takes values in {0,1,2} indicating no. ancestral lineages at time t in genealogy gi where the pruning event would produce a visible transition to gi+1
Discretization
 dNo. change points at which N(t) is estimated
x=(x1,,xd)Times at which N(t) is estimated
SymbolDescription
Parameters
 ρRecombination rate per site per generation
N(t)Effective population size trajectory with time measured in units of N0 generations
 τHyperparameter that controls the smoothness of the log-Gaussian process prior on N(t)
Notation specific to SMC′ chain
 LLength of observed sequences
biChromosomal location of the ith recombination breakpoint
 mNo. local genealogies corresponding to m1 recombination events
si+1=bi+1biSegment length for local genealogy i
giLocal genealogy for the segment (bi1,bi]
Notation specific to local genealogy
 nSample size or no. sequences
liTotal tree length of local genealogy gi
Ai(t)Piecewise constant function of the number of ancestral lineages at time t in local genealogy gi
tjiCoalescent time in genealogy gi when two of j lineages coalesce. Ai(tji)=j;  Ai(tji+)=j1.
ti=(tni,tn1i,,t2i)Vector of coalescent times of genealogy gi
pi=(ui,wi)Pruning location along local genealogy gi
uiTime when the recombination event happened along the height of the genealogy gi
wiLineage on genealogy gi1 where the recombination event happened
wiNew lineage added on genealogy gi where the recombination event happened
tnewiCoalescent time in genealogy gi when the lineage wi coalesces
tdeliCoalescent time in genealogy gi1 that no longer exists in genealogy gi
ciLineage on genealogy gi that coalesces with lineage wi
Fj,kiNo. free lineages in local genealogy gi that do not coalesce in the time interval (tj+1i,tki)
Ii(t)Piecewise constant function that takes values in {0,1,2} indicating no. ancestral lineages at time t in genealogy gi where the pruning event would produce a visible transition to gi+1
Discretization
 dNo. change points at which N(t) is estimated
x=(x1,,xd)Times at which N(t) is estimated
Using uppercase letters to denote random variables, the evolution of the SMC′ process along chromosomal segments is governed by a point process B={Bi}i that represents the random locations of recombination breakpoints. We use Si=BiBi1, for i=1,2,,m, to denote the segment lengths for each local genealogy, with S0=B0=0. Let G={Gi}i be the chain that records the local genealogies, and let P=(U,W)={(Ui,Wi)}i represent the chain that records the pruning locations (time and branch) on G. The sequence (Gi,Pi={Ui,Wi},Bi) has the following conditional independence relation:
Pr[Gi=gi,Uiui,Wi=wi,Sis|{gj,bj}j=0i1,{uj,wj}j=1i1]
=Pr[Sisi|gi1]
(1)
×Pr[Uiui,Wi=wi|gi1]
(2)
×Pr[Gi=gi|Uiui,Wi=wi,gi1].
(3)
Thus, given a chain of local genealogies, pruning locations, and recombination breakpoints, the joint transition probability to a new genealogy, pruning location, and locus length can be expressed as the product of the locus-length probability conditioned on the current genealogy (Expression 1, above), the pruning location probability conditioned on the current genealogy (Expression 2, above), and the transition probability of the new genealogy conditioned on the current genealogy and pruning location (Expression 3, above).

Complete data transition densities

Consider the chain of local genealogies g=(g0,g1,,gm1) with recombination breakpoints at b=(0,b1,,bm1). According to the SMC′ process, the first local genealogy g0 follows the standard coalescent density
Pr[G0=g0|N(t)]=j=2n1N(tj0)exp{tj+10tj0A0(t)(A0(t)1)dt2N(t)},
(4)
where tn+10=0 and tn0<<t20 are the set of coalescent times in local genealogy g0. The piecewise constant function Ai(t) denotes the number of ancestral lineages present at time t in genealogy gi; that is, Ai(t)=j=1nj1t(tj+1i,tji), with t1i=.
Given a current local genealogy gi1, the distribution of the length Si=Bibi1 of the current locus depends on the current state of the SMC′ chain through the local genealogy’s total tree length li1 (the sum of all branch lengths in gi1) and the recombination rate per site per generation ρ:
f(si|gi1,ρ)=ρli1exp{ρli1si}.
(5)
At recombination breakpoint bi, a new local genealogy gi is generated that depends on the previous local genealogy gi1 and the population size trajectory N(t) (Figure 1). To generate gi we first randomly choose a pruning location pi (consisting of a pruning time ui and a lineage wi) uniformly along gi1. At pruning location pi, we add a new lineage wi and coalesce it further in the past at time tnewi with some lineage, ci (Figure 2). We then delete the wi lineage’s segment from ui to tdeli (the coalescent time of lineage wi). The transition density to a new genealogy at recombination breakpoint bi is then
Figure 2

Schematic representation of SMC′ transitions given a recombination breakpoint at location bi (indicated as an arrow in each panel). (A) Visible transition. We uniformly sample the pruning location pi from gi1 at time ui along some branch wi, and we add a new branch wi at ui and regraft it (dashed black line). The new branch wi coalesces with some branch ci at time tnewi. We then delete branch wi and the coalescent time tdeli to generate genealogy gi. Any pruning time along the branch wi (shown in green) would have produced the same visible transition from gi1 to gi. (B) Invisible transition. We uniformly sample the pruning location pi=(ui,wi), add a new branch wi at ui, and regraft it. The new branch wi coalesces with itself (dashed black line), that is, Ci=wi, and then the segment (ui,tdeli) of wi is deleted. If Ci=wi, any pruning location along the green branches would have produced the same invisible transition.

Pr[pi=(ui,wi),tnewi,ci|gi1,N(t)]
=Pr[pi=(ui,wi)|gi1]Pr[tnewi,ci|ui,gi1,N(t)]
=(1li1)1N(tnewi)exp{uitnewiAi1(t)dtN(t)},
(6)
where li1 denotes the total tree length of gi1.

This generative process for local genealogies can result in a visible transition, where a genealogy gi is different from gi1 (Figure 2A), or an invisible transition, where gi is identical to gi1 (Figure 2B).

An invisible transition (gi=gi1) occurs when ci=wi. Given the pruning location pi=(ui,wi), an invisible transition occurs when Tnewi(ui,tdeli) and Ci, the random variable indicating the lineage that coalesces with lineage wi, takes the value wi. The probability of an invisible transition is given by
Pr[Gi=gi1|pi=(ui,wi),gi1,N(t)]
=Pr[uiTnewitdeli,Ci=wi|pi=(ui,wi),gi1,N(t)]
=uitdeli1N(t)exp{uitAi1(u)duN(u)}dt.
Thus, the joint transition probability to an invisible event with pruning location (ui,wi), given gi1, is
Pr[Gi=gi1,pi=(ui,wi)|gi1,N(t)]
=1li1Pr[Gi=gi1|pi=(ui,wi),gi1,N(t)].

Transition densities averaged over unknown pruning locations

Even though we assume that local genealogies are known, to build inferential frameworks for sequence data in the future, we do not wish to make the same assumption about pruning locations. Thus, we average over pruning locations to obtain marginal transition densities between genealogies for both visible and invisible transitions.

Visible transitions:

To compute the marginal visible transition density to a new genealogy gi={gi1{tdeli}{tnewi,(wi,ci)}}, we need to average over all possible pruning locations pi=(ui,wi) along gi1. By comparing the two genealogies gi1 and gi in Figure 2A, we know that pi corresponds to the lineage wi some time along (0,t4i1) or, equivalently, along (0,tdeli). In general, comparison of gi1 and gi may not provide complete information to identify the lineage that was pruned. When the children of the node corresponding to tdel and the children of the node corresponding to tnew are the same, pruning different branches can lead to the same transition. We enumerate all cases of incomplete information for visible transitions in Supporting Information, File S1, and File S2.

We introduce a function Ii1(t), equal to the number of possible lineages at time t where the pruning location along gi1 would produce a visible transition to gi. Ii1(t) is a piecewise constant function that takes the values in {0,1,2} depending on whether the pruning location pi can happen in 0,1, or 2 branches at time t. In the example in Figure 2A,
Ii1(t)={1,ift(0,t4i1),0,ift(t4i1,).
(7)
For a general piecewise constant function Ii1(t), the marginal visible transition density to a new genealogy is
Pr[Gi=gi|gi1,N(t)]=1li10Ii1(u) Pr[tnewi,ci|u,wi]du=1li10Ii1(u)1N(tnewi)exp{utnewiAi1(t)dtN(t)}du.
(8)

Invisible transitions:

To compute the marginal transition probabilities for invisible events, we must average over all possible pruning locations pi. Consider the example in Figure 2B and choosing a pruning time (ui) along gi1. To have an invisible transition, the coalescing branch Ci must be the same pruning branch Wi. In Figure 2B the new coalescent time Tnewi can happen along five lineages in the interval (0,t5i1), three lineages in the interval (t5i1,t4i1), and two lineages in the interval (t4i1,t3i1). To generalize this calculation, we introduce the quantity Fj,ki with njk2, which denotes the number of lineages in gi that are free (do not coalesce), in the time segment (tj+1i,tki), with tn+1i=0. The time interval (tj+1i,tki) includes the interval of pruning (tj+1i,tji) up to the interval of self-coalescence (tk+1i,tki). Thus, if the pruning time happens at time Ui(tj+1i,tji), an invisible transition with new coalescent time Tnewi(tk+1i,tki) can happen along Fj,ki free lineages.

In Figure 2B, ui happened in the time interval (0,t5i1). If the new coalescent time Tnewi happens in the interval (ui,t5i1) along the same (unknown) pruning branch, then this invisible transition has probability
Pr[Gi=gi1,Tnewi(t6i1,t5i1)|ui,gi1,N(t)]=F5,5i1uit5i11N(t)exp{uitAi1(u)duN(u)}dt,
with F5,5=5.
Now consider the same example of Figure 2B but with an unknown pruning time ui. The joint event where recombination occurs at pruning time Ui(t6i1,t5i1) and coalescent time Tnewi occurs in the interval (t6i1,t5i1) and this results in an invisible transition has probability
Pr[Gi=gi1,Ui(t6i1,t5i1),Tnewi(t6i1,t5i1)|gi1,N(t)]
=F5,5i1t6i1t5i1uit5i1(1/N(t))exp{uit(Ai1(u)du/N(u))}dtduili1
(9)
=F5,5i1P5,5i1li1,
(10)
where P5,5i1 denotes the double integral expression in Equation 9 for ease of notation.
An invisible transition would also result if Ui(t6i1,t5i1) and Tnewi(t5i1,t4i1) along the same (unknown) pruning branch; in Figure 2B, this can happen along three lineages, so F5,4i1=3 and this event has probability
Pr[Gi=gi1,Ui(t6i1,t5i1),Tnewi(t5i1,t4i1)|gi1,N(t)]=F5,4i1t6i1t5i1exp{uit5i1(Ai1(u)du/N(u))}li1×t5i1t4i11N(t)exp{t5i1tAi1(u)duN(u)}dtdui=F5,4i1P5,4i1li1.
If we continue considering the cases where Ui(t6i1,t5i1) and Tnewi(t4i1,t3i1) or Tnewi(t3i1,t2i1), we have F5,3i1=2 and F5,2i1=0. Then, the joint probability of an invisible event and Ui(t6i1,t5i1) is
Pr[Gi=gi1,Ui(t6i,t5i)|gi1,N(t)]=k=25Fj,ki1Pj,ki1li1.
For the cases when Ui(tj+1i1,tji1) and the new coalescent time Tnewi falls in another coalescent interval (tk+1i1,tki1), we need to compute the following: the joint probability of Ui(tj+1i1,tji1) and no coalescence in the interval (ui,tji1),
1li1Qji1=1li1tj+1i1tji1exp{uitji1Ai1(u)duN(u)}dui;
the probability of no coalescence in any of the intermediate coalescent intervals (tl+1i1,tli1),
qli1=exp{tl+1i1tli1Ai1(u)duN(u)};
and the probability of coalescing at Tnewi(tk+1i1,tki1),
1qki1.
Then,
1li1Pj,ki1=1li1Qji1qj1i1qj2i1qk+1i1(1qki1)
represents the probability that the pruning location is wi at time Ui(tj+1i1,tji1) and the new lineage wi coalesces at time Tnewi(tk+1i1,tki1) with lineage ci=wi. Overall, the marginal transition probability to an invisible event is
Pr[Gi=gi1|gi1,N(t)]=0t2i1Pr[Gi=gi1,ui|gi1,N(t)]dui=j=2nPr[Gi=gi1,Ui(tj+1i1,tji1)|gi1,N(t)]=1li1j=2nk=2jFj,ki1Pj,ki1.
(11)

The likelihood of the embedded SMC′ chain

Instead of having a complete realization of the embedded SMC′ chain of m local genealogies g0,,gm1 and pruning locations p1,,pm1 at recombination breakpoints b1,,bm1, we assume that our data (unless otherwise noted) consist only of m local genealogies at recombination breakpoints from a chromosomal segment of length L (including visible and invisible events). Note that our observed data are not sequence data. More specifically, our observed data are
Y={(g0,0),(g1,b1),(gm1,bm1),sm=Lbm1}.
(12)
Then, the observed data likelihood is
obs(Y;N(t),ρ)=Pr[g0|N(t)][i=0m2Pr[gi+1|gi,N(t)]]factorsthatdependonN(t)×h(Lbm1|gm1,ρ)[i=0m2f[si+1|gi,ρ]]factorsthatdependonρ,
(13)
where h(Lbm1|gm1,ρ) is the survival function in state gm1. Equation 13 is factored into terms that depend on N(t) alone and ones that depend on ρ alone. The terms that depend on ρ, given by Equation 5, depend on the data only through total tree lengths l0,,lm1 and locus lengths s1,,sm1,Lbm1. By the factorization theorem for sufficient statistics, local tree lengths l0,,lm1 and locus lengths s1,,sm1,Lbm1 are sufficient for inferring ρ. Moreover, recombination locations b0,b1,,bm1 do not provide information about N(t).

Methods: Inference

Current coalescent-based methods that infer a population size trajectory N(t) from whole-genome data assume N(t) is a piecewise constant function with change points x1=0<x2<<xd (Li and Durbin 2011; Sheehan et al. 2013; Rasmussen et al. 2014; Schiffels and Durbin 2014). That is,
N(t)=i=1dNi1t(xi1,xi].
(14)
Equation 14 presents two challenges. The first challenge lies in the specification of the change points: the narrower an interval is, the higher the probability that we do not observe coalescent times in that interval; further, the fewer observed coalescent times in an interval, the greater the uncertainty is of the estimate N^i (if the estimate even exists). The second challenge lies in the specification of the time window (0,xd): if xd is set too far in the past, we might not have enough data to accurately estimate N(t) for xdt<.
To solve the first challenge, Li and Durbin (2011) and Rasmussen et al. (2014) distribute the d change points evenly on a logarithmic scale,
xj=1κ{exp[jdlog(1+κxd)]1},
(15)
where κ is specified by the user. Schiffels and Durbin (2014) propose discretizing time according to the quantiles of the exponential distribution, xj=(1/λ)log[1j/d], where λ is the rate of an exponential distribution. Schiffels and Durbin (2014) model the time to the most recent coalescent event and set λ=(n2) However, this equation is not directly applicable here because we use all coalescent events for inference.

In the following sections, we first present our Bayesian nonparametric method and then develop a maximum-likelihood method under a piecewise constant trajectory so we can directly compare an EM-based method to our Bayesian nonparametric method.

Gaussian-process-based Bayesian nonparametric estimation of N(t)

For our Bayesian methodology, we assume the log-Gaussian process prior on the population size trajectory,
N(t)=exp[f(t)], f(t)GP(0,C(τ)),
(16)
where GP(0,C(τ)) denotes a Gaussian process with mean function 0 and inverse covariance function C1(τ)=τC1 with precision parameter τ. For computational convenience, we use Brownian motion as our prior for f(t) since its inverse covariance matrix is sparse. We place a Gamma prior on the precision parameter τ, τΓ(α,β). Assuming that recombination rate ρ is known, the posterior distribution of model parameters (Figure 3) is then
Figure 3

Structure of our Bayesian model for inferring population size trajectories from a realization of the SMC′ process at recombination breakpoints. Hyperparameter τ controls the smoothness of the log-Gaussian process prior on N(t). Local genealogies depend on N(t) and form a Markov chain of degree 1. Given the current local genealogy gi1, we sample the location of the new recombination breakpoint bi and a pruning location pi on genealogy gi1. The new genealogy gi depends on N(t),  pi, and gi1.

Pr[N(t),τ|g0,,gm1]Pr[g0|N(t)]×{i=0m2Pr[gi+1|gi,N(t)]}Pr[N(t)|τ]Pr(τ).
(17)
The first two factors on the right side of Equation 17, detailed in Equations 8 and 11, involve integration over N(t), an infinite-dimensional random function (Equation 16). We approximate the integral
abdtN(t)=abexp[f(t)]dt,
by the Riemann sum over a partition of the integration interval. That is,
abexp[f(t)]dtj=ikexp[fj*]Δj,
(18)
for xi<a<xi+1<<xk1<b<xk,  Δi=xi+1a,  Δk=bxk1, and Δj=xj+1xj for i<j<k1.  fj* is a representative value of f(t) in the interval (xj,xj+1); in our implementation, we set fj*=f(xj*) with xj*=(xj+xj+1)/2. This way, we discretize our time window in d evenly spaced segments x1=0<x2<<xd, with xd=max(t10,,t1m1), the maximum time to the most common ancestor observed in the sequence of local genealogies, and approximate N(t) by a piecewise linear function evaluated at (x1*,x2*,,xd*).
We condition on the set of m local genealogies g0,,gm1 (assuming pruning locations are not known) to generate posterior samples for the vector f*=[logN(x1*),,logN(xd*)] and τ and use these posterior samples to infer N(t) at t(x1*,,xd*), where xi*=(xi+xi+1)/2. Updating the vector f and τ separately is not recommended because of their strong dependency (Lan et al. 2015). Therefore, we update (f,τ) jointly in an MCMC sampling algorithm, using splitHMC (Shahbaba et al. 2014; Lan et al. 2015). splitHMC updates all model parameters jointly and it can be extended to a full inferential framework that is directly applicable to sequence data. The splitHMC method relies on Hamiltonian dynamics to propose a new state of the model parameters jointly with a higher acceptance rate than simple methods such as random-walk Metropolis (Neal 2009). splitHMC relies on our ability to calculate the log-likelihood of the observed data and the gradient vector of the log-likelihood (i.e., the score function). The log-likelihoods of the observed data are approximated via sums of the form in Equation 18. We approximate the score function obs(Y;f*) with respect to f* by applying Fisher’s identity,
obs(Y;f*)=Ef*[c(Yc;f*)|Y],
where, at each iteration in the MCMC, expectation is calculated using the current value of f* (see Appendix).

Alternatively, one can update N(t) in the MCMC algorithm, using the elliptical slice sampler (Murray et al. 2010) with a fixed value of τ (perhaps estimated from previous studies or from a preliminary run from the split Hamiltonian Monte Carlo algorithm). The advantage of using the elliptical slice sampler over the split Hamiltonian Monte Carlo is purely computational (the elliptical slice sampler does not require calculation of the score function).

Maximum-likelihood estimation of N(t) with measures of uncertainty

We assume that the population size trajectory N(t) is defined as in Equation 14. The standard coalescent density (Equation 4) and the transition densities defined in Equations 8 and 11 are tractable, so calculation of the likelihood (Equation 13) is tractable. However, maximization of the likelihood function cannot be performed analytically because pruning locations are missing. We implement an EM algorithm (Dempster et al. 1977) to find the maximum-likelihood estimator of N=(N1,,Nd). The complete data Yc for inferring N(t) are then the set of local genealogies g0,,gm1 and the set of pruning locations p1,pm1. For the invisible transitions, we also need to know the new coalescent times {tnewi}i∈ℐ, where {1,2,,m1} denotes the set of indexes of invisible transitions.

The complete data log-likelihood is then
c(Yc;N):=logPr[g0|N(t)]
(19)
+i=1m1logPr[pi=(ui,wi),tnewi,ci|gi1,N(t)].
The EM algorithm starts by initializing the population size trajectory to a piecewise constant function with change points x1,,xd with arbitrarily chosen vector N0. At the kth iteration of the algorithm we set
Nk=argmaxNENk1[c(Yc;N)|Y].
(20)
The conditional expectation in Equation 20 is conditional on the observed data Y defined in Equation 12. Let xi={x1i,x2i,,xd+n1i} be the ordered set of time points corresponding to the change points x1,,xd and the coalescent time points ti of local genealogy i. If the transition from gi to gi+1 is visible, we replace the jth time point xji by tnewi+1, where j corresponds to the index such that xj1i<tnewi+1xji. For ease of notation, we denote the number of time intervals |xi| by D=d+n2. Let
aj0={1,ifxj+10=tk0,fork=2,,n,0,otherwise,
be an indicator function that takes the value of 1 when the jth interval contains a coalescent time of the first genealogy g0. Then, the log density of the first genealogy is
logPr[g0|N(t)]=j=1D{aj0logN(xj+10)}j=1D{A0(xj+10)[A0(xj+10)1](xj+10xj0)exp[logN(xj+10)]2}.
(21)
Let
zji={1, ifxji<tnewi+1xj+1i,0,otherwise,
be an indicator function that takes the value of 1 when the new coalescent time of genealogy i happens in the corresponding time interval (xji,xj+1i), and let the adjusted interval length be
Δji={xj+1ixji,ifui+1<xji,andxj+1i<tnewi+1(afterpruningandbeforecoalescence),xj+1iui+1,ifxji<ui+1<xj+1itnewi+1(beforecoalescencewithpruningadjustment),tnewi+1ui+1,ifxji<ui+1<tnewi+1<xj+1(adjustmentforpruningandcoalescence),tnewi+1xji,ifui+1<xji<tnewi+1<xj+1i(afterpruningwithcoalescenceadjustment),0,otherwise.
Then, the augmented transition density can be expressed as
logPr[pi=(ui,wi),tnewi,ci|gi1,N(t)]=logPr[pi=(ui,wi),tnewi,ci,zi,Δi|gi1,N(t)]=logli1j=1D{zji1logN(xj+1i1)}j=1D{Ai1(xj+1i1)Δji1exp[logN(xj+1i1)]},
(22)
where zi and Δi are the vectors with zji and Δji elements. For the EM algorithm we need to compute the conditional expected vectors E[zji|Y] and E[Δji|Y]. The details of these calculations are in the Appendix.
We use the Fisher information matrix to compute approximate standard errors of logN^ and use these standard errors together with asymptotic normality of maximum-likelihood estimators to produce confidence intervals for log population size piecewise trajectories. We compute the observed Fisher information matrix following Louis (1982),
I^Y[N^]=EN^[Hc(Yc;N^)|Y]EN^[c(Yc;N^)c(Yc;N^)|Y],
where c(Yc;N^) is the gradient and Hc(Yc;N^) is the Hessian of the complete-data log-likelihood with respect to logN. This requires the calculation of conditional cross-product means and conditional second moments described in File S7.

Data availability

The R code for all simulation studies and analysis of sequence data conducted in this article are publicly available at http://ramachandran-data.brown.edu/.

Results

We simulated 1000 local genealogies of 2, 20, and 100 individuals from each of the three different demographic models described in Table 2, using MaCS (Chen et al. 2009); see File S3 for details of these simulations. We assumed that all individuals were sampled at time t=0.

Simulated demographic scenarios

Table 2
Simulated demographic scenarios
Demographic modelN(t)
Constant population sizeN(t)=1
Exponential growth followed by constant sizeN(t)={1,fort(0,0.1),exp[10(t0.1)],fort(0.1,).
Population bottleneckN(t)={1,fort(0,0.3),0.1,fort(0.3,0.5),1,fort(0.5,).
Demographic modelN(t)
Constant population sizeN(t)=1
Exponential growth followed by constant sizeN(t)={1,fort(0,0.1),exp[10(t0.1)],fort(0.1,).
Population bottleneckN(t)={1,fort(0,0.3),0.1,fort(0.3,0.5),1,fort(0.5,).

The argument t denotes time measured in units of N0 generations.

Table 2
Simulated demographic scenarios
Demographic modelN(t)
Constant population sizeN(t)=1
Exponential growth followed by constant sizeN(t)={1,fort(0,0.1),exp[10(t0.1)],fort(0.1,).
Population bottleneckN(t)={1,fort(0,0.3),0.1,fort(0.3,0.5),1,fort(0.5,).
Demographic modelN(t)
Constant population sizeN(t)=1
Exponential growth followed by constant sizeN(t)={1,fort(0,0.1),exp[10(t0.1)],fort(0.1,).
Population bottleneckN(t)={1,fort(0,0.3),0.1,fort(0.3,0.5),1,fort(0.5,).

The argument t denotes time measured in units of N0 generations.

We compared our point estimates with the truth for each demographic model, using the sum of relative errors (SRE),
SRE=i=1K|N^(xi)N(xi)|N(xi),
(23)
where N^(xi) is the estimated population size trajectory at time xi. We compute SRE at equally spaced time points x1,,xK. Second, we compute the mean relative width (MRW) as
MRW=i=1K|N^up(xi)N^low(xi)|KN(xi),
(24)
where N^up(xi) corresponds to the 97.5% upper limit and N^low(xi) corresponds to the 2.5% lower limit of N^(xi). For EM estimates, [N^low(xi),N^up(xi)] corresponds to the 95% confidence interval estimated using the observed Fisher information; for Bayesian GP estimates, [N^low(xi),N^up(xi)] corresponds to the 95% Bayesian credible interval (BCI) of N^(xi). To measure how well these intervals cover the truth, we compute the envelope measure (ENV) in the following way:
ENV=i=1KI(N^up(xi)N(xi)N^low(xi))K.
(25)
We compute SRE, MRW, and ENV for K=150 at equally spaced time points.

For our Bayesian GP estimates, we estimate N(xi) at d=100 time points, unless stated otherwise.

The parameters of the Gamma prior on the GP precision parameter τ were set to α=β=0.001, reflecting our lack of prior information about the smoothness of the population size trajectory.

For our EM estimates, we used different discretizations based on Equation 15 and varying the number of change points d and κ over the fixed interval (0,xd) with xd set to be the maximum observed coalescent time. For the cases where we consider only one genealogy (m=1), the EM approach becomes standard maximum-likelihood estimation.

We summarize our posterior inference and compare our Bayesian GP method to the EM method in Figure 5, Figure 6, and Figure 7. The population size trajectory is log-transformed for ease of visualization and for direct comparison with other methods (Minin et al. 2008; Palacios and Minin 2013).

Sensitivity of EM estimates of N(t) to discretization

In Figure 4, we show our Bayesian GP and EM estimates of a constant population size trajectory from a single genealogy of 100 individuals with different discretizations. We find that our Bayesian GP point estimates depicted in Figure 4A recover the truth (dashed line) almost perfectly with less uncertainty than the EM (Figure 4, B and C). Comparing our Bayesian GP estimates with different discretizations [50, 100, and 200 equally spaced time points (Figure 4A)], we find that increasing the number of time points improves inference (Table 3) but that the differences between estimates among the three discretizations are marginal (Figure 4A). In contrast, we show that different grid definitions alter the EM estimates (Figure 4B). It is not clear how to define a good strategy for the definition of the grid for the EM method, even for the simple model of constant population size. For example, increasing κ from 100 to 500 with 5 change points (Figure 4B) does not improve estimation. Increasing the number of change points does not necessarily improve the estimates either, for example, increasing the number of change points from 5 to 10 for κ=10 (Figure 4, B and C). EM grid sensitivity is persistent even when the number of genealogies increases; Figure S2 in File S4 shows that the best definition of change points when our data consist of 1000 local genealogies of 100 individuals is 10 evenly distributed change points.

Figure 4

Sensitivity to parameter discretization. Population size trajectories estimated from one simulated genealogy (m=1) of 100 individuals with a constant population size are compared. We show true trajectories as dashed lines. (A) Bayesian GP estimates at d=50,100, and 200 equally spaced time points. (B) EM estimates of a piecewise constant trajectory with d=5 change points and κ=1,10, and 100 (Equation 15). (C) EM estimates of a piecewise constant trajectory with d=10 change points and κ=10,100, and 500 (Equation 15). Point estimates are shown as solid black lines. 95% percent credible intervals and 95% confidence intervals are shown by gray areas.

Summary statistics for simulation results depicted in Figure 4

Table 3
Summary statistics for simulation results depicted in Figure 4
Simulation of a single genealogy with n=100SREMRWENV (%)
MLE d=5,  κ=141.8014.76100.0
MLE d=5,  κ=1041.052.98100.0
MLE d=5,  κ=10057.121.72100.0
MLE d=10,  κ=1047.9316.08100.0
MLE d=10,  κ=10061.773.91100.0
MLE d=10,  κ=50031.523.60100.0
Bayesian GP d=506.981.88100.0
Bayesian GP d=1005.522.15100.0
Bayesian GP d=2004.961.70100.0
Simulation of a single genealogy with n=100SREMRWENV (%)
MLE d=5,  κ=141.8014.76100.0
MLE d=5,  κ=1041.052.98100.0
MLE d=5,  κ=10057.121.72100.0
MLE d=10,  κ=1047.9316.08100.0
MLE d=10,  κ=10061.773.91100.0
MLE d=10,  κ=50031.523.60100.0
Bayesian GP d=506.981.88100.0
Bayesian GP d=1005.522.15100.0
Bayesian GP d=2004.961.70100.0

SRE is the sum of relative errors (Equation 23), MRW is the mean relative width of the 95% BCI (Equation 24), and ENV is the envelope measure (Equation 25). Values in boldface type indicate best performance.

Table 3
Summary statistics for simulation results depicted in Figure 4
Simulation of a single genealogy with n=100SREMRWENV (%)
MLE d=5,  κ=141.8014.76100.0
MLE d=5,  κ=1041.052.98100.0
MLE d=5,  κ=10057.121.72100.0
MLE d=10,  κ=1047.9316.08100.0
MLE d=10,  κ=10061.773.91100.0
MLE d=10,  κ=50031.523.60100.0
Bayesian GP d=506.981.88100.0
Bayesian GP d=1005.522.15100.0
Bayesian GP d=2004.961.70100.0
Simulation of a single genealogy with n=100SREMRWENV (%)
MLE d=5,  κ=141.8014.76100.0
MLE d=5,  κ=1041.052.98100.0
MLE d=5,  κ=10057.121.72100.0
MLE d=10,  κ=1047.9316.08100.0
MLE d=10,  κ=10061.773.91100.0
MLE d=10,  κ=50031.523.60100.0
Bayesian GP d=506.981.88100.0
Bayesian GP d=1005.522.15100.0
Bayesian GP d=2004.961.70100.0

SRE is the sum of relative errors (Equation 23), MRW is the mean relative width of the 95% BCI (Equation 24), and ENV is the envelope measure (Equation 25). Values in boldface type indicate best performance.

Comparing methods for estimating N(t)

Figure 5 shows the estimated population size trajectories when the number of samples is two for the three different demographic scenarios and varying the number of local genealogies (100, 500, and 1000 local genealogies). For constant and exponential growth, our EM method assumes a piecewise constant trajectory of 10 change points (d=10) and κ=1, using Equation 15 (similar to Li and Durbin 2011 and Rasmussen et al. 2014). For the bottleneck scenario, some of the intervals did not have coalescent events; hence, for this case we assumed a piecewise constant trajectory of 5 change points (d=5) and κ=1 for constructing our EM estimates. We show the boxplots of the time to the most recent common ancestor (TMRCA) at the bottom of each plot in Figure 5, which indicate the uncertainty expected in our estimates.

Figure 5

Inference of population size trajectories N(t) for a pair of individuals (n=2). Simulated data under constant population size (A), exponential and constant trajectory (B), and a bottleneck (C). We show estimates from m=100,  m=500, and m=1000 local genealogies. Dashed lines show the true trajectories, blue lines and light blue areas represent EM point estimates and 95% confidence areas, and red lines and pink areas represent Bayesian GP posterior medians and 95% BCIs. Boxplots of the TMRCA are shown at the bottom of each plot.

Both approaches, EM and Bayesian GP, show narrower confidence and credible intervals at the center of the distribution of the TMRCA, particularly during the bottleneck in Figure 5C.

For the constant population size model in Figure 5A, our Bayesian GP considerably outperforms our EM estimates. This is not surprising since a priori  logN(t) has mean 0 in our Bayesian approach (Equation 16). Moreover, EM confidence intervals cover the truth only ∼30% of the time, while the GP method covers 100% of the truth (Table 4A). Despite placing a mean-0 prior on logN(t), the Bayesian GP method accurately recovers sudden changes as shown in the bottleneck scenario. Although our Bayesian GP prior on logN(t) is Brownian motion (which is not differentiable at any point), our Bayesian GP recovers smooth curves (Figure 5B).

Summary of simulation results depicted in Figure 5

Table 4
Summary of simulation results depicted in Figure 5
A. Simulations with n = 2
SREMRWENV
Simulation and methodm = 100m = 500m = 1000m = 100m = 500m = 1000m = 100 (%)m = 500 (%)m = 1000 (%)
Const. EM39.8041.7838.600.980.260.0831.328.019.3
Const. GP30.604.253.040.490.330.22100.0100.0100.0
Exp. EM64.6825.7033.700.910.160.1242.026.06.6
Exp. GP28.3832.7026.762.040.450.33100.056.050.6
Bottle. EM48.4846.51127.700.430.451.3740.630.034.0
Bottle. GP33.7645.14223.583.446.8417.1398.094.694.6
B. Simulations with n = 20
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM60.87121.3025.602.282.160.23100.037.739.3
Const. GP31.743.9413.221.060.700.36100.0100.0100.0
Exp. EM40.9740.6640.223.110.370.19100.038.619.3
Exp. GP25.3527.0365.613.531.560.42100.0100.039.3
Bottle. EM147.9378.4078.206.980.8168.466.078.649.33
Bottle. GP68.9378.250.922.742.471.4792.079.378.6
C. Simulations with n = 100
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM41.05220.8543.412.984.930.99100.035.348.0
Const. GP5.5234.7812.172.151.490.47100.0100.089.3
Exp. EM76.8640.2227.633.230.810.1387.342.014.0
Exp. GP114.5325.8226.423.571.550.83100.0100.0100.0
Bottle. EM194.7759.54127.683.951.080.8584.051.345.3
Bottle. GP90.2744.1442.686.982.621.74100.094.796.0
A. Simulations with n = 2
SREMRWENV
Simulation and methodm = 100m = 500m = 1000m = 100m = 500m = 1000m = 100 (%)m = 500 (%)m = 1000 (%)
Const. EM39.8041.7838.600.980.260.0831.328.019.3
Const. GP30.604.253.040.490.330.22100.0100.0100.0
Exp. EM64.6825.7033.700.910.160.1242.026.06.6
Exp. GP28.3832.7026.762.040.450.33100.056.050.6
Bottle. EM48.4846.51127.700.430.451.3740.630.034.0
Bottle. GP33.7645.14223.583.446.8417.1398.094.694.6
B. Simulations with n = 20
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM60.87121.3025.602.282.160.23100.037.739.3
Const. GP31.743.9413.221.060.700.36100.0100.0100.0
Exp. EM40.9740.6640.223.110.370.19100.038.619.3
Exp. GP25.3527.0365.613.531.560.42100.0100.039.3
Bottle. EM147.9378.4078.206.980.8168.466.078.649.33
Bottle. GP68.9378.250.922.742.471.4792.079.378.6
C. Simulations with n = 100
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM41.05220.8543.412.984.930.99100.035.348.0
Const. GP5.5234.7812.172.151.490.47100.0100.089.3
Exp. EM76.8640.2227.633.230.810.1387.342.014.0
Exp. GP114.5325.8226.423.571.550.83100.0100.0100.0
Bottle. EM194.7759.54127.683.951.080.8584.051.345.3
Bottle. GP90.2744.1442.686.982.621.74100.094.796.0

SRE is the sum of relative errors calculated as in (23), MRW is the mean relative width of the 95% BCI as Const: Constant population simulation scenario. Exp: Exponential growth followed by constant population size simulation scenario and Bottle: Population bottleneck. defined in (24), and ENV is the envelope measure calculated as in (25). Values in boldface type indicate best performance for each demographic model and sample size.

Table 4
Summary of simulation results depicted in Figure 5
A. Simulations with n = 2
SREMRWENV
Simulation and methodm = 100m = 500m = 1000m = 100m = 500m = 1000m = 100 (%)m = 500 (%)m = 1000 (%)
Const. EM39.8041.7838.600.980.260.0831.328.019.3
Const. GP30.604.253.040.490.330.22100.0100.0100.0
Exp. EM64.6825.7033.700.910.160.1242.026.06.6
Exp. GP28.3832.7026.762.040.450.33100.056.050.6
Bottle. EM48.4846.51127.700.430.451.3740.630.034.0
Bottle. GP33.7645.14223.583.446.8417.1398.094.694.6
B. Simulations with n = 20
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM60.87121.3025.602.282.160.23100.037.739.3
Const. GP31.743.9413.221.060.700.36100.0100.0100.0
Exp. EM40.9740.6640.223.110.370.19100.038.619.3
Exp. GP25.3527.0365.613.531.560.42100.0100.039.3
Bottle. EM147.9378.4078.206.980.8168.466.078.649.33
Bottle. GP68.9378.250.922.742.471.4792.079.378.6
C. Simulations with n = 100
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM41.05220.8543.412.984.930.99100.035.348.0
Const. GP5.5234.7812.172.151.490.47100.0100.089.3
Exp. EM76.8640.2227.633.230.810.1387.342.014.0
Exp. GP114.5325.8226.423.571.550.83100.0100.0100.0
Bottle. EM194.7759.54127.683.951.080.8584.051.345.3
Bottle. GP90.2744.1442.686.982.621.74100.094.796.0
A. Simulations with n = 2
SREMRWENV
Simulation and methodm = 100m = 500m = 1000m = 100m = 500m = 1000m = 100 (%)m = 500 (%)m = 1000 (%)
Const. EM39.8041.7838.600.980.260.0831.328.019.3
Const. GP30.604.253.040.490.330.22100.0100.0100.0
Exp. EM64.6825.7033.700.910.160.1242.026.06.6
Exp. GP28.3832.7026.762.040.450.33100.056.050.6
Bottle. EM48.4846.51127.700.430.451.3740.630.034.0
Bottle. GP33.7645.14223.583.446.8417.1398.094.694.6
B. Simulations with n = 20
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM60.87121.3025.602.282.160.23100.037.739.3
Const. GP31.743.9413.221.060.700.36100.0100.0100.0
Exp. EM40.9740.6640.223.110.370.19100.038.619.3
Exp. GP25.3527.0365.613.531.560.42100.0100.039.3
Bottle. EM147.9378.4078.206.980.8168.466.078.649.33
Bottle. GP68.9378.250.922.742.471.4792.079.378.6
C. Simulations with n = 100
SREMRWENV
m = 1m = 100m = 1000m = 1m = 100m = 1000m = 1 (%)m = 100 (%)m = 1000 (%)
Const. EM41.05220.8543.412.984.930.99100.035.348.0
Const. GP5.5234.7812.172.151.490.47100.0100.089.3
Exp. EM76.8640.2227.633.230.810.1387.342.014.0
Exp. GP114.5325.8226.423.571.550.83100.0100.0100.0
Bottle. EM194.7759.54127.683.951.080.8584.051.345.3
Bottle. GP90.2744.1442.686.982.621.74100.094.796.0

SRE is the sum of relative errors calculated as in (23), MRW is the mean relative width of the 95% BCI as Const: Constant population simulation scenario. Exp: Exponential growth followed by constant population size simulation scenario and Bottle: Population bottleneck. defined in (24), and ENV is the envelope measure calculated as in (25). Values in boldface type indicate best performance for each demographic model and sample size.

Table 4A shows the performance statistics for the estimates of N(t) in Figure 5. In general, our Bayesian GP has wider credible intervals than the EM confidence intervals but these credible intervals cover the true trajectory better than the EM confidence intervals in all cases (MRW and ENV in Table 4). Our Bayesian GP estimates also generally have smaller sums of relative errors (SRE in Table 4). Under the bottleneck scenario, our Bayesian GP produces greater sums of relative errors than does the EM, but our Bayesian GP estimates recover the truth more accurately than the EM during the bottleneck.

Figure 6 and Figure 7 show our estimates when n=20 and n=100 (Table 4, B and C, gives performance statistics). In general, our GP-based estimates have smaller SRE and larger ENV than the EM-based estimates and hence, the MRW is usually wider in the GP-based estimates, accurately reflecting the uncertainty of the estimates. As expected, increasing the number of loci (m) generally decreases the width of the confidence and credible intervals of our estimates (MRW). Although this is generally true for EM estimates as well, EM estimates have very low coverage of the truth (MRE in Table 4) when the number of loci increases.

Figure 6

Inference of population size trajectories N(t) for n=20. Simulated data under constant population size (A), exponential and constant trajectory (B), and a bottleneck (C). We show estimates from m=1 genealogy, m=100 local genealogies, and m=1000 local genealogies. Dashed lines show the true trajectories, blue lines and light blue areas represent EM point estimates and 95% confidence areas, and red lines and pink areas represent Bayesian GP posterior medians and 95% BCIs. Boxplots of the TMRCA are shown at the bottom of each plot.

Figure 7

Inference of population size trajectories N(t) for n=100. Simulated data under constant population size (A), exponential and constant trajectory (B), and bottleneck (C). We show estimates from m=1 genealogy, m=100 local genealogies, and m=1000 local genealogies. Dashed lines show the true trajectories, blue lines and light blue areas represent EM point estimates and 95% confidence areas, and red lines and pink areas represent Bayesian GP posterior medians and 95% BCIs. Boxplots of the TMRCA are shown at the bottom of each plot.

Sampling more individuals vs. sequencing more loci

Figure 5, Figure 6, and Figure 7 show our estimates for n=2,20, and 100 sampled individuals across varying numbers of loci. Performance of EM estimates depends strongly on the definition of the grid, so we focus here on the Bayesian GP estimates. We find that increasing the number of loci decreases uncertainty of our estimates and allows us to infer N(t) farther back in time. Increasing the number of samples does not necessarily increase the performance of our GP estimates (File S6). For example, under the bottleneck scenario, we are able to detect the bottleneck fairly accurately even for two samples with m=1000 local genealogies. This is because most TMRCAs observed under the bottleneck scenario occur during the bottleneck (Figure 5, Figure 6, and Figure 7), regardless of the sample size. In contrast, in our exponential growth scenario, increasing the number of samples from n=2 to n=100 improves accuracy: point estimates are closer to the truth (SRE in Table 4, A–C) and credible intervals cover the truth completely (ENV of 100%).

Sequential Tajima’s genealogies are sufficient statistics under the SMC′

Under the SMC′, marginally at each locus along the chromosome, a local genealogy is a realization of Kingman’s n-coalescent (Kingman 1982), a continuous-time Markov chain taking its values in the set Kn of sequences of partitions of the label set {1,2,,n}. A local genealogy g of n individuals includes labeled topology Kn and coalescent times t=(tn,,t2). The state space of a local genealogy is then G=Kn+n1, and the cardinality of the set Kn is n!(n1)!/2n1. However, only the set of ordered coalescent times carries information about N(t). For a single locus, the set of coalescent times provides sufficient statistics for inferring N(t) (see Proof in the Appendix). A natural question that follows is whether the coalescent times corresponding to the set of local genealogies are sufficient statistics for inferring N(t) under the SMC′ model. We find that the sufficient statistics for inferring N(t) under the SMC′ model are the coalescent times, when taken together with local ranked tree shapes (tree with no labels but ranked coalescent events). For a single locus, the set of coalescent times together with the ranked tree shape corresponds to a realization of Tajima’s n-coalescent. Tajima’s n-coalescent (Tajima 1983) is a continuous-time Markov chain taking its values in the set Gn of ranked tree shapes [also called histories, evolutionary relationships, or vintaged and sized coalescent (Sainudiin et al. 2014)]. The state space of Tajima’s local genealogy is then GT=Gn+n1, and the cardinality of the set Gn corresponds to the sequence of Euler zigzag numbers whose first 10 elements are 1,1,1,2,5,16,61,272,1385,7936 (Disanto and Wiehe 2013). The probability of getting a particular type of ranked tree shape Hn of n samples (Tajima 1983) is given by
P(Hn)=2nc1(n1)!,
(26)
where c is the number of cherries, defined as branching events that lead to exactly two leaves.

We defined transition densities in terms of coalescent times and Fi,j quantities (see Methods: SMC′ calculations). The set of all Fi,j quantities from a local genealogy forms a triangular matrix: an F matrix. We show that (i) F matrices are in bijection with ranked tree shapes and (ii) the set of local Tajima’s genealogies has sufficient statistics for inferring N(t) under the SMC′ model (see Appendix). These observations are crucial for inferring N(t) from sequence data directly. Coalescent-based inference from sequence data relies on marginalization over the hidden state space of genealogies. In the Appendix, we show that the state space needed is the space of local Tajima’s genealogies, as opposed to the space of local Kingman’s genealogies. For n=10 sequences, there are 2,571,912,000 possible labeled topologies while only 7936 possible ranked tree shapes.

Application to human data

We applied our method to a 2-Mb region on chromosome 1 (187,500,000–189,500,000) with no genes from five Yorubans from Ibadan, Nigeria (YRI) and five Utah residents of central European descent (CEU) from the 1000 Genomes pilot project (1000 Genomes Project Consortium 2012) and previously analyzed for the same purpose (Sheehan et al. 2013). We used ARGweaver (Rasmussen et al. 2014) to obtain a sample path of local genealogies for the two populations (YRI and CEU). The parameters used were 200 change points, a mutation rate of μ=1.26×108, and a recombination rate of ρ=1.6×108 (Rasmussen et al. 2014) (File S5). We note that ARGweaver assumes the SMC process and our method assumes the SMC′ process. Moreover, our inference is based on a single sample of the SMC process with known pruning times. Our ARGweaver set of local genealogies is discretized at 200 time points and our GP-based inference is influenced by this discretization. In Figure 8 we show our estimates of past Yoruban (in blue) and European population sizes (in green). The two population size trajectories experience a series of bottlenecks and overlap until ∼100 KYA, assuming a diploid reference population size of N0 = 10,000 and a generation time of 25 years. In Figure 8 we recover an out-of-Africa bottleneck that starts ∼100 KYA and ends ∼30 KYA in the European population. These results are consistent with previously published results (Gronau et al. 2011; Li and Durbin 2011; Rasmussen et al. 2011; Sheehan et al. 2013; Schiffels and Durbin 2014). In File S5, Figure S4A, we show the estimates of logN(t) instead of N(t) and time measured in units of N0 generations (as in Figure 5, Figure 6, and Figure 7). We note that this two-step procedure of inferring local genealogies with ARGweaver and then using our method introduces biases and ignores genealogical uncertainty. In File S5, we correct for some of the bias caused by using this two-step procedure and show that our inferred population size trajectory remains valid for the recent past.

Figure 8

Inference of human population size trajectories N(t) for n=10. Green solid line and green areas represent the posterior median and 95% BCI for the European population (CEU) and blue solid line and blue areas represent the posterior median and 95% BCI for the Yoruban population (YRI). Time is measured in years in the past, assuming a generation length of 25 years and a reference diploid population of 10,000 individuals. The x-axis is log transformed.

Assessing the effect of using genealogies inferred with ARGweaver

We simulated sequence data, used ARGweaver for inferring a set of local genealogies, and used our method on those genealogies to obtain estimates of logN(t). To this end, we took the sequences of the first 1000 local genealogies of n=20 individuals simulated with MaCS as described in section 3 of File S5. We then generated the sequence lengths (si, for the locus corresponding to gi1) as in Equation 5,
siExponential(ρ×li1×N0),
where li1 is the tree length of gi1 in units of N0 generations and N0 is the current population size. In our simulations, we set N0=20,000,  ρ=1.8×108. To simulate sequence data of length si over genealogy gi1, we used Seq-Gen (Rambaut and Grassly 1997) implemented in the R package phyclust (Chen 2011) from the Jukes–Cantor mutation model (Jukes and Cantor 1969) with mutation rate μ=2×1.8×108. We then used ARGweaver to infer a sample of local genealogies with the same corresponding parameters and with 200 change points for discretization of time. Figure 9 shows three estimations of effective population size trajectories for our three simulation scenarios. Figure 9, A–C, left, shows our GP-based estimates from 1000 simulated genealogies from MaCS; Figure 9, A–C, center, shows our GP-based estimates from a realization of local genealogies obtained from ARGweaver; and Figure 9, A–C, right, shows our GP-based estimates correcting the number of lineages used in our calculations, replacing Ai(t) by Ai(t)1 in our likelihood calculations. We find that our estimates are not only noisier using this approach but also biased.
Figure 9

Assessing the effect of a two-step inferential approach. (A–C) Left, our GP-based estimates when 1000 local genealogies are known; center, our GP-based estimates when ARGweaver estimated local genealogies are used for inference; right, our corrected GP-based estimates when ARGweaver estimated local genealogies are used for inference.

Discussion

In this article, we propose a Gaussian-process-based Bayesian nonparametric method for estimating effective population size trajectories N(t) from a sequence of local genealogies, accounting for recombination. Under a variety of simulated demographic scenarios and sampling designs, our method recovers the truth with better precision and accuracy than a maximum-likelihood approach (Figure 5, Figure 6, and Figure 7). We apply our method to genealogies estimated using ARGweaver (Rasmussen et al. 2014) for European and African samples in the 1000 Genomes; this application to real data recovers the known features of the out-of-Africa bottleneck (Figure 8).

Several recent approaches have emerged for inferring population size trajectories from multiple whole-genome sequences using the SMC (Li and Durbin 2011; Sheehan et al. 2013; Schiffels and Durbin 2014). However, current SMC-based methods rely on maximum-likelihood inference (EM) of both a discretized parameter space and a discretized state space to gain computational tractability, and incur the costs of reduced accuracy and biased estimates. Although in principle the EM approach and the Bayesian nonparametric approach approximate N(t) similarly—by either a piecewise constant or a piecewise linear function—the Bayesian nonparametric approach is not affected by increasing the number of parameters (or change points) in the estimation of N(t). For comparison with existing methods, we implemented an EM approach to infer population size trajectories from a sequence of local genealogies and we note that increasing the number of loci may actually increase the bias of the EM estimates (Figure 5, Figure 6, and Figure 7). For example, in simulation, our EM approach incorrectly detects the initial period of the simulated bottleneck (0.8N0 instead of 0.5N0 generations ago) with narrow confidence intervals (Figure 7C).

Using Bayesian GP for inferring population size trajectories offers many advantages over the EM approach. Similar to Palacios and Minin’s (2013) approach to inference from a single genealogy, we a priori assume that N(t) follows a log Brownian motion process. This allows us to model N(t) as a continuous positive function. The main advantage of using a Brownian motion process is that its inverse covariance function is a sparse matrix that allows for fast computations. Since the likelihood function involves integration over N(t), this integral is approximated by the Riemann sum over a regular grid of points. The finer the grid is, the better the approximation. We find that our method performs well for inferring N(t) at 100 change points in all our examples and, more importantly, results are not sensitive to the number of change points used in the analysis (Figure 4). Our Bayesian approach relies on MCMC for inference from the posterior distribution of model parameters. Because population sizes at different grid points are correlated, we adapt the recently developed MCMC technique splitHMC for jointly sampling all model parameters (Shahbaba et al. 2014; Lan et al. 2015). splitHMC is a Metropolis sampling algorithm that efficiently proposes states that are distant from current states with high acceptance rates. It has been shown to be more efficient in inferring N(t) from a single genealogy than elliptical slice sampling or regular Hamiltonian Monte Carlo sampling (Lan et al. 2015). However, splitHMC relies on calculating the score function at every single iteration. Because the pruning time in each local genealogy is unknown, we calculate the score function via Fisher’s formula.

In simulations, we find that our algorithm scales well with hundreds of individuals; our computational bottleneck is in the number of local genealogies. We envision that extending the current methodology to inference from sequence data directly will require a strategy for sampling shorter genomic segments. This would be a probabilistic alternative to arbitrarily choosing segment lengths (Sheehan et al. 2013; Rasmussen et al. 2014).

Under the SMC model, every recombination event along the genome translates to a new coalescent event for the sample under study, so increasing the number of loci results in more realizations of the coalescent process. The longer the segments are and the larger the number of samples taken, the greater the chance of observing variation due to recombination. This fact makes it hard to define a sampling strategy: Longer genomes or larger sample sizes? We show that increasing the number of local genealogies improves precision of our Bayesian GP estimates (Figure 5, Figure 6, and Figure 7). However, resolution into the past from contemporaneous sequences highly depends on the actual population size trajectory N(t).

We used ARGweaver (Rasmussen et al. 2014) to generate two samples of contiguous local genealogies corresponding to a 2-Mb region of chromosome 1 for five Europeans (CEU) and five Africans (YRI) from the 1000 Genomes Project; this genomic region is free of genes and was also analyzed in Sheehan et al. (2013). Taking these two samples of local genealogies as our data (4186 local genealogies for CEU and 6247 local genealogies for YRI), we were able to use our Bayesian GP method to infer Yoruban and European effective population size trajectories (Figure 8). We find an out-of-Africa bottleneck that began ∼100 KYA and ended ∼30 KYA in the European population, consistent with Li and Durbin (2011); Rasmussen et al. (2011); Gronau et al. (2011); Sheehan et al. (2013), and Schiffels and Durbin (2014). We note that our estimates are based on a single sample of local genealogies and thus ignore genealogical uncertainty. Moreover, we generated our data from the posterior distribution of local genealogies, using ARGweaver at 200 time intervals, so our GP-based approach cannot fully detect sudden changes that may occur between the discretized times. In addition, ARGweaver assumes an SMC prior model on local genealogies and our GP-based method assumes the SMC′ process; the lack of invisible recombination events in ARGweaver’s genealogies will bias inference (as shown in simulated data in Figure 9).

The natural next extension for our method presented in this study is to infer N(t) from sequence data directly and not from the set of local genealogies. Our MCMC approach allows us to extend the current methodology in a Bayesian hierarchical framework where the SMC′ process would be used as a prior distribution over local genealogies. The work we present here suggests a combination of ARGweaver accommodating SMC′ and GP priors would result in an efficient method for inferring population size trajectories from sequence data directly. In addition, our model can be easily modified to model a variable recombination rate along chromosomal segments and to jointly infer variable recombination rates and N(t).

Finally, we show that, under the SMC′ model, local ranked tree shapes and coalescent times correspond to a set of local Tajima’s genealogies; these Tajima’s genealogies are sufficient statistics for inferring N(t). Under the SMC′ model, the state space needed for inferring population size trajectories from sequence data is that of a sequence of local Tajima’s genealogies. This lumping, or reduction of the original SMC′ process, will allow more efficient inference from sequence data directly.

Current methods for inferring population size trajectories make trade-offs to analyze whole genomes that limit both biological understanding of sudden population size changes and the ability to test hypotheses regarding population size changes. This work represents a critical set of theoretical results that lay the groundwork for efficient estimation of detailed histories from sequence data with measures of uncertainty.

Appendix

Discretization

For both our Bayesian method and our EM method, we assume that N(t) is a piecewise linear (or piecewise constant) function with d change points. Let xi={x1i,x2i,,xd+n1i} be the ordered set of time points corresponding to the change points x1,,xd and the coalescent time points ti of local genealogy i. Then, we calculate all the factors needed for the observed data likelihood (Equation 13) and the complete data likelihood (Equation 19).

Let F˜k,ji denote the discretized version of Fi that represents the number of branches in gi that do not coalesce with any other branch in the time interval (xki,xj+1i). Note that the indexes here are in increasing order, kj. Similarly, let (1/li)P˜k,ji denote the probability that Ui (the pruning time along genealogy i) occurs in (xki,xk+1i) and the self-coalescing event occurs at time tnewi in (xji,xj+1i). That is,
P˜k,ji={1Ai(xj+1i)(ΔjiQ˜ji)k=jQ˜kiq˜k+1iq˜k+2iq˜j+1i(1q˜ji)k<j,
(A1)
where
1liQ˜ki=1liN(xk+1i)Ai(xk+1i)[1q˜ki]
(A2)
is the joint probability of pruning time Ui(xki,xk+1i) and not coalescing back to the same branch in the time interval (xki,xk+1i), and
q˜ki=exp{Ai(xk+1i)ΔkiN(xk+1i)}.

Expectation-Maximization Algorithm

E step
Equations 21 and 22 show that for the E-step, the only expectations we need are E[zji|Y] and E[Δji|Y]. We compute these expressions as follows:
E[zji|Y]={k=1jF˜k,jiP˜k,jij=1Dk=jDF˜k,jiP˜k,ji,fori(invisible).zji,foric(visible).
For i
E[Δji|Y]=(xj+1ixji)k=1j1l=j+1DF˜k,liP˜k,lij=1Dk=jDF˜k,jiP˜k,ji
+xjixj+1i(xj+1iu)exp{(xj+1iu)Ai(xj+1i)N(xj+1i)}duk=j+1DF˜j,ki(P˜j,ki/Q˜ji)j=1Dk=jDF˜k,jiP˜k,ji
+xjixj+1iuxj+1i(tu)1N(xj+1i)exp{(tu)Ai(xj+1i)N(xj+1i)}dtduF˜j,jij=1Dk=jDF˜k,jiP˜k,ji
+xjixj+1i(txji)exp{(txji)Ai(xj+1i)N(xj+1i)}dtk=1j1F˜k,ji(P˜k,ji/(1q^ji))j=1Dk=jDF˜k,jiP˜k,ji,
and for ic, let
yji={1,iftnewixk+1i,0,otherwise.
Then,
E[Δji|Y]={0,if k=1jIi(xk+1i)=0oryji=0,xj+1ixji,ifIi(xj+1i)=0,and k=1jIi(xk+1i)>0,andyji=1,δji,otherwise,
where
δji=(xj+1ixji)[k=1j1Ii(xk+1i)Q˜kil=k+1Di1[q^li]ylik=1DIi(xk+1i)Q˜kil=k+1D[q^li]yli]
(A3)
+xjixj+1i(xj+1iu)exp{(xj+1iu)Ai(xj+1)N(xj+1i)}du[Ii(xj+1i)l=j+1D[q^li]ylik=1DIi(xk+1i)Q˜kil=k+1D[q^li]yli].
M step
Now, for the kth iteration of the algorithm and maximizing the complete data log-likelihood (Equation 19), we have
Nlk=j=1D0.5A0(xj+10)[A0(xj+10)1](xj+10xj0)1l,j0+i=0m2j=1DAi(xj+1i)ENk1[Δji|Y]1l,jij=1Daj01l,j0+i=0m2j=1DENk1[zji]1l,ji,
where
1l,ji={1,ifxl<xj+1ixl+1,0,otherwise
is an indicator function that takes the value of 1 when (xl,xl+1) covers the interval (xji,xj+1i).

Observed Score Function for Split Hamiltonian Monte Carlo

Our Bayesian approach relies on splitHMC sampling from the posterior distribution of model parameters. This method requires the calculation of the observed score function. We use Fisher’s identity and calculate the observed score function as the conditional expected complete score function. The lth element of obs is

(obs)l=j=1D1aj01l,j0+12j=1D1A0(xj+10)[A0(xj+10)1](xj+10xj0)1l,j0exp[logNl]i=0m2j=1D1E[zji|Y]1l,j0+i=0m2j=1D1Ai(xj+1i)E[Δji|Y]1l,jiexp[logNl].
(A4)

Sufficient Statistics Under SMC′

Here, we first formally show that under the standard coalescent and for a single locus, the set of coalescent times has sufficient statistics for inferring N(t); that is, information about the topology is irrelevant for inference of N(t). We then investigate the properties of our F quantities (see Methods: SMC′ Calculations) needed for the calculation of the transition densities (Equation 11) and show through a series of propositions that the F quantities and coalescent times are the sufficient statistics for inferring N(t) under the SMC′ process.

Proposition 1. For a single locus, the set of coalescent times are sufficient statistics for inferring N(t).

Proof. This can be proved using the factorization theorem. The marginal density of a local genealogy (Equation 3) has a unique factor that depends on N(t) and g only through tn,,t2. The values of A(t) are induced by the natural order of the coalescent times.

Let F denote a lower triangular matrix of size n×n with the Fi,j entry the number of lineages that do not coalesce in the time interval (ti+1,tj), as defined in Methods: SMC′ Calculations and with the following properties:

  1. Fi,1=0 for all i=1,,n (The first column contains 0’s for completion).

  2. Fi,j=0 for all j>i (lower triangular matrix).

  3. Fi,i=i for all i2 (the diagonal corresponds to the number of lineages at each intercoalescent interval).

  4. Fi,i1=i2 for all i2 (at each intercoalescent interval, we lose two free lineages, so the second diagonal correspond to the number of lineages minus two).

  5. For j<n1, the last row of F is defined according to
    Fn,j1={Fn,j2,withprobabilityp=(Fn,j2)(j2),Fn,j1,withprobabilityp=Fn,j(jFn,j)(j2),Fn,j,withprobabilityp=(jFn,j2)(j2).
  6. Let c denote the number of cherries; then
    c=j=2n1{Fn,jFn,j1=2}.
  7. For i<n and j<i1, if Fn,j1=Fn,j2, then Fi,j1=Fi,j2.

  8. Let vi denote the set of lineages in the intercoalescent interval (ti,ti1) with direct descendant internal nodes. The lineage labels correspond to the label of the coalescent time, when the direct descendant internal node was created. That is, the lineage created at tn has label n: vn={n}; the lineage created at ti has label i. Let |vi| denote the size of the set vi. Note that 1|vi|c and
    |vi|=j=in1{Fn,jFn,j1=2}j=in1{Fn,jFn,j1=0}.
  9. For i<n and j<i1, if Fn,j1=Fn,j1, then at time tj, there is a coalescence between a singleton and a lineage in the set vj. Let aj be the lineage selected uniformly at random from vj; then
    Fi,j1={Fi,j1ifi>ajFi,j2ifj<iaj.
  10. For i<n and j<i1, if Fn,j1=Fn,j, then at time tj, there is a coalescence between two lineages aj1 and aj2 from the set vj. Let aj1 denote the minimum and aj2 the maximum of the two lineages selected; then
    Fi,j1={Fi,jifi>aj2Fi,j1ifaj1<iaj2Fi,j2ifj<iaj1.

We show the correspondence between a ranked tree shape and the F matrix in the example of Figure A1. The first row and the first column are set to 0, and the first two diagonals are known with probability 1: Fi,i=i and Fi,i1=Fi,i2 for i>1. In our example, n=5 and so the first diagonal corresponds to (0,2,3,4,5) and the second diagonal corresponds to (0,1,2,3). The last row, F5, contains 0, followed by the number of branches that do not coalesce in the time intervals (t6,t2),  (t6,t3),  (t6,t4), and (t6,t5) corresponding to (0,0,2,3,5).

Figure A1

Ranked tree shape for n=5.

Proposition 2.  There is a bijection between the set of ranked tree shapes Gn  and  ,  the set of  F  matrices.

Proof. The probability of the F matrix can be expressed as the product of the conditional probabilities of the columns of the F matrix; that is,
Pr(F)=Pr(F,n)j=1n1Pr(F,nj|F,nj+1)=j=2n2Pr(F,nj|F,nj+1),
since the first and last column of F are known with probability 1. Note F,j represents the jth column vector of the F matrix.
Let di=Fn,iFn,i1 for i=3,,n and d2=Fn,2; then
Pr(F,nj|F,nj+1)=Pr(dnj|F,nj+1)Pr(Fnj:n1,nj|dnj,F,nj+1).
(A5)
That is, the conditional probability of the (nj)th column of F given the (nj+1)th column of F is the product of the conditional probability of the last element of the (nj)th column and the conditional probability of the rest of the (nj)th column. When dnj=2, the rest of the column is known with probability 1 (property 7 of the F matrix). When dnj=1, the rest of the njth column has probability 1/|vnj+1| (property 9 of the F matrix) and when dnj=2, the rest of the njth column has probability 1/(|vnj+1|2) (property 10 of the F matrix). Then rewriting Equation A5, we have
Pr(F,nj|F,nj+1)=Pr(dnj+1|F,nj+1)(1|vnj+1|)1{dnj=1}(1(|vnj+1|2))1{dnj=0};
(A6)
since |vnj|=k=njn(1{dk=2}1{dk=0}) and Fn,k=nj=k+1ndj, then
Pr(dnj+1|F,nj+1)=Pr(dnj+1|Fn,nj+1)=Pr(dnj+1|k=nj+2ndk),
and
Pr(F)=j=1n2Pr(dnj|k=nj+1ndk)(1|vnj+1|)1{dnj=1}(2|vnj+1|(|vnj+1|1)(1{dnj=0}=j=1n2((nk=nj+1ndk)(nk=nj+1ndk1)2)1{dnj=2}×((nk=nj+1ndk)(k=nj+1ndkj)|vnj+1|)1{dnj=1}×((k=nj+1ndkj)(k=nj+1ndkj1)|vnj+1|(|vnj+1|1))1{dnj=0}1(nj2)=2n221c(n1)!(n2)!j=2n1((nk=j+1ndk)(nk=j+1ndk1))1{dj=2}×((nk=j+1ndk)(jn+k=j+1ndk))1{dj=1}((jn+k=j+1ndk)(jn+k=j+1ndk1))1{dj=0}×(1|vj+1|)1{dj=0}+1{dj=1}(1|vj+1|1)1{dj=0}.
Since dn=2 and |vn|=1, for j=n1, then dn1 is either 1 or 2; then
Pr(F)=2nc1(n1)!(n2)!(n2)(n3)1{dn1=2}j=2n2((nk=j+1ndk)(nk=j+1ndk1))1{dj=2}×((nk=j+1ndk)(jn+k=j+1ndk))1{dj=1}((jn+k=j+1ndk)(jn+k=j+1ndk1))1{dj=0}×(1|vj+1|)1{dj=0}+1{dj=1}(1|vj+1|1)1{dj=0}.
If we continue expanding the expressions, we get
Pr(F)=2nc1(n1)!(n2)!(n2)(n3)(n4)1{dn2=2}+1{dn2=1}1{dn1=2}(n5)1{dn2=2}1{dn1=2}×j=2n3((nk=j+1ndk)(nk=j+1ndk1))1{dj=2}×((nk=j+1ndk)(jn+k=j+1ndk))1{dj=1}((jn+k=j+1ndk)(jn+k=j+1ndk1))1{dj=0}×(1|vj+1||)1{dj=0}+1{dj=1}(1|vj+1|1)1{dj=0}==2nc1(n1)!.

Note that the entries of the F matrix correspond to the same quantities needed to express the transition density of an invisible event (Equation 11). We claim that the sequence of coalescent times sets t0,t1,,tm1 and F0,F1,,Fm1 matrices corresponding to the ranked tree shapes of local genealogies g0,g1,,gm1 are sufficient statistics to infer N(t) under the SMC′ process. We prove this through Propositions  3–6.

Proposition 3.  The probability density of Tajimas genealogy is proportional, up to a combinatorial factor, to the probability density of Kingmans genealogy.

Proof.
Pr[GT={F,tn,tn1,,t2}|N(t)]=Pr[tn,tn1,,t2|N(t)]Pr[F|tn,tn1,,t2]
=n!(n1)!2n1Pr[G={Kn,tn,,t2}|N(t)]2nc1(n1)!
=n!2cj=2n1N(tj0)exp{tj+10tj0A0(t)(A0(t)1)dt2N(t)}.
(A7)

Proposition 4.  The marginal visible transition density from a local Kingmans genealogy gi1  to  Gi  is proportional to the marginal visible transition density from  the corresponding local Tajimas genealogy  gi1T  to  GiT.

Proof. When the labeled topology of gi1 is the same as the labeled topology of gi, then a transition from gi1 to gi contains the same information about pruning location as a transition from gi1T to giT (Figure S1A in File S1 and Figure S2D in File S4). In fact, the Ii1(t) function defined in the Visible transitions subsection (Equation 8) can be defined in terms of the Fi matrix and the coalescent times ti1 and ti. In this case, for some j{2,,n},  tji1=tdeli and tji=tnewi. Then
Ii1(t)={0,ift>min(tnewi,tdeli),Fl,ji1Fl,j1i1,ift(tl+1i1,tli1)forl=j,j+1,,n.
Hence, if Ki1=Ki, the labeled topologies of gi1 and gi, then
Pr[Gi={Ki1,ti}|gi1={Ki1,ti1},N(t)]=Pr[GiT={Fi1,ti}|gi1T={Fi1,ti1},N(t)].
When the labeled topologies of gi1 and gi are different, but the children of tdeli and the children of tnewi are the same, we cannot exactly identify the pruning branch and the new coalescing branch (Figure S1B in File S1) and then a transition from gi1 to gi contains the same information about pruning location as a transition from gi1T to giT. Let tji1=tdeli and tki=tnewi; since the children of tji1 and tki are the same, it is enough to consider Fi1. Then
Ii1(t)={0,ift>min(tnewi,tdeli),Fl,ji1Fl,j1i1,ift(tl+1i1,tli1) forl=j,j+1,,n
and
Pr[Gi={Ki,ti}|gi1={Ki1,ti1},N(t)]=Pr[GiT={Fi1,ti}|gi1T={Fi1,ti1},N(t)].
When the deleted node corresponding to tdel is a cherry and the new node corresponding to tnew is also a cherry, there are four possible topologies Ki that lead to the same ranked tree shape Fi; then
Pr[Gi=gi|gi1,N(t)]=(12)1{tji1=tdeli}1{Fn,ji1=Fn,j+1i12}×(12)1{tji=tnewi}1{Fn,ji=Fn,j+1i2}×Pr[GiT=giT|gi1T,N(t)].

Proposition 5.  The marginal invisible transition density from a local Kingmans genealogy gi1  to  Gi  is equal to the marginal invisible transition density from the  corresponding local Tajimas genealogy  gi1T  to  GiT.

Proof.
Pr[Gi=gi1|gi1,N(t)]=Pr[Gi=gi1|gi1T,N(t)],
since all that is needed to compute the transition probability are the coalescent times and the Fi1 matrix. Since the topology does not change, the proof follows.

Proposition 6.  The likelihood of partially observed embedded SMCchain of  local Kingmans genealogies is proportional, up to a combinatorial factor, to the  likelihood of partially observed embedded SMCchain of the corresponding local  Tajimas  genealogies.

Proof. The proof follows from Propositions 3–5 needed to express the likelihood of partially observed embedded SMC′ chain (Equation 13).

Acknowledgments

We thank Amandine Veber for her valuable suggestions and comments. We thank Shiwei Lan for his suggestions for speeding up the MCMC sampling scheme and Sara Sheehan and Melissa J. Hubisz for helpful discussions. We also thank two referees for suggestions that improved this article. J.A.P. acknowledges scholarship from Consejo Nacional de Ciencia y Tecnología Mexico to pursue her research work. This research is supported in part by National Science Foundation CAREER award DBI-1452622 (to S.R.). S.R. is a Pew Scholar in the Biomedical Sciences, supported by The Pew Charitable Trusts, and an Alfred P. Sloan Research Fellow.

Footnotes

Communicating editor: Y. S. Song

Supporting information is available online at www.genetics.org/lookup/suppl/doi:10.1534/genetics.115.177980/-/DC1.

Literature Cited

Chen
G K
,
Marjoram
P
,
Wall
J D
,
2009
Fast and flexible simulation of DNA sequence data.
 
Genome Res.
 
19
:
136
142
.

Chen, W., 2011 Overlapping codon model, phylogenetic clustering, and alternative partial expectation conditional maximization algorithm. Ph.D. Thesis, Iowa State University, Ames, IA.

Dempster
A P
,
Laird
N M
,
Rubin
D B
,
1977
Maximum likelihood from incomplete data via the EM algorithm.
 
J. R. Stat. Soc. Ser. B
 
39
:
1
38
.

Disanto
F
,
Wiehe
T
,
2013
Exact enumeration of cherries and pitchforks in ranked trees under the coalescent model.
 
Math. Biosci.
 
242
:
195
200
.

Griffiths, R. C., and P. Marjoram, 1997 An ancestral recombination graph, pp. 257–270 in Progress in Population Genetics and Human Evolution (IMA Volumes in Mathematics and Its Applications), Vol. 87, edited by P. Donnelly and S. Tavaré. Springer-Verlag, New York.

Gronau
I
,
Hubisz
M J
,
Gulko
B
,
Danko
C G
,
Siepel
A
,
2011
Bayesian inference of ancient human demography from individual genome sequences.
 
Nat. Genet.
 
43
:
1031
1034
.

Hudson
R R
,
1983
Testing the constant-rate neutral allele model with protein sequence data.
 
Evolution
 
37
:
203
217
.

Hudson
R R
,
1990
Gene genealogies and the coalescent process.
 
Oxf. Surv. Evol. Biol.
 
7
:
1
44
.

Jukes
T H
,
Cantor
C R
,
1969
Evolution of Protein Molecules
, pp. 21–132. Academic Press, New York.

Kingman
J
,
1982
The coalescent.
 
Stoch. Proc. Appl.
 
13
:
235
248
.

Lan
S
,
Palacios
J A
,
Karcher
M
,
Minin
V N
,
Shahbaba
B
,
2015
An efficient Bayesian inference framework for coalescent-based nonparametric phylodynamics.
 
Bioinformatics
(in press).

Li
H
,
Durbin
R
,
2011
Inference of human population history from individual whole-genome sequences.
 
Nature
 
475
:
493
496
.

Louis
T A
,
1982
Finding the observed information matrix when using the EM algorithm.
 
J. R. Stat. Soc. B
 
44
:
226
233
.

Marjoram
P
,
Wall
J
,
2006
Fast “coalescent” simulation.
 
BMC Genet.
 
7
:
16
.

McVean
G
,
Cardin
N
,
2005
Approximating the coalescent with recombination.
 
Philos. Trans. R. Soc. Lond. B Biol. Sci.
 
360
:
1387
1393
.

Minin
V N
,
Bloomquist
E W
,
Suchard
M A
,
2008
Smooth skyride through a rough skyline: Bayesian coalescent-based inference of population dynamics.
 
Mol. Biol. Evol.
 
25
:
1459
1471
.

Murray, I., R. P. Adams, and D. J. C. MacKay, 2010 Elliptical slice sampling, Proceedings of the 13th International Conference on Artificial Intelligence and Statistics (AISTATS), Chia Laguna Resort, Sardinia, Italy, Vol. 9, pp. 541–548.

Neal, R. M., 2009 MCMC using Hamiltonian dynamics, pp. 113–162, edited by S. Brooks, A. Gelman, G. L. Jones, and X. -L. Meng. Hall, London/New York.

1000 Genomes Project Consortium
,
2012
An integrated map of genetic variation from 1,092 human genomes.
 
Nature
 
491
:
56
65
.

Palacios
J A
,
Minin
V N
,
2013
Gaussian process-based Bayesian nonparametric inference of population trajectories from gene genealogies.
 
Biometrics
 
63
:
8
18
.

Rambaut
A
,
Grassly
N C
,
1997
Seq-Gen: an application for the Monte Carlo simulation of DNA sequence evolution along phylogenetic trees.
 
Comput. Appl. Biosci.
 
13
:
235
238
.

Rasmussen
M
,
Guo
X
,
Wang
Y
,
Lohmueller
K E
,
Rasmussen
S
 et al. ,
2011
An aboriginal Australian genome reveals separate human dispersals into Asia.
 
Science
 
334
:
94
98
.

Rasmussen
M D
,
Hubisz
M J
,
Gronau
I
,
Siepel
A
,
2014
Genome-wide inference of ancestral recombination graphs.
 
PLoS Genet.
 
10
:
e1004342
.

Sainudiin
R
,
Stadler
T
,
Véber
A
,
2014
Finding the best resolution for the Kingman-Tajima coalescent: theory and applications.
 
J. Math. Biol.
 
70
:
1207
1247
.

Schiffels
S
,
Durbin
R
,
2014
Inferring human population size and separation history from multiple genome sequences.
 
Nat. Genet.
 
46
:
919
925
.

Shahbaba
B
,
Lan
S
,
Johnson
W
,
Neal
R
,
2014
Split Hamiltonian Monte Carlo.
 
Stat. Comput.
 
24
:
339
349
.

Sheehan
S
,
Harris
K
,
Song
Y S
,
2013
Estimating variable effective population sizes from multiple genomes: a sequentially Markov conditional sampling distribution approach.
 
Genetics
 
194
:
647
662
.

Tajima
F
,
1983
Evolutionary relationship of DNA sequences in finite populations.
 
Genetics
 
105
:
437
460
.

Wilton
P R
,
Carmi
S
,
Hobolth
A
,
2015
The SMC′
is a highly accurate approximation to the ancestral recombination graph.
Genetics
200: 343–355.

Wiuf
C
,
Hein
J
,
1999
Recombination as a point process along sequences.
 
Theor. Popul. Biol.
 
55
:
248
259
.

This article is published and distributed under the terms of the Oxford University Press, Standard Journals Publication Model (https://academic.oup.com/journals/pages/open_access/funder_policies/chorus/standard_publication_model)