Estimation of Cross-Species Introgression Rates Using Genomic Data Despite Model Unidentifiability

Abstract Full-likelihood implementations of the multispecies coalescent with introgression (MSci) model treat genealogical fluctuations across the genome as a major source of information to infer the history of species divergence and gene flow using multilocus sequence data. However, MSci models are known to have unidentifiability issues, whereby different models or parameters make the same predictions about the data and cannot be distinguished by the data. Previous studies of unidentifiability have focused on heuristic methods based on gene trees and do not make an efficient use of the information in the data. Here we study the unidentifiability of MSci models under the full-likelihood methods. We characterize the unidentifiability of the bidirectional introgression (BDI) model, which assumes that gene flow occurs in both directions. We derive simple rules for arbitrary BDI models, which create unidentifiability of the label-switching type. In general, an MSci model with k BDI events has 2k unidentifiable modes or towers in the posterior, with each BDI event between sister species creating within-model parameter unidentifiability and each BDI event between nonsister species creating between-model unidentifiability. We develop novel algorithms for processing Markov chain Monte Carlo samples to remove label-switching problems and implement them in the bpp program. We analyze real and synthetic data to illustrate the utility of the BDI models and the new algorithms. We discuss the unidentifiability of heuristic methods and provide guidelines for the use of MSci models to infer gene flow using genomic data.


Introduction
Genomic sequences sampled from modern species contain rich historical information concerning species divergences and cross-species gene flow. In the past two decades, analysis of genomic sequence data has demonstrated the widespread nature of cross-species hybridization or introgression (Baack and Rieseberg, 2007;Harrison and Larson, 2014;Mallet et al., 2016). A number of statistical methods have been developed to infer introgression using genomic data, most of which use data summaries such as the estimated gene trees or genome-wide site-pattern counts (Degnan, 2018;Elworth et al., 2019;Jiao et al., 2021). Full-likelihood methods applied directly to multilocus sequence alignments Zhang et al., 2018;Flouri et al., 2020) allow estimation of evolutionary parameters including the timing and strength of introgression, as well as species divergence times and population sizes for modern and extinct ancestral species. These have moved the field beyond simply testing for the presence of cross-species gene flow.
Models of cross-species introgression are known to cause unidentifiability issues, whereby different introgression models make the same probabilistic predictions about the data, and cannot be distinguished by the data (Yu et al., 2012;Pardi and Scornavacca, 2015;Zhu and Degnan, 2017;Solis-Lemus et al., 2020). If the probability distributions of the data are identical under model m with parameters Q and under model m ′ with parameters Q ′ , with for essentially all possible data X, the models are unidentifiable by data X. Here we use the term within-model unidentifiability if m = m ′ and Q = Q ′ , or cross-model unidentifiability if m = m ′ . In the former case, two sets of parameter values in the same model are unidentifiable, whereas in the latter, two distinct models are unidentifiable. In Bayesian inference, the prior f(m, Q) may be used to favor a particular model or set of parameters. If the prior is only vaguely informative and the posterior is dominated by the likelihood, there will be multiple modes in the posterior that are not perfectly symmetrical. Several studies examined the unidentifiability of introgression models when gene tree topologies (either rooted or unrooted) are used as data (Pardi and Scornavacca, 2015;Zhu and Degnan, 2017;Solis-Lemus et al., 2020), and the results apply to heuristic methods based on (reconstructed) gene trees. The issue has not been studied when full-likelihood methods are applied, which operate on multilocus sequence alignments directly. Note that unidentifiability depends on the data and the method of analysis. An introgression model that is unidentifiable by gene tree topologies alone may be identifiable if gene trees with coalescent times are used (Zhu and Degnan, 2017). Similarly, a model unidentifiable using heuristic methods may be identifiable when full-likelihood methods are applied to the same data. It is thus important to study the problem when full-likelihood methods are applied, because unidentifiability by a heuristic method may reflect its inefficient use of information in the data, while unidentifiability by full-likelihood methods reflects the intrinsic difficulty of the inference problem (Zhu and Yang, 2021).
Here we focus on models of episodic introgression that assume that gene flow occurs between species at fixed time points Zhang et al., 2018;Flouri et al., 2020). These are known as multispecies-coalescent-with-introgression model (MSci; Flouri et al., 2020), hybrid species phylogenies (Kubatko, 2009), network multispecies coalescent model (NMSC; Zhu and Degnan, 2017) or multispecies network coalescent model (MSNC; Yu et al., 2012;Zhang et al., 2018). Another class of models of cross-species gene flow is the continuous migration model, which assumes that migration occurs at a certain rate per generation over extended time period. This is known as the multispecies coalescent with migration (MSC+M; Jiao et al., 2021) or isolation-with-migration (IM; Hey and Nielsen, 2004;Zhu and Yang, 2012;Dalquen et al., 2017;Hey et al., 2018) model. The IM model is suitable if gene flow occurs over extended time periods, while the MSci model is preferable if gene flow occurs in short bursts of time. The IM model is in particular suitable for analyzing data from different populations of the same species. It has very different properties concerning identifiability and is not dealt with in this study.
The bulk of the paper concerns the bidirectional introgression (BDI) model ( fig. 1), which was noted to have an unidentifiability issue . The BDI model posits that two species coming into contact at a certain time in the past exchange genes, while the other MSci models assume introgression only in one direction. Whether gene flow tends to occur in one direction or in both directions is an interesting empirical question that may be answered by real data analyses. Here we note that recent analyses of genomic data from North-American horned lizards (Finger et al., 2022), the erato-sara group of Heliconius butterflies (Thawornwattana et al., 2022), and North-American chipmunks (Ji et al., 2021) have identified BDI events, both between sister species and between nonsister species (see also an example later). In the Anopheles gambiae group of African mosquitoes, introgression between A. gambiae and A. arabiensis in both directions was suspected, but detailed analyses detected gene flow from A. arabiensis to A. gambiae only but not in the opposite direction (Thawornwattana et al., 2018). In another example, Banker et al. (2022) detected bidirectional introgression (with different rates) between Mus spretus and wild populations of M. m. domesticus from Europe, despite considerable postzygotic reproductive isolation between the species. At any rate, BDI is one of the most plausible introgression models and appears to be one of the most common forms of cross-species gene flow. The unidentifiability of MSci models with (a) ( b) ( c) FIG. 1. (a) Species tree or MSci model for two species (A and B) with a bidirectional introgression at time t X = t Y , identifying nine parameters in the model. We refer to a branch by its daughter node, so that branch XA is also branch A and is assigned the population size parameter u A . Both species divergence/introgression times (ts) and population sizes (us) are measured in the expected number of mutations per site. (b,c) Two sets of unidentifiable parameters Q and Q ′ , with w ′ X = 1 − w X , w ′ Y = 1 − w Y , u ′ X = u Y , and u ′ Y = u X , while the other five parameters (t R , t X = t Y , u A , u B , and u R ) are identical between Q and Q ′ . Here a and b are two numerical values for the introgression probabilities (so that w X = a in Q while w X = 1 − a in Q ′ ). The dotted lines indicate the main routes taken by sequences sampled from species A and B, if both a and b are ≪ 1 2 .
). An introgression model is similar to a species tree except that it includes horizontal branches representing lateral gene flow across species. Besides speciation nodes representing species divergences, there are hybridization nodes representing introgression events as well. While a speciation node has one parent and two daughters, a hybridization node has two parents and one daughter. The "introgression probabilities" or "admixture proportions" (w and 1 − w) specify the contributions of the two parental populations to the hybrid species. When we trace the genealogical history of a sample of sequences from the modern species backwards in time and reach a hybridization node, each of the sequences takes the two parental paths with probabilities w and 1 − w. There are thus three types of parameters in an MSci model: the times of species divergence and introgression (ts), the (effective) population sizes of modern and ancestral species (us), and the introgression probabilities (ws). Both the divergence times (ts) and population sizes (us) are measured in the expected number of mutations per site.
The BDI model, in the case of two species ( fig. 1), is noted to have an unidentifiability issue . Let Q ′ be a set of parameters with the same values as Q except that w ′ fig. 1b and c). Here G represents both the gene tree topology and branch lengths (coalescent times). We assume multiple sequences sampled per species at the same locus (see Discussion for unidentifiability caused by sampling only one sequence per species). Thus for every point Q in the parameter space, there is a "mirror" point Q ′ with exactly the same likelihood. With Q, the A sequences take the left (upper) path at X and enter population RX with probability 1 − w X , coalescing at the rate 2/u X , while with Q ′ , the same A sequences may take the right (horizontal) path and enter population RY with probability w ′ X = 1 − w X , coalescing at the rate 2/u ′ Y = 2/u X . The differences between Q and Q ′ are in the labeling, with "left" and X under Q corresponding to "right" and Y under Q ′ , but the probabilities involved are the same. The same argument applies to sequences from B going through node Y, and to any numbers of sequences from A and B considered jointly. Thus f (G | Q) = f(G | Q ′ ) for essentially all G. If the priors on w X and w Y are symmetrical, say w beta(a, a), the posterior density will satisfy f(Q | X) = f(Q ′ | X) for all X. Otherwise the "twin towers" in the posterior may not have exactly the same height.
The situation is very similar to the label-switching problem in Bayesian clustering (Richardson and Green, 1997;Celeux et al., 1998;Stephens, 2000;Jasra et al., 2005). Consider data X = {x i } as a sample from a mixture of two normal distributions, N(m 1 , 1) and N(m 2 , 1), with the mixing proportions p 1 and p 2 = 1 − p 1 . Let Q = (p 1 , m 1 , m 2 ) be the parameter vector. Then Q ′ = (p 2 , m 2 , m 1 ) will have exactly the same likelihood, with f(X | Q) = f (X | Q ′ ) for essentially all data X, and Q and Q ′ are unidentifiable. Suppose the data suggest two groups in proportions 10% and 90%, with means 100 and 1, so that there are two peaks in the posterior, around Q : p 1 = 0.1, m 1 = 100, m 2 = 1 and Q ′ : p ′ 1 = 0.9, m ′ 1 = 1, m ′ 2 = 100. In a Bayesian cluster analysis using Markov chain Monte Carlo (MCMC), the Markov chain may visit both peaks, effectively switching the labels "group 1" and "group 2" and changing the definitions of parameters in the same MCMC run. This is known as a label-switching problem. One may process the MCMC sample, and reflect each Q ′ with p ′ 1 . 1 2 to its mirror point Q, to fix the label-switching (but see later for problems involved with imposing such simple constraints). In other words, we may apply a relabeling algorithm to postprocess the MCMC sample to fix the label-switching issue.
As an example of the label-switching issues in the BDI model, consider the MCMC analysis using BPP of the first 500 noncoding loci on chromosome 1 from three Heliconius butterfly species: H. melpomene, H. timareta, and H. numata (Edelman et al., 2019;Thawornwattana et al., 2022) (fig. 2a). Figure 3a shows the trace plots for parameters w X and w Y from an MCMC run. The Markov chain moves between two peaks, centered around (w X , w Y ) = (0.35, 0.1) and (0.65, 0.9), respectively. In effect, the algorithm is switching between Q and Q ′ and changing the definition of parameters during the same MCMC run. This is a label-switching problem, as occurs in Bayesian clustering. The usual practice of estimating parameters by their posterior means calculated using the MCMC sample (0.54 for w X and 0.62 for w Y in fig. 3a) and constructing the credibility intervals is inappropriate. Indeed the posterior distribution of Q is exactly symmetrical with twin towers, and if the chain is run long enough, the sample means of w X and w Y will be exactly 1 2 , irrespectively of what values may fit the data well. The results are similar when the first 500 exonic loci are analyzed, in which the Markov chain moves between two towers centered around (0.3, 0.1) and (0.7, 0.9) (supplementary fig. S1a, Supplementary Material online).
Results such as those of fig. 3a and supplementary fig. S1a, Supplementary Material online raise two questions. First, what are the rules concerning the unidentifiability of general BDI models with, for example, more than two species on the species tree and more than one BDI event, or if the BDI event involves nonsister species. Second, how do we deal with the problem of label-switching and make the models useful for real data analyses? We address those two problems in this paper. We study the unidentifiability issue of BDI models for an arbitrary number of species with an arbitrary species tree, when a full-likelihood method is applied to multilocus sequence data. It has been conjectured that  Yang and Flouri · https://doi.org/10.1093/molbev/msac083 MBE an MSci model is identifiable by full-likelihood methods using data of multilocus sequence alignments if and only if it is identifiable when the data consist of gene trees with coalescent times . We make use of this conjecture and consider two BDI models to be unidentifiable if and only if they generate the same distribution of gene trees with coalescent times. We emphasize that the unidentifiability discussed here affects all methods of inference using genomic sequence data, including heuristic methods based on summary statistics (see Discussion). We identify general rules for the unidentifiability of the BDI models. We then develop new relabeling algorithms for postprocessing the MCMC samples generated from a Bayesian analysis under the BDI model to remove the label-switching. The algorithms remove the label-switching issues but do not remove the unidentifiability, which is the nature of the model and data. While in the clustering problem, the labels "group 1" and "group 2" are of no significance, Q and Q ′ under the unidentifiable BDI models may represent different biological hypotheses, and one may want to choose between them. This is discussed later in the subsection "Estimation of introgression probabilities despite unidentifiability" in Discussion. Our efforts make the BDI models usable for real data analysis despite their unidentifiability. We use the BPP program (Flouri et al., 2018) to analyze synthetic datasets as well as genomic data from Heliconius butterflies to demonstrate the utility of the BDI models and the new algorithms. After we have dealt with the BDI models, we discuss the unidentifiability of UDI models and of heuristic methods.

Theory
The Rule of Unidentifiability of BDI Models In full-likelihood implementations of the MSci model, the gene tree G for any given sample of sequences from the modern species represents the complete history of coalescence and introgression events for the sample, including the gene tree topology, the coalescent times, as well as the parental path taken by each sequence at each hybridization node (e.g., Jiao et al., 2021, eq. 14). The probability distribution of the gene tree G depends on the species tree, species divergence times (ts), the population sizes (us) which determine the coalescent rates in the different populations (2/u), and the introgression probabilities at the hybridization nodes (w). It does not depend on the labels attached to the internal nodes in the species tree.
Consider a part of the species tree or MSci model where species A and B exchange migrants at time t X = t Y ( fig. 4).
To study the backwards-in-time process of coalescent and introgression, which gives the probability density of the gene tree f(G | S, Q), we can treat nodes X and Y as one node, XY. When sequences from A reach node XY, each of them has probability 1 − w X of taking the left parental path (RX) and probability w X of taking the right parental path (SY). Similarly when sequences from B reach node XY, they have probabilities w Y and 1 − w Y of taking the left (RX) and right (SY) parental paths, respectively. If we swap branches A and B, carrying with them their population size parameters (u) and introgression probabilities (w), the probability density of the gene trees remains unchanged. Thus the species tree-parameter combinations (S, Q) and (S ′ , Q ′ ) of figure 4b and c give exactly the same probability distribution, In other words, (S, Q) and (S ′ , Q ′ ) are unidentifiable (see eq. 1).
Note that the processes of coalescent and introgression before reaching nodes A and B (with time running backwards) are identical between Q and Q ′ , as are the processes past nodes X and Y. Thus the rule applies if each of A and B is a subtree, with introgression events inside, or if there are introgression events involving a descendant of A and a descendant of B.
If A and B are sister species or the parents R and S are one node in the species tree, the species trees (A, B) and (B, A) NOTE.-Estimates of ts and us are multiplied by 10 3 . MCMC samples are processed using the b-g algorithm before they are summarized.
Estimation of Introgression Rates Using Genomic Data · https://doi.org/10.1093/molbev/msac083 MBE will be the same so that S = S ′ in equation (2). Then Q and Q ′ ( fig. 4) will be two sets of parameter values in the same model and we have a case of within-model unidentifiability.
Otherwise the unidentifiability is cross-model.

Canonical Cases of BDI Models
Here we study major BDI models to illustrate the rule of unidentifiability and to provide reference for researchers who may apply those models to analyze genomic datasets. If we add subtrees onto branches XA, YB, or the root branch R in the two-species tree of figure 1a, so that the BDI event remains to be between two sister species, the model will exhibit within-model parameter unidentifiability ( Material online. One way of seeing that the four models are equivalent or unidentifiable is to assume that the introgression probabilities (w X , w Y , w Z , and w W ) are all , 1 2 , and then work out the major routes taken when we trace the genealogical history of sequences sampled from modern species. In such cases, all four models of supplementary figure S5, Supplementary Material online predict the following: most sequences from A will take the route RZ at node ZW with probability 1 − g; most sequences from B will take the route WX at node XY (with probability 1 − a), then the route WS at node ZW (with probability 1 − d), before reaching RS; and most sequences from C will take the route SY at node XY (with probability 1 − b), before reaching RS. Of course the four models are unidentifiable whatever values the introgression probabilities take. Those models have been used to analyze genomic data from Texas Horned Lizards (Phrynosoma cornutum) (Finger et al., 2022, figure S9). Figure 5 shows two models for five species, each model involving three BDI events. In figure 5a, all three BDI events involve sister species, so that there are 2 3 = 8 unidentifiable within-model towers in the posterior. In figure 5b, one BDI event involves nonsister species while two involve sister species, so that there are two unidentifiable models, each of which has four unidentifiable within-model towers in the posterior.
In general, if there are m BDI events between sister species and n BDI events between nonsister species, there will be 2 n unidentifiable models, each having 2 m within-model unidentifiable towers.
Unidentifiability of Double-BDI Models Figure 6a shows two BDI events between species A and B, which occurred at times t FIG. 4. A part of a species tree (MSci model) for illustrating the rule of BDI unidentifiability. (a) In the BDI model, species RXA and SYB exchange migrants at time t X = t Y . Treat X and Y as one node with left parent RX with population size u X and right parent SY with population size u Y . When a sequence from A reaches XY, it takes the left and right parental paths with probabilities 1 − w X and w X , respectively. When a sequence from B reaches XY, it goes left and right with probabilities w Y and 1 − w Y , respectively. (b,c) Placing the two daughters in the order (A, B) as in Q or (B, A) as in Q ′ does not affect the distribution of gene trees, and constitutes unidentifiable towers in the posterior space. If X and Y are sister species and have the same mother node (with R and S to be the same node), the unidentifiability is within-model; otherwise it is cross-model.
Yang and Flouri · https://doi.org/10.1093/molbev/msac083 MBE respectively. To apply the rule of figure 4, we treat Z and W as one node so that X and Y are considered sister species.
There are then four within-model unidentifiable towers in the posterior space, shown as Q 1 −Q 4 in figure 6. The parameter mappings are given in the table above.
In general, with k BDI events between two species, which occurred at different time points in the past, there will be 2 k unidentifiable within-model towers in the posterior. There may be little information in practical datasets to estimate so many parameters: if all sequences have coalesced before they reach the ancient introgression events near the root of the species tree, the introgression probabilities (ws) and the associated population sizes (us) will be nearly impossible to estimate. Thus we do not consider more than two BDI events between two species. Note that even the model with one BDI event is not identifiable by heuristic methods that use gene tree topologies only. A small simulation is conducted to illustrate the feasibility of applying the double-BDI model ( fig. 6) to genomic datasets; see Results.
Addressing Label-switching Issues and Difficulties with Identifiability Constraints According to our rule, MSci models with BDI events can create both within-model and cross-model unidentifiability. Cross-model unidentifiability is relatively simple to identify and deal with. If the MCMC is run with the MSci model fixed , only one of the models (e.g., model S 1 with parameters Q 1 in supplementary fig. S5, Supplementary Material online) is visited in the chain. One can then summarize the posterior distribution for parameters under that model (which may be smooth and single-moded), and the posterior summary may be mapped onto the other unidentifiable models according to the rule. See Finger et al. (2022) for such an application of BDI models of supplementary figure S5, Supplementary Material online. If the MCMC is trans-model and visits different models in the chain Zhang et al., 2018), the posterior space is symmetrical between the unidentifiable models (such as models S 1 -S 4 of supplementary fig. S5, Supplementary Material online). However, such symmetry is unlikely to be achieved in the MCMC sample due to well-known mixing difficulties of trans-model MCMC algorithms. One may choose to focus on one of the models (e.g., S 1 of supplementary fig. S5, Supplementary Material online) and postprocess the MCMC sample to map the sample onto the chosen model before producing the within-model posterior summary. Oftentimes the MCMC may explore the within-model posterior space very well, despite difficulties of moving from one model to another. In all cases, the researcher has to be aware of the unidentifiable models which are equally good explanations of the genetic data (see Discussion).
Our focus here is on within-model unidentifiability created by BDI events between sister species. When there are multiple modes in the posterior, each mode may offer a sensible interpretation of the data, but it is inappropriate to merge MCMC samples from different modes, or to construct posterior summaries such as the posterior means and credibility intervals (CIs) using MCMC samples that traverse different modes. It is instead more appropriate to summarize the samples for each mode.
A common strategy for removing label-switching is to apply so-called identifiability constraints. In the simple BDI model of figure 1, any of the following constraints may be applicable: w X , 1 2 , w Y , 1 2 , and u X , u Y . Such identifiability constraints may be imposed during the MCMC or during postprocessing of the MCMC samples. As discussed previously (Celeux et al., 1998;Stephens, 2000), such a constraint may be adequate if the posterior modes are well separated, but may not work well otherwise. For example, if w X is far away from 1 2 in all MCMC samples, it will be simple to postprocess the MCMC sample to impose the constraint w X , 1 2 . This is the case in analyses of the large datasets in this paper, for example, when all noncoding and exonic loci from chromosome 1 of the Heliconius data are analyzed (table 1). However, when the posterior modes are not well-separated (either because the true parameter value is close to the boundary defined by the inequality or because the data lack information so that the CIs are wide), different identifiability constraints can lead to very different parameter posteriors (Richardson and Green, 1997), and an appropriate FIG. 5. Two species trees (MSci models) for five species each with three BDI events. (a) Three BDI events between sister species create 2 3 = 8 within-model towers in the posterior. (b) Two BDI events between sister species and one BDI event between nonsister species create two unidentifiable models each with four within-model unidentifiable towers in the posterior space.
Estimation of Introgression Rates Using Genomic Data · https://doi.org/10.1093/molbev/msac083 MBE constraint may not exist. Imposing identifiability constraints may then generate posterior distributions over-represented near the boundary, with seriously biased posterior means (Celeux et al., 1998;Stephens, 2000). For example, w X may have substantial density mass both below and above 1 2 , and imposing the constraint w X , 1 2 will artificially generate high density mass close to w X = 1 2 . Similarly the posterior distributions of u X and u Y may overlap, so that the constraint u X , u Y may not be appropriate.
New Algorithms to Process MCMC Samples from the BDI Model to Remove Label Switching One approach to dealing with label-switching problems in Bayesian clustering is relabeling. The MCMC is run without any constraint, and the MCMC sample is then postprocessed to remove label switching, by attempting to move each point in the MCMC sample to its alternative unidentifiable positions in order to, as far as possible, make the marginal posterior distributions smooth and unimodal (Celeux et al., 1998;Stephens, 2000). The processed sample is then summarized to generate the posterior of the parameters. Here we follow this strategy and implement three relabeling algorithms to postprocess the MCMC samples generated under the BDI model. . 1). The other parameters in the model are not involved in the unidentifiability and are simply copied along. Let Q t , t = 1, . . . , N, be the N samples of parameters generated by the MCMC algorithm. Each sample is a point in the 4-D space. Let z t be a transform for point t, with z t (Q t ) = Q t to be the original point, and z t (Q t ) = Q ′ t to be the transformed or mirror point ( fig. 1b and   c). With a slight abuse of notation, we also treat z t as an indicator, with z t = 0 and 1 representing Q t and Q ′ t , respectively. For each sample t, we choose either the original point or its mirror point, to make the posterior of the parameters look smooth and single-moded as far as possible. The first two algorithms, called center-of-gravity algorithms CoG 0 and CoG N , loop through two steps.
Algorithms CoG 0 and CoG N . Initialize. For each point t, t = 1, . . . , N, pick either the original point (Q t ) or its mirror point (Q ′ t ). We set z t to 0 (for the original point Q t ) if w X + w Y , 1 or 1 (for the mirror point Q ′ t ) otherwise.
• Step 1. Determine the center of gravity, given by the sample means of the parameters, Step 2. For each point t = 1, . . . , N, compare the current and its mirror positions and choose the one closer to the center of gravity (m).
In step 2, we use the Euclidean distance where j j are the four parameters in Q t : w X , w Y , u X , u Y . This is algorithm CoG 0 . If we consider different scales in the different dimensions (for example, w X and u X may have very different posterior variances), we can calculate the sample variances n (in addition to the sample means m) in step 1 and use them FIG. 6. Species trees (MSci models) for two species (A and B) with double-BDI events creating four within-model towers, represented by Q 1 , Q 2 , Q 3 , and Q 4 . (a) The model involves 14 parameters: 7 us, 3 ts, and 4 ws, with eight of them involved in the label-switching unidentifiability, Four unidentifiable towers showing the mappings of parameters (eq. 3). To apply the rule of figure 4, we treat each pair of BDI nodes as one node, so that X and Y have the same node ZW as the parent, and the unidentifiability caused by the BDI event at node XY is within-model, as is the unidentifiability for the BDI event at node ZW.
Yang and Flouri · https://doi.org/10.1093/molbev/msac083 MBE as weights to normalize the differences in step 2, with We refer to this as algorithm CoG N . Each MCMC sample point Q t can be in either of two positions (represented by z t = 0 or 1).
Step 1 calculates the center of attraction (m), which represents the current "location of most points." Step 2 then moves each point to its mirror position it is closer to the current center of attraction. If there are only two modes in the posterior (due to label switching) but no other modes, one of the unidentifiable modes will become the center of attraction and all points will move to its neighborhood as the algorithm progresses. Which of the two modes becomes the center of attraction is arbitrary, influenced by the initial positions when the algorithm runs.
The third algorithm, called the b-g algorithm, follows the relabeling algorithm for Bayesian clustering of Stephens (2000). We use maximum likelihood (ML) to fit the sample {Q t } to independent beta distributions for w X and w Y and gamma distributions for u X and u Y : are the beta and gamma densities and where v = (p X , q X , p Y , q Y , a X , b X , a Y , b Y ) is the vector of parameters in those densities. The log likelihood, as a function of the parameters v and the transforms z = {z t }, is where the density f is given in equation (6).
We have implemented the following iterative algorithm to estimate v and z by maximizing ℓ.
Algorithm b-g. Initialize z t , t = 1, . . . , N. As before, we set z t to 0 (for Q t ) if w X + w Y , 1 or 1 (for Q ′ t ) otherwise. • Step 1. Choosev to maximize the log likelihood ℓ (eq. 8) with the transforms z fixed. • Step 2. For t = 1, . . . , N, choose z t = 0 or 1 to maximize ℓ t (v, z t (Q t )) with v =v fixed. In other words, compare Q t and Q ′ t and choose the one that better fits the beta and gamma distributions.
Step 1 fits two beta and two gamma distributions by ML and involves four separate 2-D optimization problems. The maximum-likelihood estimates (MLEs) of p and q for the beta distribution b(j; p, q) are functions of t log j t and t log (1 − j t ), whereas the MLEs of a and b for the gamma distribution g(j; a, b) are functions of t j t and t log j t . These optimization problems are simple, which we solve using the BFGS algorithm in the PAML program (Yang, 2007).
Step 2 involves N independent optimization problems, each comparing two points (z t = 0 and 1), with v fixed. It is easy to see that the algorithm is nondecreasing (that is, the log likelihood ℓ never decreases) and converges, as step 1 involves ML estimation of parameters in the beta and gamma distributions, and step 2 involves comparing two points.
Note that the b-g algorithm becomes the CoG 0 and CoG N algorithms if the beta and gamma densities are replaced by normal densities (with the same or different variances for CoG 0 and CoG N , respectively).
For illustration we applied the CoG 0 algorithm to a "thinned" sample of 1,000 points from the MCMC sample of figure 3a generated in the BPP analysis of the 500 noncoding Heliconius loci. We used three initial conditions (three rows in supplementary fig. S6, Supplementary Material online). The last plot on each row is a summary of the final processed sample. Thus the first two runs produced the same posterior, while the third run produced its mirror image.
Algorithms CoG 0 , CoG N , and b-g for the double-BDI model. Under the double-BDI model ( fig. 6a), eight parameters are involved in the unidentifiability, with Q = (w X , w Y , u X , u Y , w Z , w W , u Z , u W ). There are four within-model unidentifiable towers, so that z t takes four values (0, 1, 2, 3), as follows (eq. 3) • z t = 0: if the parameters are in Q 1 , do nothing.
u X and u Y , swap w Z and w W , and swap u Z and u W ; We use the same strategy as in the BDI model and implement the three algorithms (CoG 0 , CoG N , and b-g) as before. For b-g, we fit four beta distributions to ws and four gamma distributions to us, with 16 parameters in v. We prefer the tower in which the introgression probabilities are small and initialize the algorithm accordingly. The algorithm similarly loops through two steps. In step 1, we calculate the center of gravity (represented by the means) or estimate parametersv to fit the beta and gamma densities, with the transforms z fixed. For CoG 0 and CoG N , this step involves calculating the sample means and variances for the eight parameters in Q, while for b-g, it involves a 16-D optimization problem (or eight 2-D optimization problems) for fitting the beta and gamma distributions by ML. In step 2, we compare the four positions for each Estimation of Introgression Rates Using Genomic Data · https://doi.org/10.1093/molbev/msac083 MBE sample point when the center of gravity or parametersv are fixed.
Implementation. To apply the rule and the algorithms developed here, we need to identify the BDI event and the parameters involved in the unidentifiability, that is, The algorithm is then used to process the MCMC sample. If there are multiple BDI or double-BDI events between sister species, one may simply apply the postprocessing algorithm multiple times. For instance, three rounds of postprocessing may be applied for the model of figure 5a (for the BDI events between A and B, between D and E, and between S and U, respectively), while the model of 5b requires two rounds (for the BDI between D and E, and between S and U).
The algorithms are implemented in C and require minimal computation and storage. Processing 5 × 10 5 samples takes several rounds of iteration and a few seconds of running time, mostly spent on reading and writing files. The algorithms are integrated into the BPP program (Flouri et al., 2018) so that MCMC samples from various BDI models are postprocessed and summarized automatically. We also provide a stand-alone program in the github repository abacus-gene/bpp-msci-D-process-mcmc/.

Introgression between Heliconius melpomene and H. timareta
We fitted the BDI model of figure 2 to the genomic sequence data from three species of Heliconius butterflies: H. melpomene, H. timareta, and H. numata (Edelman et al., 2019;Thawornwattana et al., 2022). When we used the first 500 loci, either noncoding or exonic, there was substantial uncertainty in the posterior of w X and w Y , and the MCMC jumped between the twin towers, and the marginal posteriors had two modes, due to label switching ( fig. 3a and supplementary  We then analyzed all the noncoding and exonic loci on chromosome 1, and then all the autosomal loci (table 1). With the large datasets, the parameters were better estimated with narrower CIs and the unidentifiable towers were well separated. In fact, the MCMC visited only one of the two towers, but the visited tower was well explored so that multiple runs produced highly consistent results after label-switching was removed using the relabeling algorithms. When we started the MCMC with small values for w X and w Y , postprocessing of the MCMC samples often had no effect.
Estimates of parameters from all six datasets are summarized in table 1. The introgression probabilities had overlapping CIs in datasets of different sizes, but w X was smaller in the larger datasets, with posterior means and 95% highest-probability-density (HPD) CIs for the noncoding data to be 0.354 (0.022, 0.664) at L = 500, 0.124 (0.007, 0.243) for chromosome 1, and 0.036 (0.001, 0.064) for all autosomal loci. Results for the exonic loci showed the same pattern. The rate appeared to be higher for chromosome 1 than the rest of the autosome. Introgression probability w Y was more similar among the datasets, at about 10%. We note that w in the MSci model reflects the long-term effects of gene flow and selection purging introgressed alleles, influenced by linkage to gene loci under natural selection (Martin and Jiggins, 2017). As a result, the introgression rates are expected to vary across the chromosome or genome. It will be interesting to analyze larger datasets with more samples per species to examine the variation in the rate of gene flow across the genome.
Note that H. melpomene has a widespread geographical distribution whereas H. timareta is restricted to the Eastern Andes. The small u M estimates are most likely due to the fact that the H. melpomene sample was from a partially inbred strain to avoid difficulties with genome assembly. Estimates of us and ts were smaller for the coding loci than for the noncoding loci, presumably due to purifying selection removing deleterious nonsynonymous mutations (Shi and Yang, 2018).

Analysis of Data Simulated under the Double-BDI Model of figure 6a
We conducted a small simulation to illustrate the feasibility of the double-BDI model ( fig. 6), simulating 10 replicate datasets of L = 500, 2,000, and 8,000 loci. The three algorithms were used to process the MCMC samples, before they were summarized.
For the case of L = 500, a typical case is shown in figure 7. While there are four unidentifiable towers in the 8-D posterior space (eq. 3), the MCMC visited only two of them, with different values for parameters around the BDI event at the node ZW. The dataset of L = 500 loci are very informative about the parameters for the BDI event at node XY (w X , w Y , u X , u Y ), so that these had highly concentrated posteriors with well-separated towers. We started the Markov chains with small values (e.g., 0.1 and 0.2) for w X and w Y , so that the sampled points were all around the correct tower for those parameters. If the chain started with large w X and w Y , it would visit a "mirror" tower. Thus, postprocessing of the MCMC samples mostly affected parameters around the BDI event at ZW (w Z , w W , u Z , Yang and Flouri · https://doi.org/10.1093/molbev/msac083 MBE u W ). Figure 7 shows the effects on parameters w Z and w W using the b-g algorithm. The CoG 0 and CoG N algorithms produced nearly identical results, and all algorithms were effective in removing label switching. The postprocessed samples were summarized to calculate the posterior means and the HPD CIs ( fig. 8).
At L = 2,000 or 8,000 loci, the four towers were well separated and the MCMC visited only one of them. Applying the postprocessing algorithms either had no effect or, in rare occasions, moved all sampled points from one tower to another.
Posterior means and the 95% HPD CIs for all parameters were summarized in figure 8. Parameters around the BDI event at ZW (w Z , w W , u Z , u W ) are the most difficult to estimate. Nevertheless, the CIs for all parameters were smaller at L = 8, 000 than at L = 500 or 2,000, and the posterior means were converging to the true values. Note that while the simulation was conducted using one set of correct parameter values (say, Q 1 of fig. 6), we considered the estimates to be good if they were close to any of the four unidentifiable towers (say, Q 2 , Q 3 , or Q 4 ). This is analogous to treating the estimate as correct in Bayesian clustering if the true model includes two groups in proportions p 1 = 10% and p 2 = 90% with means m 1 = 100 and m 2 = 1, while the method of analysis infers two groups in proportions p ′ 1 = 90% and p ′ 2 = 10% with means m ′ 1 = 1 and m ′ 2 = 100. Just as Q = (p 1 , m 1 , m 2 ) and Q ′ = (p 2 , m 2 , m 1 ) are unidentifiable towers and equally correct answers in the clustering problem, here Q 1 , Q 2 , Q 3 , and Q 4 are equally correct answers.

Analysis of Data Simulated with One BDI Event with Poorly Separated Modes
We simulated a challenging dataset for the relabeling algorithms, with L = 500 loci, under the BDI model of figure 1a with (w X , w Y ) = (0.7, 0.2) (see supplementary table S1, Supplementary Material online). As w X and w Y were not too far away from 1 2 and the dataset was small, the posterior modes were poorly separated, with considerable mass near ( 1 2 , 1 2 ). In the unprocessed MCMC sample, w X had two modes around 0.8 and 0.2 and the chain was switching between them (supplementary fig. S7a, Supplementary Material online). The posterior means were at 0.51 for w X and 0.50 for w Y , close to 1 2 (supplementary fig. S7a, Supplementary Material online). These are misleading summaries, as the sample was affected by label switching. In the processed samples (supplementary fig. S7b-d, Supplementary Material online), label switching was successfully removed and both w X and w Y were single-moded. The three algorithms (b-g, CoG N , and CoG 0 ) produced similar results, with single-moded posterior, around the tower (w X , w Y ) = (0.7, 0.2). The posterior means of (w X , w Y ) were (0.755, 0.447), (0.766, 0.461), and (0.765, 0.462) for the three algorithms, b-g, CoG N , and CoG 0 , respectively (supplementary table S1, Supplementary Material online). The estimates from b-g were slightly closer to the true values than those from CoG N and CoG 0 . The three relabeling algorithms worked well even when the posterior modes were poorly separated.
Parameters not involved in label-switching, such as the species divergence and introgression times (t R , t X ) and the population sizes for the modern species and for the root (u A , u B , u R ), were well estimated, with the posterior means close to the true values and with narrow CIs (supplementary table S1, Supplementary Material online). However, parameters involved in label switching (w X , w Y , u X , u Y ) were poorly estimated at this data size (with L = 500 loci), because of the difficulty to separate the two towers and the influence of the priors. The estimates should improve if more loci are used in the data. To confirm this expectation, we simulated two FIG. 7. Trace plots of MCMC samples and 2-D scatter plots for parameters w Z (purple) and w W (green) (a) before and (b) after the postprocessing of the MCMC samples for the double-BDI model of figure 6a. Postprocessing used the b-g algorithm (b), while CoG N and CoG 0 produced nearly identical results (not shown). This is for replicate 2 for L = 500 loci (see fig. 8).
Estimation of Introgression Rates Using Genomic Data · https://doi.org/10.1093/molbev/msac083 MBE more datasets with L = 2,000 and 8,000 loci, respectively. In those two datasets, parameters not involved in label switching (t R , t X , u A , u B , u R ) had very narrow CIs (supplementary table S1, Supplementary Material online). At L = 8,000, the posterior means of Q = (w X , w Y ) were closer to the true values (0.7, 0.2) and the 95% CIs were narrower than in the small dataset of L = 500 (supplementary table S1, Supplementary Material online). Note that ancestral population sizes (such as u X and u Y ) are hard to estimate even in models of unidirectional introgression which do not have label-switching issues (Huang et al., 2020).

Data Size, Precision of Parameter Estimation, MCMC Convergence, and the Utility of the Relabeling Algorithms
We have observed three kinds of behaviors of the MCMC algorithm and the relabeling algorithms depending on the data size. In small datasets, the parameters are poorly estimated with large uncertainties, and the posterior modes (the unidentifiable towers) are not well separated. In such cases, applying simple constraints (such as w X , 1 2 ) is problematic because the truncation distorts the marginal summaries of the posterior, with different constraints producing different posterior summaries (Richardson and Green, 1997;Celeux et al., 2000;Stephens, 2000). The relabeling algorithms are preferable. An example is the small dataset of L = 500 loci simulated under the model of one BDI event (supplementary fig. S7 and table S1, Supplementary Material online).
In intermediate datasets, the parameters are well estimated, the posterior modes are well separated, but the MCMC algorithm jumps between the modes, switching labels. In such cases, any of the relabeling algorithms will work well. If the posterior modes are far away from the boundary defined by the constraints (such as w X , 1 2 ), even imposing simple constraints will work as well. Examples include the two small butterfly datasets with L = 500 loci ( fig. 3 and supplementary fig.  S1, Supplementary Material online), and the datasets simulated under the double-BDI model ( fig. 7).
Finally, in very large datasets, the parameters are extremely well estimated with very narrow CIs, and the posterior modes are so sharply concentrated that the MCMC algorithm stays on one of the unidentifiable towers and never moves to the mirror towers. Furthermore, in multiple runs of the same analysis the MCMC may be "stuck" on different towers. In such cases, the relabeling algorithms will either not move any sample points at all or move all points from one tower to another, and any of the algorithms will work well. This scenario is common in analyses of large genomic datasets with thousands of loci, such as the large noncoding and exonic datasets from the Heliconius butterflies ( fig. 2); See Finger et al. (2022) and Thawornwattana et al. (2022) for many more examples.
We note that in all three scenarios, the relabeling algorithms (in particular, the b-g algorithm) were either better or not worse than the alternatives such as imposing simple constraints. Given that even the b-g algorithm involves minimal computation, we recommend its automatic use in all cases. Samples from different runs visiting different unidentifiable modes may be merged before postprocessing using the relabeling algorithm.
In theory, if the MCMC has converged and is mixing well and the algorithm is run long enough, it should visit the unidentifiable towers with exactly the same probability and the means of introgression probabilities from the unprocessed samples should be 1 2 . One might expect this to provide a useful criterion for diagnosing the convergence of MCMC algorithms. Indeed Jasra et al. (2005) regarded it "a minimum requirement of convergence for a mixture posterior to be such that we have explored all possible labellings of the parameters." Here the labelings correspond to the unidentifiable towers. We suggest that 8. Posterior means and the 95% HPD CIs in 10 replicate datasets of L = 500, 2,000, and 8,000 loci, simulated and analyzed under the double-BDI model of figure 6a. The MCMC samples are postprocessed using the b-g algorithm before they are summarized (e.g. fig. 7). Eight parameters are involved in the label-switching unidentifiability: w X , w Y , u X , u Y , w Z , w W , u Z , and u W (see fig. 6). Yang and Flouri · https://doi.org/10.1093/molbev/msac083 MBE this requirement is too stringent and unnecessary. As discussed above, in large genomic datasets, the posterior may be highly concentrated, and the chain may never jump between the towers even in very long MCMC runs. While the chain may be visiting different mirror towers in different runs of the same analysis, each chain may be exploring the space around the visited tower thoroughly, and after label switching is removed, the MCMC samples from the different runs may produce nearly identical posterior summaries, suggesting that reliable inference is possible. In simulations of large datasets, the posterior estimates after label-switching problems are removed converge to the true values (e.g., Flouri et al., 2020, fig. S10A). One could include a random permutation step in each MCMC iteration, so that the unidentifiable towers are visited with equal probabilities, but this does not eliminate the need for postprocessing the MCMC sample to remove label switching. We suggest that exploration of all unidentifiable towers is unnecessary for correct inference and should not be used as a criterion for diagnosing MCMC convergence. Instead convergence diagnosis should be applied after the MCMC sample is processed to remove label switching. For example, one should run the same analysis multiple times and confirm that the posterior summaries when the MCMC samples are processed and mapped onto the same tower are consistent between runs. The efficiency of the MCMC algorithm or the effective sample size (ESS) (Yang and Rodríguez, 2013) should also be calculated using the processed samples.

Identifiability of MSci Models with Unidirectional Introgressions
The identifiability of MSci models involving unidirectional introgression (UDI) events appears to be simpler than for BDI models Jiao et al., 2021). MSci model A , figure 1) is consistent with three different biological scenarios ( fig. 9a-c). In scenario A 1 , two species SH and TH merge to form a hybrid species HC, but the two parental species become extinct after the merge. This scenario may be rare. In scenario A 2 , species SUX contributes migrants to species THC at time t H and has since become extinct or is unsampled in the data. In scenario A 3 , TUX is the extinct or unsampled ghost species. The three scenarios are unidentifiable using genomic data. Model B 1 assumes introgression from species RA to TC at time t S = t H (fig. 9d). This is distinguishable using genetic data from the alternative model B 2 in which there is introgression from RB to SC (fig. 9e). Note that models B 1 and B 2 are both special cases of model A 1 with different constraints (that is, t S = t H , t T for model B 1 and t S . t H = t T for model B 2 ).
Note that the sampling configuration may affect the identifiability of parameters in the model (Yu et al., 2012;Zhu and Degnan, 2017). The simplest such example may be the population size parameter (u). If at most one sequence per locus is sampled from a species, the population size for that species will be unidentifiable. Similarly, if no more than one sequence per locus can enter an ancestral population when we trace the genealogy of the sampled sequences backwards in time, u for that ancestral species will be unidentifiable. Such unidentifiability disappears when multiple sequences per species are sampled. Note that a diploid sequence is equivalent to two haploid sequences. Similarly introgression models that are unidentifiable with one sampled sequence per species may become identifiable when multiple sequences per species are sampled (Zhu and Degnan, 2017).
An interesting example concerns the UDI model in the case of two species with one sequence sampled per species per locus, which creates a cross-model unidentifiability ( fig. 10a and b). In both the A B and B A introgression models, five parameters are estimable, but the two models are unidentifiable, because they produce exactly the same distribution of the coalescent time between the two sequences at any locus. In other words, Estimation of Introgression Rates Using Genomic Data · https://doi.org/10.1093/molbev/msac083 MBE with a pair of sequences per locus, one can estimate the timing and strength of introgression, but not its direction. If multiple sequences are available per species per locus, the two models are identifiable, as are the eight parameters in each model. Even if the model is mathematically identifiable with one sequence per species per locus, including multiple samples per species (in particular, for species that are descendants of a hybridization node in the species tree) can boost the information content in the data dramatically. Thus, we recommend the use of multiple samples per species in studies of cross-species gene flow, and suggest that the most interesting scenario for studying unidentifiability of models of gene flow should be full-likelihood analysis of multilocus sequence data, with multiple sequences sampled per species.
It is noteworthy that many parameter settings and data configurations exist in which some parameters are hard to estimate, because the data lack information about them. For example, ancestral population sizes for short and deep branches in the species tree are hard to estimate, because most sequences sampled from modern species may have coalesced before reaching that population when we trace the genealogy of the sample backwards in time (Huang et al., 2020). Similarly, if few sequences reach a hybridization node, there will be little information in the data about the introgression probabilities at that node. In such cases, even if the model is identifiable mathematically, it may be nearly impossible to estimate the parameters with any precision even with large datasets.
In some cases, certain parameters may be nearly at the boundary of the parameter space, and this may create near unidentifiability with multiple modes in the posterior. For example, two speciation events that occur in rapid succession will generate a very short branch in the species tree with a near trichotomy in the species tree. Then MSci models that posit the same introgression events but different histories of species divergences will fit the data nearly equally well and become multiple modes in the posterior space (see Finger et al., 2022 for an example). Similarly introgression probabilities near 0 or 1 can also create nearly equally good explanations of the data and become multiple modes in the posterior. In such situations, the MCMC samples around different modes should be summarized separately.

Unidentifiability of Heuristic Methods
As mentioned in Introduction, the unidentifiability discussed in this paper concerns the intrinsic nature of the inference problem when introgression models are applied to genomic sequence data, and thus applies to not only full-likelihood methods but also heuristic methods based on summaries of the sequence data. Indeed a model that is unidentifiable by a full-likelihood method must be unidentifiable by any heuristic method.
In contrast, a model that is identifiable by a full-likelihood method may still be unidentifiable by a heuristic method as the heuristic method may not be using all information in the data. Here we briefly discuss a few heuristic methods, focusing on their common features. Interested readers may consult the recent reviews by Elworth et al. (2019) and Hibbins and Hahn (2021). Heuristic methods developed up to now are mostly of two kinds, based on either genome-wide averages or estimated gene trees for genomic segments (loci).
The popular ABBA-BABA test (Durand et al., 2011) uses the parsimony-informative site patterns across the genome to detect gene flow. Consider three populations/ species S 1 , S 2 , and S 3 , with the given phylogeny ((S 1 , S 2 ), S 3 ), plus an outgroup species O. There are three parsimony-informative site patterns: ABBA, BABA, and BBAA. Here A and B represent any two distinct nucleotides and BBAA means S 1 and S 2 have the same nucleotide while S 3 and O have another. For very closely related species, one may consider nucleotide A in the outgroup as the ancestral allele and B the derived allele. Site pattern BBAA matches the species tree, while ABBA and BABA are the mismatching patterns. Given the species tree with no gene flow, the two mismatching patterns have the same probability, but when there is gene flow between S 1 (or S 2 ) and S 3 , they will have different probabilities. The difference between the two mismatching site-pattern counts can then be used to test for the presence of gene flow (Durand et al., 2011): The D-statistic may also be seen as a comparison between the number of derived alleles shared by S 2 and S 3 with  that shared by S 1 and S 3 . It can test for the presence of gene flow, but provides no information about its direction, timing, or strength. The site pattern counts can also be used to estimate the introgression probability, as in the program HYDE (Blischak et al., 2018;Kubatko and Chifman, 2019): This is based on the hybrid speciation model (assuming t S = t H = t T and u S = u T in model A 1 of fig. 9). The estimate may be biased if this symmetry assumption does not hold. Instead of the parsimony-informative site patterns, the average sequence distance between species may be similarly used to construct a test (Hahn and Hibbins, 2019). Furthermore, the D-statistic has been extended to the case of five species, with a symmetric species tree assumed, in the so-called D FOIL test, with the aim to detect the direction of gene flow (Pease and Hahn, 2015). Note that both the site-pattern counts and between-species distances are genome-wide averages. If the data consist of multilocus sequence alignments, they can be merged (concatenated) into a super-alignment to calculate those statistics. A great advantage of those methods is that they involve minimal computation. A serious drawback is that they do not make use of information in genealogical variations across the genome (Lohse and Frantz, 2014;Shi and Yang, 2018). Like the coalescent process, gene flow between species creates stochastic fluctuations in the genealogical history (gene tree topology and coalescent times) across the genome, with the probability distribution given by the parameters in the multispecies coalescent model with gene flow, including species divergence times, effective population sizes for modern and ancestral species, and the directions and rates of gene flow. As a result, there is important information about those parameters in such genomic variation, but this information is ignored by those methods. In other words, those methods use the total or mean site-pattern counts but fail to use information in the variances in the site-pattern counts among loci. As a result, most parameters in the coalescent model with introgression are unidentifiable by the heuristic methods mentioned above. None of them can detect signals of gene flow between sister species, and for nonsister species, none of them can estimate the introgression probabilities when gene flow occurs in both directions (e.g., w X and w Y in fig. 1a or a and b in supplementary  fig. S3a, Supplementary Material online).
The second kind of heuristic methods use reconstructed gene tree topologies for multiple loci as the input data. Consider again the species quartet S 1 , S 2 , S 3 , and O (outgroup), with the given phylogeny ((S 1 , S 2 ), S 3 ), and one sampled sequence per species. The two mismatching gene trees ((S 2 , S 3 ), S 1 ) and ((S 3 , S 1 ), S 2 ) have the same probability if there is coalescence but no gene flow, but different probabilities if there is in addition gene flow between the nonsister species (between S 1 and S 3 or between S 2 and S 3 ). Thus the frequencies of gene tree topologies can be used to estimate the introgression probability, as in the SNAQ method (Solis-Lemus and Ane, 2016, see also Yu et al., 2012). As there are only two free quantities (frequencies of three gene trees with the sum to be 1), the approach can estimate the internal branch length in coalescent units and the introgression probability, but not any other parameters in the model.
In the general case, the probabilities of gene tree topologies under any introgression model can be calculated by summing over the compatible coalescent histories (Yu et al., 2012(Yu et al., , 2014. The probability distribution of gene tree topologies can then be used to distinguish among different introgression models and to estimate the parameters in the introgression model by ML (as in PhyloNet; , treating gene tree topologies as data. A concern with the two-step method is that the estimated gene trees may involve uncertainties or errors, in particular when the species are closely related. Including gene tree branch lengths (coalescent times) makes many introgression models that are unidentifiable based on gene tree topologies alone become identifiable (Yu et al., 2012;Zhu and Degnan, 2017). However, two-step methods that make use of estimated branch lengths was found to perform poorly as the large uncertainties and errors in the estimated branch lengths can have a major impact on inference of species divergence and cross-species gene flow (Degnan, 2018).
There is currently a wide gap between likelihood and heuristic methods. Heuristic methods are computationally orders-of-magnitude faster than likelihood methods, which in particular do not scale well for large genomic datasets. The statistical properties of heuristic methods are also incomparably poorer than those of likelihood methods: heuristic methods are simply unable to provide any estimates for many fundamental population parameters for characterizing the evolutionary history of the species, such as the species divergence/introgression times and the population sizes of extant and extinct species. There is an acute need for improving the statistical performance of the heuristic methods and the computational efficiency of the full-likelihood methods.
Given the limitations of the heuristic methods, one should apply caution when using them to draw biological conclusions concerning gene flow between species. For example, does gene flow occur more often between sister species or between nonsister species? When gene flow occurs between two species, does it often involve one direction (UDI) or both directions (BDI)? Most heuristic methods cannot identify or detect gene flow between sister species or gene flow in both directions, but it may be erroneous to conclude that such gene flow never occurs in nature. Whether BDI or UDI is more common is an interesting empirical question, but both models provide important biological hypotheses testable using genomic sequence data. In a Estimation of Introgression Rates Using Genomic Data · https://doi.org/10.1093/molbev/msac083 MBE recent analysis of genomic sequence data from the North-American chipmunks (Tamias quadrivittatus), the use of the D-statistic and HYDE detected no evidence of gene flow affecting the nuclear genome despite widespread mitochondrial gene flow (Sarver et al., 2021). However, a reanalysis of the same data using BPP revealed robust evidence for multiple ancient introgression events, involving both sister and nonsister species (Ji et al., 2021).

Displayed Species Trees and Identifiability of MSci Models
Pardi and Scornavacca (2015) studied the unidentifiability of network models using data of gene tree topologies "displayed" by the network (fig. 11). Binary species trees generated by taking different parental paths at hybridization nodes are called "displayed species trees" (Pardi and Scornavacca, 2015) or "parental species trees" (Kubatko, 2009). For example, the two network models N 1 and N 2 of figure 11a are unidentifiable when only one sequence is sampled per species because they induce the same three displayed species trees with the same branch lengths (Pardi and Scornavacca, 2015). However, as pointed out by Zhu and Degnan (2017), N 1 and N 2 are identifiable using gene tree topologies if multiple sequences are sampled from B.
Previously Kubatko (2009, eq. 3; see also Meng and Kubatko, 2009) formulated the probability distribution of gene trees (topology alone or topology with coalescent times) as a mixture over the displayed species trees. To simulate gene trees or sequence data at a locus, one samples a displayed species tree first and then simulates the gene tree and sequence alignment according to the simple MSC model (Gerard et al., 2011). This formulation is in general incorrect as it forces all sequences at the locus to take the same parental path at each hybridization node, whereas correctly there should be a binomial sampling process when two or more sequences reach a hybridization node. In model N 1 of figure 11a, when multiple B sequences reach species X, it should be possible for some sequences to take the left parental path while the others take the right path. The formulation is correct in the special case where each hybridization node on the species tree has at most one sequence from all its descendant populations (Zhu and Degnan, 2017).
Even though the notion that gene trees are displayed by a phylogenetic network has played a central role in many studies that attempt to use gene tree topologies to construct the phylogenetic network, examination of the displayed gene trees is not a reliable approach to studying the unidentifiability of phylogenetic network models (Zhu and Degnan, 2017). The most probable gene tree may even have a topology that is different from all of the displayed trees (Zhu and Degnan, 2017). Note that both MSci models corresponding to networks N 1 and N 2 are identifiable when genomic sequence data with multiple samples per species are analyzed using full-likelihood methods ( fig. 11d and e), as are all parameters in each models ( fig. 11a' and b'). In summary, we suggest that the idea of displayed species trees may not be a very useful one either for calculating the density of gene trees or for studying the identifiability of MSci models when there are multiple samples per species in the data. Instead, one should explicitly treat the biological process of coalescent and introgression in the model (Zhu and Degnan, 2017). We suggest that multiple sequences be sampled per species (in particular from species involved in hybridization or from descendant species of hybridization nodes) when genomic data are used to infer gene flow.

Estimation of Introgression Probabilities Despite Unidentifiability
The three relabeling algorithms for postprocessing MCMC samples under the BDI model produced very similar results in the applications in this study. In particular, the simple center-of-gravity algorithms produced results that appear to be as good as the more elaborate b-g algorithm, despite the fact that the normal distribution is a poor approximation to the posterior of introgression probabilities (w X and w Y ). This is due to the fact that the distributions (or the distances in the CoG algorithms) are used to compare the unidentifiable mirror positions of sample points only, but are not used to approximate the posterior distribution of those parameters, which are estimated by using the processed samples. For the same reasons, if there exist multiple modes in the posterior that are not due to label switching, such genuine multimodality will not be removed by the relabeling algorithms (Stephens, 2000). Similarly, while we fit independent distributions for parameters in the algorithms (eq. 6), there is no need to assume independence in the posterior for the algorithms to work.
A model with a label-switching type of unidentifiability is still useful for real data analysis. In the clustering problem, the Bayesian analysis may reveal the existence of two groups, in proportions p 1 and p 2 = 1 − p 1 with means m 1 and m 2 , and it does not matter if it cannot decide which group should be called "group 1." The twin towers Q and Q ′ under the BDI model ( fig. 1) constitute a mathematically similar label-switching problem. However, Q and Q ′ under BDI may represent different biological scenarios or hypotheses. Suppose that species A and B are distributed in different habitats (dry for A and wet for B, say), and suppose the ecological conditions have changed little throughout the history of the species. Q with w X , 1 2 and w Y , 1 2 may mean that species A has been in the dry habitat over the whole time period since species divergence at time t R , while species B has been in the wet habitat, and they came into contact and exchanged migrants at time t X . In contrast, Q ′ with w ′ X . 1 2 and w ′ Y . 1 2 may mean that Yang and Flouri · https://doi.org/10.1093/molbev/msac083 MBE species A was in the wet habitat and species B was in the dry habitat since species divergence at time t R , but when they came into contact at time t X they nearly replaced each other, switching places, so that today species A is found in the dry habitat while B in the wet habitat. The two sets of parameters Q and Q ′ may thus mean different biological hypotheses. As genomic data from modern species provide information about the order and timings of species divergences and cross-species introgressions, but not about the geographical locations and ecological conditions in which the divergences and introgressions occurred, such biological scenarios are unidentifiable using genomic data and become unidentifiable towers in the posterior distribution in Bayesian analysis of genomic data under the MSci model. Unidentifiable models discussed in this paper are all of this nature. The algorithms we developed in this paper remove label switching in the MCMC sample, but do not remove the unidentifiability of the BDI models.
The researcher has to be aware of the unidentifiability and use external information (such as fossil evidence or ancient climate data) to choose between such equally supported explanations of the genomic data.
In the above example, the scenario of near-complete replacement represented by Q ′ may be implausible and the model with small introgression probabilities may be preferable for most systems. In our relabeling algorithms, we start with small w X and w Y as much as possible (through the initial condition w X + w Y , 1). When the introgression probabilities are intermediate, the biological interpretations may not be so clear-cut, but unidentifiability exists nevertheless. In the example of supplementary figure  S7 and table S1, Supplementary Material online for the simulated data with one BDI event, the choice between the two unidentifiable towers Q = (w X , w Y ) = (0.7, 0.2) and Q ′ = (0.3, 0.8) may not be easy.
Another strategy may be to modify the BDI model so that it becomes identifiable. In the current implementation in BPP, FIG. 11. (a,b) Two phylogenetic networks for four species (A, B, C, D), each with two hybridization events from Pardi and Scornavacca (2015) that are unidentifiable using gene tree topologies with one sequence sampled per species. (c) Network N 1 gives rise to three 'displayed species trees' in probabilities a, (1 − a)b, and (1 − a)(1 − b), while N 2 gives rise to the same three displayed species trees with probabilities (1 − g)(1 − d), (1 − g)d, and g. The two networks thus give the same distribution of gene tree topologies, and are thus unidentifiable. However, N 1 and N 2 are identifiable when multiple samples are taken from species B. (d,e) MSci models corresponding to networks N 1 and N 2 . With information from branch lengths (coalescent times) and using multilocus sequence data, those models are identifiable by full-likelihood method, as are the 18 parameters in each model, including five species divergence/introgression times (ts), 11 population sizes (us), and two introgression probabilities.
Estimation of Introgression Rates Using Genomic Data · https://doi.org/10.1093/molbev/msac083 MBE each branch in the species tree is assigned its own population size parameter . We note that if all species on the species tree are assumed to have the same population size (u), unidentifiability persists. However, if we assume that the population size remains unchanged by the introgression event: for example, u X = u A and u Y = u B in figure 1, the model becomes identifiable. The assumption of the same population size before and after an introgression event appears to be plausible biologically. It reduces the number of parameters by two for each BDI event, and removes unidentifiability. It may be worthwhile to implement such models.

Introgression in Heliconius Butterflies
We fitted the BDI model to the genomic sequence data for three species of Heliconius butterflies: H. melpomene, H. timareta, and H. numata (Consortium, 2012;Martin et al., 2013). The species tree or MSci model assumed is shown in figure 2, with introgression between H. melpomene and H. timareta. The two species are known to hybridize, although no attempt has yet been made to infer the direction or strength of introgression (except for colour-pattern genes; Martin et al., 2013). There are 31,166 autosomal noncoding loci and 36,138 autosomal exonic loci, with one diploid sequence sampled per species per locus. The sequence length ranges from 11 to 991 bps (median 93) for the noncoding loci and from 11 to 10,672 bps (median 112) for the exonic loci. The data were prepared using the same procedure and filters as in Thawornwattana et al. (2022). We analyzed six datasets under the same model, with the noncoding and exonic loci in separate datasets: the first 500 loci on chromosome 1, all loci on chromosome 1 (2,592 noncoding or 3,023 exonic loci), and all autosomal loci (table 1). Note that a diploid sequence from each species is equivalent to two haploid sequences, so that the population size parameter (u) for that species is estimable. Heterozygotes in the diploid sequence are represented by IUPAC ambiguity codes (e.g., with Y meaning a T/C heterozygote) and resolved into compatible nucleotides in BPP using an analytical integration algorithm (Gronau et al., 2011;Flouri et al., 2018), which averages over all possible genotypic phase resolutions of heterozygote sites, weighting them according to their likelihood based on the sequence alignment at the locus. In simulations, this approach had indistinguishable performance from analysis of fully and correctly phased genomic sequences (Gronau et al., 2011;Huang et al., 2021).
We used gamma priors for the population sizes (u) and for the age of the root (t 0 ): u G(2, 400) with the mean 0.005 substitution per site, and t G(2, 400) with mean 0.005. The introgression probabilities were assigned beta priors w X , w Y B(1, 1), which is the uniform U(0, 1). We used a burn-in of 16,000 iterations, and then took 2 × 10 5 samples, sampling every five iterations. Running time on a server using nine threads of Intel Xeon Gold 6154 CPU (3.0GHz) was about one hour for the small datasets or L = 500 loci, 10 h for the datasets of chromosome 1, and 4 days for the datasets of all autosomal loci.
Convergence of the MCMC algorithms was assessed by checking for consistency between independent runs, taking into account possible label-switching issues.

Simulation under the Double-BDI Model
We simulated and analyzed data under the double-BDI model of figure 6. Gene trees with branch lengths (coalescent times) were simulated under the MSci model and given the gene trees, sequences were evolved along the branches on the gene tree under the JC model (Jukes and Cantor, 1969). The parameters used were w X = 0.1, w Y = 0.2, w Z = 0.2, w W = 0.3, t R = 0.005, t Z = t W = 0.0025, t X = t Y = 0.00125, u R = u Z = u X = u A = 0.005, and u W = u Y = u B = 0.02. Each dataset consisted of L = 500, 2,000, and 8,000 loci, with S = 16 sequences per species per locus, and with the sequence length to be 500 sites. The number of replicate datasets was 10.

Supplementary Material
Supplementary data are available at Molecular Biology and Evolution online.