Estimating effective population size changes from preferentially sampled genetic sequences

Coalescent theory combined with statistical modeling allows us to estimate effective population size fluctuations from molecular sequences of individuals sampled from a population of interest. When sequences are sampled serially through time and the distribution of the sampling times depends on the effective population size, explicit statistical modeling of sampling times improves population size estimation. Previous work assumed that the genealogy relating sampled sequences is known and modeled sampling times as an inhomogeneous Poisson process with log-intensity equal to a linear function of the log-transformed effective population size. We improve this approach in two ways. First, we extend the method to allow for joint Bayesian estimation of the genealogy, effective population size trajectory, and other model parameters. Next, we improve the sampling time model by incorporating additional sources of information in the form of time-varying covariates. We validate our new modeling framework using a simulation study and apply our new methodology to analyses of population dynamics of seasonal influenza and to the recent Ebola virus outbreak in West Africa.


Introduction
Phylodynamic inference-the study and estimation of population dynamics from genetic sequences-relies upon data sampled in a timeframe compatible with the evolutionary dynamics under question [Drummond et al., 2003].One important class of phylodynamic methods seeks to estimate magnitudes and changes in a measure of genetic diversity called the effective population size, often considered proportional to the census population size [Wakeley and Sargsyan, 2009] or number of infections in epidemiological contexts [Frost and Volz, 2010].One subtle and often ignored complication of phylodynamic inference occurs when there is a probabilistic dependence between the effective population trajectory and the temporal frequency of collecting data samples, such as in case of sampling infectious disease agent genetic sequences with increasing urgency and intensity during a rising epidemic.This issue of preferential sampling was studied in depth by Karcher et al. [2016] in the limited context of a known, fixed genealogy reconstructed from the genetic data, revealing that sampling protocols that (implicitly) depend on effective population size cause model misspecification bias in models that do not account for the possibility of preferential sampling.Here, we extend the work of Karcher et al. [2016] and develop a Bayesian framework for accounting for preferential sampling during effective population size estimation directly from sequence data rather than from a fixed genealogy.We also propose a more flexible model for sequence sampling times that allows for inclusion of arbitrary time-dependent covariates and their interactions with the effective population size.
Methods for estimating effective population size from genealogical data and genetic sequence data have evolved from the earliest low dimensional parametric methods, such as constant population size [Griffiths and Tavaré, 1994b] and exponential growth models [Griffiths andTavaré, 1994b, Drummond et al., 2002], to more flexible, nonparametric or highly parametric methods based on change-point models and Gaussian process smoothing [Drummond et al., 2005, Heled and Drummond, 2008, Minin et al., 2008, Palacios and Minin, 2013, 2012, Gill et al., 2013, 2016].Most coalescent-based methods condition on the times of sequence sampling, rather than include these times into the model, leaving open the possibility of model misspecification if preferential sampling over time is in play.Volz and Frost [2014] and Karcher et al. [2016] introduced coalescent models that include sampling times as random variables, whose distribution is allowed to depend on the effective population size.In particular, Karcher et al. [2016] propose a method that models sampling times as an inhomogeneous Poisson process with log-intensity equal to an affine transformation of the log-transformed effective population size.In the presence of preferential sampling, this sampling-aware model demonstrates improved accuracy and precision compared to standard coalescent models due to eliminating an element of model misspecification and incorporating an additional source of information to estimate the effective population trajectory.
The main limitations of the approach of Karcher et al. [2016] are a reliance on a fixed, known genealogy and lack of flexibility in the preferential sampling time model that currently does not allow the relationship between effective population size and sampling intensity to change over time.We address the issue of fixed-tree inference by implementing a preferential sampling time model in the popular phylodynamic Markov chain Monte Carlo (MCMC) software package BEAST [Suchard et al., 2018].This allows us to perform inference directly from genetic sequence data, appropriately accounting for genealogical uncertainty, using a wide selection of molecular sequence evolution models and well tested phylogenetic MCMC transition kernels.Additionally, we implement a tuning parameter free elliptical slice sampling transition kernel [Murray et al., 2010] for high dimensional effective population size trajectory parameters, which allows us to update these parameters efficiently.
We also address the issue of an inflexible preferential sampling time model by incorporating time-varying covariates into the model.We model the sampling times as an inhomogeneous Poisson process with log-intensity equal to a linear combination of the log-effective population size and any number of functions of time.These functions can include time varying covariates and products of covariates and the log-effective population size, referred to as interaction covariates.The addition of covariates into the sampling time model allows for incorporating additional sources of information into the relationship between effective population size and sampling intensity.One example of time-varying covariates includes an exponential growth function to account for a continuous decrease in sequencing costs that results in increased intensity of genetic data collection over time.In the context of endemic infectious disease surveillance, it is likely important to account for seasonality when modeling changes in genetic data sampling intensity, motivating inclusion of periodic functions as time varying covariates in the preferential sampling model.
We validate our methods first by simulating genealogies and sequence data and confirming that our methods successfully reconstruct the true effective population trajectories and true model parameters.We briefly simulate data in a fixed-tree context to demonstrate the fundamentals of incorporating covariates into the sampling time model and what bias is introduced by model misspecifications.We proceed to simulate genetic sequence data and demonstrate that our model successfully functions when we estimate effective population size trajectory and other parameters directly from sequence data.We also use simulations to test a combination of the two extensions of the preferential sampling model and work with covariates while sampling over genealogies during the MCMC.Finally, we use our method to analyze two real-world epidemiological datasets.We analyze a USA/Canada regional influenza dataset [Zinder et al., 2014] to determine if exponential growth of genetic sequencing or seasonal changes in sampling intensity are important to adjust for during effective population size reconstruction.We also analyze data from the recent Ebola outbreak in Western Africa to determine if preferential sampling has taken place and whether timevarying covariates or interaction covariates improve the phylodynamic inference.

Sequence Data and Substitution Model
Consider an alignment y = {y ij }, i = 1, . . ., n, j = 1, . . ., l, of n genetic sequences across l sites, collected from a well-mixed population at sampling times The following example shows an alignment of n = 5 samples across l = 10 sites, sampled at distinct times between time 7 and time 0-with time understood to be time before the latest sample: All of the individual sequences share a common ancestry, which can be represented by a bifurcating tree called a genealogy-illustrated in Figure 1.Sampling times s 1 , . . ., s 5 and coalescent times t 1 , . . ., t 5 are marked below the genealogy, and sequence data y 1 , . . ., y 5 are marked at their corresponding tips.
We assume that sequence data y are generated by a continuous time Markov chain (CTMC) substitution model that models the evolution of the genetic sequence along the genealogy g.According to this model, alignment sites are independent and identically distributed, with a transition matrix θ controlling the CTMC substitution rates between the different nucleotide bases.Some relaxation of these assumptions is possible [Shapiro et al., 2005].Different substitution models are then defined by different parameterizations of θ [Hein et al., 2004].It is simple to simulate from these models, and we can efficiently compute the probability of the observed sequence data y, Pr(y | g, θ), using Felsenstein's pruning algorithm [Felsenstein, 1973[Felsenstein, , 1981]].

The Coalescent
Recall that we assume that the n sampled sequences share a common ancestry, which can be represented by a bifurcating tree called a genealogy-illustrated in Figure 1.The branching events of the tree g = {t i } n−1 i=1 , t 1 > . . .> t n−1 (with t greater the farther back in time an event occurs) are called coalescent events.The times associated with the tips of the tree s = {s i } n i=1 , s 1 ≥ . . .≥ s n are called sampling times or sampling events.If all of the sampling events are simultaneous, the sampling is called isochronous.Assuming that the population evolves according to the Wright-Fisher model of genetic drift and that the size of the population is not changing, Kingman [1982] derived a probability density for an isochronous genealogy, where the population size plays the role of a parameter of this density.Since the Wright-Fisher model is a simplified representation of the evolutionary process, the above parameter is called the effective population size, N e .Later extensions to the coalescent model incorporated variable effective population size N e (t) [Griffiths and Tavaré, 1994b] and the ability to evaluate densities of genealogies with heterochronously sampled tips-genealogies with non-simultaneous sampling times [Felsenstein and Rodrigo, 1999].
Given sampling times s and effective population size trajectory N e (t), we would like to define the probability density for a particular genealogy g.We use the term active lineages, n(t), to refer to the difference between the number of samples taken and the number of coalescent events occurred between times 0 and t.To illustrate, in Figure 1, n(t) can be seen as the number of horizontal lines that a vertical line at time t will cross.Suppose we partition the interval (s n , t 1 ), from the most recent sampling event to the time to most recent common ancestor (TMRCA), into intervals I i,k with constant numbers of active lineages.Let λ c (t) = n(t) 2 /N e (t).Then the coalescent density evaluated at genealogy g is (1)

Population Size Prior
Note that without further assumptions the effective population size trajectory function N e (t) is infinite-dimensional, so inference about N e (t) without some manner of constraint is intractable.A number of approaches, reviewed in the Introduction, have been suggested to address this fact.Here, we take a regular grid approach that was used before in multiple studies [Palacios and Minin, 2012, Gill et al., 2013, 2016, Karcher et al., 2016].To review, we approximate N e (t) with a piecewise constant function, N γ (t) = exp[γ(t)], where γ(t) = p i=1 γ i 1 {t∈J i } and J 1 , . . ., J p are consecutive time intervals of equal length.In contexts where the genealogy is known, we choose intervals that perfectly cover the interval between the TMRCA and the latest sample.However, in contexts where the genealogy is estimated from sequence data, the TMRCA is not necessarily fixed.To address this, we choose equal intervals that extend to a fixed point in time and append an additional interval that extends from that point infinitely back in time.This allows us to estimate the effective population trajectory with user-defined resolution over a window that extends back in time as far as the user chooses.The choice of the end point of the grid is up to the user, but it is advisable to choose a point that is farther back in time than an a priori estimate of the TMRCA in order to extend the high-resolution grid to cover the entire true genealogy.
The population size trajectory N γ (t) is parameterized by a potentially high dimensional vector γ = (γ 1 , . . ., γ p ).We assume that a priori γ follows a first order Gaussian random walk prior with precision hyperparameter κ: γ We use a Gaussian prior on the first element: γ 1 ∼ N (0, σ 2 p ). Finally, we assign a Gamma(α, β) hyperprior to κ.Although it is realistic to assume that the larger the population, the more members of the population gets sequenced, other factors may influence the distribution of sequence sampling times.For instance, decreasing sequencing costs may result in increasing sequence sampling intensity even if the population size remains constant.We propose an extension to the sampling model that allows for the incorporation of time-varying covariates as additional sources of information.Suppose we have one or more real-valued functions, F = {f 2 (t), . . ., f m (t)}.We let log λ s (t;

Preferential Sampling Model with Covariates
where we may set any or all of the β 2 , . . ., β m or δ 2 , . . ., δ m to zero if we want to avoid modeling effects of certain covariates or their interactions with the log-population size.Notice that we reserve f 1 (t) for γ(t) = log[N e (t)], which is the covariate that is always present in our model.We also point out that even though Equation (2) is written in continuous time, in practice we assume that both the sampling intensity λ s (t) and our time varying covariates are piecewise constant, with changes occurring at the grid points specified in Subsection 2.3.We assign independent N (0, σ 2 s ) priors for all components of the preferential sampling model parameter vector β = (β 0 , β 1 , . . ., β m , δ 2 , . . ., δ m ).

Posterior Approximation with MCMC
Having specified all parts of our data generating model, we are now ready to define the posterior distribution of all unknown variables of interest: where all probabilities and probability densities on the righthand side of equation ( 3) are defined in the previous subsections.Figure 2 illustrates conditional dependencies of model parameters and data in a graph form.
Figure 2: Dependency graph for the phylodynamic model parameters and data.
Dependencies labeled 1 are explored in section 2.1, those labeled 2 are explored in section 2.2, those labeled 3 are explored in section 2.3, and those labeled 4 are explored in section 2.4.The dashed lines between γ, β, F and s represent preferential sampling.
When the distribution of sampling times does not depend on the effective population size trajectory (in our model, this happens when β 1 = 0 and δ 2 = • • • = δ m = 0), the posterior takes the following form: The factorization above demonstrates that when γ is absent from the Pr(s | •) term, joint and separate estimations of effective population size parameters γ and preferential sampling model parameters θ will yield identical results.Moreover, in this case estimation of sampling model parameters can be dropped from the analysis entirely, since typically these parameters would be considered nuisance.If we drop preferential sampling, our model specifications reduces to the Bayesian skygrid model of Gill et al. [2013], with the corresponding posterior: We approximate posteriors (3) and ( 4) by devising MCMC algorithms, implemented in the software package BEAST [Suchard et al., 2018], that target these distributions.We update model parameters in blocks -1) genealogy g, 2) substitution parameters θ, 3) population size parameters γ, 4) random walk prior precision κ, 5) preferential sampling model parameters β -keeping parameters outside of the block fixed.We update the genealogy and substitution model parameters via the default BEAST Markov kernels.We update the log effective population latent field γ via an elliptical slice sampler (ESS) operator [Murray et al., 2010, Lan et al., 2015], which takes advantage of the Gaussian prior distribution of the latent field to perform efficient updates.Informally, it does this by sampling a set of parameter values from the prior and iteratively moving the values closer to the current values via elliptical interpolation if the coalescent likelihood falls below a random, but small, neighborhood of the current likelihood.Because the stepwise differences of the log effective population size trajectory, ∆γ, are modeled as independent Gaussians with precision κ, and because we give κ a Gamma(α, β) hyperprior, we update κ using a Normal-Gamma Gibbs update kernel with full conditional where p is the number of parameters in the latent field.For our sampling conditional model with posterior (4), we finish here and refer to the method as ESS/BEAST, abbreviated when appropriate as ESS.For our sampling-aware model with the posterior (3), we update components of the preferential sampling model parameter vector β with univariate Gaussian random walk Metropolis-Hastings kernels.We refer to the method as SampESS/BEAST, abbreviated when appropriate as SampESS.

Inference Assuming Fixed Genealogy
In Section 2.4, we proposed an extended sampling time model that incorporated time-varying covariates.We perform a simulation study to confirm the ability of our method to recover the true effective population trajectory and model coefficients with covariates affecting the sampling intensity.We begin here with fixed genealogies and move on to direct inference from sequence data in the next section.
We start with the inhomogeneous Poisson process sampling model with log-intensity as in Equation 2. If we restrict all βs and δs to be zero aside from β 0 , the model collapses to homogenous Poisson process sampling (equivalently, uniformly sampling a Poisson number of points across the sampling interval).If we allow β 1 to be nonzero, the model becomes the sampling-aware model of Karcher et al. [2016].If we allow additional βs, each corresponding to a fixed function of time, to be nonzero (but not δs) we say that the model includes simple or ordinary covariates.
For computational efficiency in this simulation study, we build upon the methods of Karcher et al. [2016], including Bayesian Nonparametric Population Reconstruction (BNPR) which uses integrated nested Laplace approximation (INLA) to efficiently approximate the marginal posterior for fixed-genealogy data, and Bayesian Nonparametric Population Reconstruction with Preferential Sampling (BNPR-PS) which does the same but includes our sampling time model (without covariates).We incorporate our extended sampling time model into BNPR-PS, but due to constraints in the INLA R package, upon which BNPR-PS relies, we can only include simple covariates.
Because our sampling time model is an inhomogeneous Poisson process, it is straightforward to simulate sampling times.We use a time-transformation method [C ¸inlar, 1975, pages 98-99], which, informally, treats the waiting times between events as transformations of exponential waiting times based on the intensity function following the previous event.
Because the coalescent likelihood is sufficiently similar to an inhomogeneous Poisson process, we can use a similar time-transformation technique to generate the coalescent events of simulated genealogies [Slatkin and Hudson, 1991].We implement these methods for simulating sampling times and coalescent times in R package phylodyn [Karcher et al., 2017].
In Figure 3, we illustrate BNPR, BNPR-PS, and BNPR-PS with simple covariates applied to a single simulated genealogy with sampling events distributed according to log-intensity (5) We see that BNPR (the sampling conditional model) suffers from the kind of model misspecification induced bias illustrated in [Karcher et al., 2016].BNPR-PS with no additional covariates beyond γ(t) = log[N e (t)], in contrast, suffers even more strongly from a misspecified sampling model.Table 1 shows that the model fails to correctly infer the coefficient of γ(t).This illustrates the care one must take in choosing parameterizations of the sampling model.BNPR-PS with simple covariates, γ(t) and −t, the correctly-specified model, produces a reconstruction of the effective population trajectory that is very close to the true trajectory used to simulate the data.Table 1 shows that the true values of the sampling model coefficients are within 95% Bayesian credible intervals produced by our inference method with the correctly specified model.

Direct Inference from Sequence Data
We simulate several genealogies and DNA sequences from different sampling scenarios in order to evaluate how well our population reconstruction and parameter inference performs.Given a sampling model and, optionally, an effective population size trajectory, we generate sampling times within a sampling window.We generate sampling and coalescent times for a genealogy using the same time-transformation methods as for our fixed-tree simulations.We simulate the topology of the genealogy by proceeding backward in time, adding an active lineage at each sampling time and joining a pair of active lineages uniformly at random at each coalescent event.We provide an implementation of this tree-topology simulation method in phylodyn.We generate simulated sequence alignments using the software Seq-Gen [Rambaut and Grassly, 1997], using the Jukes-Cantor 1969 (JC69) [Jukes et al., 1969] substitution model.We set the substitution rate to produce an expected 0.9 mutations per site, in order to produce a sequence alignment with many sites having one mutation, and some sites having zero or multiple mutations.For all of our simulations, we use the same seasonal effective population trajectory, N e,2,6 (t), as for our fixed-tree simulations.
First, we simulate a genealogy with 200 tips and sequence data with 1500 sites and  uniform sampling times and apply both of our sampling-conditional methods.We apply the INLA-based fixed-tree BNPR from [Karcher et al., 2016] to the true genealogy, and we apply the MCMC-based tree-sampling ESS/BEAST (specified above) to the sequence data.In Figure 4 (upper left), we compare the truth with the resulting pointwise posterior medians and credible intervals.The two methods' results are mutually consistent, with additional uncertainty in the tree-sampling method (visible in the wider credible intervals) due to having to estimate the genealogy jointly with other model parameters.We see similar results comparing BNPR-PS with SampESS/BEAST in Figure 4 (upper right), where we sample sequences (1500 sites) with sampling times generated from an inhomogeneous Poisson process with intensity proportional to effective population size (log-intensity 2.9 + γ(t)) resulting in 170 samples and infer using a sampling model with log-intensity β 0 + β 1 γ(t).We also see similar results in Figure 4 (lower left), where we add time as an additional covariate and sample sequences (1500 sites) with log-intensity 3.35 + γ(t) − 0.5t, resulting in 199 samples, and perform inference using a sampling model with log-intensity β 0 +β 1 γ(t)+β 2 •(−t).Table 2 shows that SampESS does a reasonable job at reconstructing the true model coefficients, though the credible interval for −t includes 0.
We also simulate a genealogy and sequence data (1500 sites) with log-intensity 1.89 + γ(t) + γ(t) • 1 t∈[0.5,1], resulting in 210 samples.This produces an interval we refer to as a sampling spike which requires the use of an interaction covariate.Because of design limitations of the R implementation of INLA, we are limited in how we may implement interaction covariates in BNPR-PS.Therefore, in Figure 4 (lower right) we plot SampESS/BEAST with the correct interaction covariate (and a corresponding ordinary covariate) against BNPR-PS with no covariates.We see SampESS (with covariates) perform better than BNPR-PS (without covariates) at reconstructing the correct trajectory.We also see that our method, using the full covariate model, with log-intensity , produces a 95% Bayesian credible interval for the coefficient of the ordinary covariate that contains the true value (β 2 = 0), while the true value of the interaction covariate coefficient (δ 2 = 1) is correctly inside the 95% Bayesian credible interval produced by SampESS/BEAST.

Seasonal Influenza Example
We reanalyze the H3N2 regional influenza data for the USA/Canada region as analyzed with fixed-tree methods in [Karcher et al., 2016].The data contain 520 sequences aligned to form a multiple sequence alignment with 1698 sites of the hemagglutinin gene.This dataset is a subset of the dataset of influenza sequences from around the world analyzed in [Zinder et al., 2014].We use ESS/BEAST with our tree-sampling MCMC targeting posterior ( 4) to analyze these data and mark the pointwise posterior median and 95% credible region in black, summarized in Figure 5 (upper row).We observe a seasonal pattern consistent with flu seasons observed in the temperate northern hemisphere [Zinder et al., 2014].Our results are also consistent with previous fixed-tree method results but with larger credible interval widths due to correctly accounting for genealogical uncertainty in our analysis.We apply our sampling-aware model SampESS/BEAST to the USA/Canada influenza data, following the posterior from Equation (3).We used several different log-samplingintensity models.The simplest one has log-intensity β 0 + β 1 γ(t) (abbreviated {γ(t)}) and is summarized in Figure 5 (upper left).We include a time term in one model, with log-intensity 5 (upper center).We use seasonal indicator functions in the final model, defined as, with t measured in decimal calendar years (going forward in time).This results in the log-intensity β 0 + β 1 γ(t) + β 2 I winter (t) + β 3 I autumn (t) + β 4 I summer (t) (abbreviated {γ(t), I winter , I autumn , I summer }), summarized in Figure 5 (upper right).
We summarize the sampling model coefficient results for each model in Table 3.The {γ(t)} model corresponds to the preferential sampling model of Karcher et al. [2016], but has noticeably different estimates.We attribute this to the differences between the fixed-tree (with a tree inferred using a constant effective population size BEAST model), INLA-based approach of Karcher et al. [2016], and the tree-sampling MCMC-based approach of this paper.We also note that the {γ(t), −t} model does not perform better (or even noticeably differently) than the {γ(t)} model.The coefficient summary for {γ(t), −t} bears this out, because the 95% Bayesian credible interval for the coefficient for −t contains 0. This is expected as each year has approximately the same number of sequences, so there should be no exponential growth of sampling intensity.We do observe differences in the {γ(t), I winter , I autumn , I summer } model.The coefficient of γ(t) is close to 1.0, which is the easiest value to interpret under preferential sampling, suggesting a baseline sampling rate proportional to effective population size.The coefficients for the indicators suggest increased sampling in the flu season intervals, as compared to the summer intervals and especially the spring intervalswith spring treated as a baseline rate without an indicator for the sake of identifiability.We also fit a model with seasonal indicator covariates and their interactions with the log-effective population size, but do not find any support for including the interaction covariates into the We observe the seasonality of our estimates of the effective population size trajectory.In Figure 6, we superimpose the twelve years of estimates per model, and plot the posterior median annual estimate.We note that the sampling aware models all show increased seasonality compared to the sampling conditional model.We also note that the 2008-2009 flu season stands out on the seasonality plot for having a peak in the summer months of 2009, particularly in the preferential sampling models.This behavior is most likely due to a misspecification of our model for sampling intensity.This misspecification is expected given the first documented emergence of the H1N1 strain in the United States in April of 2009 and the resulting, unaccounted in our model, increased surveillance of all influenza strains in summer 2009 [CDC, 2010].Higher than usual sampling intensity in summer 2009 makes our preferential sampling models conclude that the effective population size during this time period must be also elevated.Also, note that the estimated effective population size of H3N2 strain during 2009/2010 flu season is markedly lower than during most of other seasons.This is in line with the H1N1 strain successfully competing with the H3N2 strain, resulting in the lower prevalence of the latter.
To check adequacy of the preferential sampling models, we compare the posterior distributions of sampling intensities obtained via our BEAST implementation of BNPR-PS with a nonparametric INLA-based estimate of the sampling rate (using a method similar to BNPR-PS without the coalescent likelihood or covariates).Figure 5 (lower row) shows the comparison.The methods produce very similar estimates, with the BEAST/MCMC methods having thinner credible intervals due to incorporating additional information from the coalescent likelihood.We also performed posterior predictive checking, described in Appendix B.1, but found that this method lacked power to discriminate among preferential sampling models (see Appendix B.2.2).

Ebola Outbreak
Next, we analyze a subset of the Ebola virus sequences arising from the recent Western Africa Ebola outbreak (as collated in [Dudas et al., 2017]).The data consist of 1610 aligned whole genomes, collected from mid-2014 to mid-2015.The resulting alignment has 18,992 sites.The dataset represents over 5% of known cases of Ebola detected during that outbreak, providing an unprecedented insight into the epidemiological dynamics of an Ebola outbreak.
We consider two subsets of the data, corresponding to the samples from Sierra Leone and Liberia.For Sierra Leone, we subsampled 200 sequences, chosen uniformly at random out of 1010 samples for computational tractability.For Liberia, we use the entire collection of 205 sequences obtained from infected individuals in this country.We begin by applying ESS/BEAST method with no preferential sampling to the Sierra Leone dataset.We use MCMC to target our tree-sampling posterior from Equation ( 4) and depict the pointwise posterior median effective population curve, N e (t), with a black dashed line and its corresponding 95% credible region boundaries with black doted lines, shown in all panels of the first row of Figure 7.The resulting effective population size trajectory visually resembles a typical epidemic trajectory of prevalence or incidence that peaks in Autumn of 2014.Next, we apply our sampling-aware model SampESS/BEAST to the Ebola data, targeting with MCMC the posterior from Equation (3).We use several different log-samplingintensity models.The simplest model, abbreviated as {γ(t)}, has log-sampling-intensity β 0 + β 1 γ(t).We include a t term in our next sampling model, abbreviated as {γ(t), −t}, with log-intensity β 0 + β 1 γ(t) + β 2 • (−t).This model postulates that even if the effective population size remains constant, the sampling intensity is growing or declining exponentially.We make −t an interaction covariate as well in the next model, abbreviated {γ(t), −t, −t • γ(t)}, resulting in the log-sampling-intensity β 0 + β 1 γ(t) + β 2 • (−t) + δ 2 γ(t) • (−t).For the final model, we include −t and −t 2 as ordinary covariates, abbreviated {γ(t), −t, −t 2 }, with logsampling-intensity β 0 + β 1 γ(t) + β 2 • (−t) + β 3 • (−t 2 ).The resulting posterior distribution summaries of the effective population size trajectory are shown in blue in the upper row of Figure 7.
Having concluded that posterior predictive checks are underpowered in our setting (see Appendix B.2.3), we judge preferential sampling model fit using lessons learned during simulation studies conducted by Karcher et al. [2016].One important observation made by Karcher et al. [2016] is that ignoring preferential sampling produces little bias when estimating N e (t) when population size is increasing.Even during the N e (t) declines the bias is relatively small.Therefore, if the sampling model is not misspecified, we expect conditional and sampling aware models to differ mostly in the width of their credible intervals, and not in posterior medians of N e (t).According to this metric, the {γ(t), −t, −t • γ(t)} and {γ(t), −t, −t 2 } models show reasonable agreement with the conditional conditional model when reconstructing N e (t) (see first row of Figure 7), with the {γ(t), −t, −t•γ(t)} model performing the best.Another measure of goodness of fit is agreement of nonparametric estimate of sampling intensity and the one produced by preferential sampling models.By this metric, the quadratic model {γ(t), −t, −t 2 } outperforms the interaction model {γ(t), −t, −t • γ(t)}.The main difference between the interaction and quadratic models is that the interaction model suggests that the strength of preferential sampling (power of N e (t)) was linearly increasing over time, while the quadratic model points to a quadratically time varying multiplicative factor in front of N e (t).Parameter estimates of all models fit to the Sierra Leone data are summarized in Table 4.
As another way to compare adequacy of preferential sampling models, we overlay our reconstructed effective population size trajectories and Ebola weekly incidence time series.We use a sum of confirmed and probable case counts from the supplementary data of Dudas et al. [2017].Assuming a susceptible-infectious-removed (SIR) model, an approximate structured coalescent model, and taking into account the fact that the number of susceptible individuals never decreased appreciably during the Ebola outbreak, we can interpret effective population size as a quantity proportional to Ebola incidence [Volz et al., 2009, Frost andVolz, 2010].Figure C-1 shows aligned incidence time series and posterior summaries of effective population size for all considered coalescent models.All models produce reasonable agreement between incidence and effective population size during the increase of incidence.However, the end of the outbreak is captured better by preferential sampling models, with the quadratic model {γ(t), −t, −t 2 } outperforming the other preferential sampling models.We apply the same models to the Liberia Ebola dataset, summarized across the upper row of Figure 8 and in Table 5.We note that the {γ(t)} and {γ(t), −t} models perform very similarly, but the {γ(t), −t} model has slightly wider pointwise credible intervals in places.This is consistent with the coefficients, as the credible interval for the −t term contains 0. The {γ(t), −t, −t • γ(t)} model has even wider pointwise credible intervals, and the credible intervals for the coefficients all contain 0. This suggests that in Liberia, of the three sampling-aware models, the sampling model most consistent with the data is simple preferential sampling.We also note that in the {γ(t)} model, the median estimate for the coefficient for γ(t) is close to 1.0, suggesting direct proportional sampling.As in the previous section, we compare the sampling rates we derive from our BEAST runs to a nonparametric INLA-based estimate of the sampling rate.Figures 7 (lower row) and 8 (lower row) show the comparisons.The two methods produce very similar estimates, and again the sampling-aware methods have thinner credible intervals due to incorporating additional information from the coalescent likelihood.

Model
All coalescent models produce reasonable agreement between estimated effective population size trajectories and Ebola incidence time series in Libera (see Appendix Fig C -2).The model without preferential sampling looks the best in this comparison, mostly because the incidence curve does not support multiple "ups" and "downs" in effective population size trajectories estimated under the preferential sampling models.

Discussion
Currently, few phylodynamic methods incorporate sampling time models in order to address model misspecification and take advantage of the additional information contained in sampling times in preferential sampling contexts.Even fewer methods implement sampling time models by appropriately integrating over genealogies relating the sampled genetic sequences and performing inference directly from these sequence data.We extend previous sampling time models to incorporate time-varying covariates in order to allow the sampling model to be more flexible under different scientific circumstances.We implement this sampling time model into the MCMC software BEAST, and also implement an elliptical slice sampler into BEAST for efficient MCMC draws of grid-based effective population size parameterizations.
However, the additional flexibility of the sampling time model comes with additional uncertainty around which set of covariates is the best one for a given scientific context.Unfortunately, posterior predictive checks [Gelman et al., 1996] -taking a model with a posterior sample of parameters estimated from data, using the same model and estimated parameters to simulate new data, and comparing the observed data and the simulated data -lacked sufficient power to discriminate between models in all of our applications.Including a residual term to absorb sampling times model misspecification can be a fruitful avenue of future research.However, care will need to be taken to preserve parameter identifiability.
Another approach to extending and increasing the flexibility of the sampling model is to decouple the fixed temporal relationship between effective population size and sampling intensity.Introducing an estimated lag parameter to the sampling time model would allow for cause-and-effect phenomena and delays to be accounted for within the model.Incorporating an estimated lag parameter would also allow for an additional avenue of model verification.Under most imaginable circumstances, if there is a relationship between the effective population size and sampling frequency, changes to the population size would effect sampling frequency with zero or positive delay.Estimating a credibly negative lag would be a possible indicator that some element of the model or data is worth re-examining.
In terms of flexibility, the ideal sampling time model would be a separate Gaussian latent field distinct from the (log) effective population size.However, methods for primarily phylodynamic inference with this feature would suffer from severe identifiability problems.One approach that would retain most of the flexibility of the separate Gaussian field while also retaining the identifiability of the original model would be to model the (log) effective population size and sampling intensities as correlated Gaussian processes.Estimating the correlation parameter between the two processes would allow for estimation of the preferential sampling strength.

A.1 Seasonal Influenza
We consider one additional model for the USA/Canada influenza data with log-intensity,

A.2 Ebola Outbreak
We consider three additional models for our subsample of 200 sequences from the Sierra Leone Ebola outbreak data with log-intensities, ), and abbreviated as {γ(t), −t, −t 2 , −t•γ(t), −t 2 •γ(t)}, and {γ(t), −t•γ(t), −t 2 •γ(t)}, respectively.The results are summarized in Figure A-2 and Table A-2.We see that the coefficients for γ(t), −t, and −t 2 tend to have credible intervals that do not contain zero (except for the interaction-only model {γ(t), −t • γ(t), −t 2 • γ(t)}), but the other terms do not, suggesting that the additional terms are not necessary.Suppose random variable X ∼ Exp(1), and thus its PDF is f X (x) = exp(−x).Define

Model
We then have two useful results.If we wish to sample U , we may do so by sampling an Exp(1) random variable X, then apply the transformations U = g −1 λ (X), which will result in the desired distribution.There generally is not an explicit, closed-form solution for g −1 (•), but it can be implicitly solved using root-finding methods and, if necessary, numerical integration.Conversely, if we wish to recover the original Exp(1) random variable X from U , we can apply the transformations X = g λ (U ).

B.1.2 Heterochronous Coalescent Time Transformation
Consider the heterochronous coalescent model, as presented in Section 2 of the main text.Griffiths and Tavaré [1994a] show that for isochronous data, the sequence of coalescent events of a genealogy (and allowing variable effective population size) is a continuous time Markov chain and that the function A n (t), representing the number of distinct ancestors at time t and called the ancestral process, is a pure death process starting at value n at time 0 and decreasing by one at every coalescent event proceeding into the past.
We seek to extend this framework to allow heterochronous genealogies as well.Consider a Wright-Fisher population with population N (i), i generations in the past.We assume that sampled individuals cannot be ancestors to future sampled individuals, so if we sample an individual at generation i, we segregate that individual from the other N (i) individuals in the population until the sampled individual "selects" an ancestor in generation i + 1, at which point the usual Wright-Fisher process proceeds until another individual is sampled farther in the past.Suppose we have a fixed schedule of n individuals sampled at generations g 1 ≤ g 2 ≤ . . .≤ g n , and we consider any particular generation i, having counted k coalescent events between generation 0 and generation i.
represent the number of individuals that are sampled farther into the past than generation i.In an isochronous scenario, b i would be 0 for all i, and the number of distinct lineages at generation i would be n − k.However, here we suppose that b i > 0. We see that if there are no individuals sampled at generations i or i + 1, then this iteration of the Wright-Fisher process is identical to an iteration of an isochronous Wright-Fisher process with the same population and n − k − b i distinct lineages.If there is an individual sampled at generation i + 1, the outcome is the same since we can safely ignore the (segregated) sampled individual until iterating from generation i + 1 to i + 2. If there is an individual sampled at generation i, then we consider the (segregated) sampled individual to be an additional distinct lineage, but we see the B-1 iteration still behaves as if it were an iteration of an isochronous Wright-Fisher process with n − k − b i distinct lineages.
We now switch to continuous time, applying our heterochronous distinct lineage counts into the results from [Griffiths and Tavaré, 1994a].Let b(t) = n i=1 1 [s i >t] be the count of samples that occur farther into the past than time t.Let B n (t) = n − k(t), where k(t) is the number of coalescent events between time 0 and time t.Under isochronous sampling, B n (t) = A n (t) is the ancestral process.Under heterochronous sampling, B n (t) is merely the pure death process that is directly analogous to A n (t).Substituting our results from the heterochronous Wright-Fisher process into the key results reveals the transition rates for B n (t), and the joint density for the Markov chain of coalescent events, Ne(t) .Following the results from [Griffiths and Tavaré, 1994a], we note that the terms in the product are in the form of transformed exponentials, and can be sampled by transforming n − 1 independent, identically distributed (i.i.d.) Exp(1) random variables.Finally, we note that we can recover these exact n − 1 i.i.d.Exp(1) random variables by applying the inverse transformation.

B.1.3 Coalescent Posterior Predictive Check
We consider the Bayesian approach for phylodynamic analysis laid out in Section 2 of the main text.Similar to Gelman et al. [1996]'s mixed predictive distribution approach, we simulate data and certain latent variables from our models, informed by our posterior sample, in order to judge how well those models adhere to observed and inferred realities.In the context of our posterior with no sampling time model, we replicate {y With posterior-sampled replicates available, we construct a discrepancy D c [Gelman et al., 1996, Sinharay andStern, 2003] on the observables and the inferred latent variables.Let G(g, γ) be the transformation (explored in the previous section) that, given the correct effective population trajectory, and valid assumptions for the coalescent model, will produce a sample of n − 1 i.i.d.Exp(1)-distributed random variables.Let K be the Kolmogorov-Smirnov statistic [Massey Jr, 1951], where F e (x) is the empirical cumulative distribution function (ECDF) of e, and F Exp(1) (x) is the true cumulative distribution function (CDF) of the Exp(1) distribution.We define Then when we run MCMC, we then compare the observed discrepancies, to the replicate discrepancies, Note that the D c we constructed does not depend on y rep , so we can save computation time by not simulating y rep | g rep .If we wish to check the sampling-aware posterior with the sampling time model, the replicate posterior remains mostly the same as in Equation 6, but the final term becomes Pr(γ, κ, β, θ | y, s, F) to match the sampling-aware posterior.
One method we have to compare the observed and replicate discrepancies is the posterior predictive p-value [Gelman et al., 1996].We calculate the posterior predictive p-value by finding the proportion of MCMC iterations where the replicated discrepancy values are larger than its corresponding observed discrepancy value.The smaller the posterior predictive pvalue, the more unusual the observed data is in the context of the chosen model.Note that this posterior predictive p-value does not have the usual frequentist p-value properties such as uniformity under a null model.However, values close to 50% suggest that the current model is adequate, and for discrepancies that become larger as the observed data becomes less likely given a set of parameters, the posterior predictive p-value tends to be smaller, to some degree, under under inadequate models [Gelman et al., 1996].

B.1.4 Sampling Posterior Predictive Checks
Similarly to the previous section, we replicate Suppose we divide the sampling interval into a grid K 1 , . . ., K l , potentially the same grid as used by grid-based priors for the effective population trajectory.The sampling model is inhomogeneous Poisson, so we can bin the numbers of sampling times within each interval m 1 , . . ., m l , each with expected values E i = K i λ s (t)dt.A common approach to problems with independent Poisson bins is a Chi-squared test with statistic χ 2 s = l i=1 son, 1900].We can then define a discrepancy for m i and E i derived from s as above.

B.2.1 Simulation Study
Genealogy Inference We perform a simulation study in order to explore the capabilities of the posterior predictive checks proposed above in Sections B.1.3 and B.1.4.We begin with a simplified version of the phylodynamic data-to-inference methodology.Here we take genealogies to be our observed data (and move on to inference based on observed sequence data in the next section).We simulate sampling times according to inhomogeneous Poisson processes with different intensity trajectories via a time-transformation method [C ¸inlar, 1975] as we implemented in our R package phylodyn [Karcher et al., 2017].Give sampling time data, we simulate from the coalescent model using a similar time-tranformation method for the coalescent [Slatkin and Hudson, 1991], again as implemented in phylodyn.For all of our fixed-tree simulations, we use an effective population size trajectory designed to mimic the seasonal effective population size changes of a seasonal disease such as influenza in North America [Zinder et al., 2014], defined as follows: Specifically, we use N e,10,100,12,0 (t) which is most comparable to an influenza effective population size trajectory as measured in units of weeks, with t = 0 representing the summer effective population size minimum.We compare the results of our posterior predictive checks across different sampling scenario and choice-of-posterior combinations.
In our first scenario, we simulate 500 sampling times, distributed according to a uniform distribution between t = 0 and t = 24 (weeks), and simulate a genealogy with effective population size N e,10,100,12,0 (t).We infer the underlying effective population size trajectory B-4  with a sampling-conditional posterior using a Markov chain Monte Carlo (MCMC) method with an elliptical slice sampling transition kernel (ESS) [Murray et al., 2010] as implemented in phylodyn (illustrated in the first row, first column of Figure B-1) We use the MCMC output to generate replicate coalescent data as laid out in Section B.1.3 and calculate our coalescent discrepancy D c for the observed MCMC results as well as for the replicated results.We plot the discrepancy comparison in the second row, first column of Figure B-1, and note that the posterior predictive p-value is 0.58, which is close to 0.5, correctly suggesting that the model is adequate.We proceed with several additional scenarios.We simulate 514 sampling times between t = 0 and t = 24 (weeks), distributed proportionally to the effective population size, with sampling log-intensity log[λ c (t)] = −0.97+ N e,10,100,12,0 (t).We infer the underlying effective population size trajectory with a sampling-aware posterior (illustrated in the second column of Figure B-1), with sampling time model log[λ s (t)] = β 0 + β 1 • γ(t).We calculate the posterior predictive p-value as 0.59, again correctly suggesting adequacy.We also simulate 509 sampling times between t = 0 and t = 48 (weeks), distributed proportionally to a piecewise constant function P (t) (illustrated in the second column of Figure B-2) unrelated to the effective population size, with log-sampling intensity log[λ c (t)] = −1.67 + P (t).We infer the underlying effective population size trajectory using two different methods.We use the sampling-conditional method (illustrated in the third column of Figure B-1) and the sampling-aware method (illustrated in the fourth column of Figure B-1) with sampling log-intensity log[λ s (t)] = β 0 +β 1 •γ(t).The sampling-conditional posterior predictive p-value becomes 0.46, suggesting that this method (which only considers the coalescent model) does produce an adequate estimate of the effective population size trajectory.The sampling-aware posterior predictive p-value becomes zero, suggesting that this method produced a very poor estimate of the effective population size trajectory (very visible in Figure B-1).This is likely due to the sampling time model mistaking fluctuations in sampling intensity for information about the effective population size trajectory, illustrating the importance of model checking when the true sampling model is uncertain.
For our sampling-aware scenarios, we apply our sampling time posterior predictive check as well.Our chi-squared sampling discrepancy D χ 2 generates a posterior predictive p-value of 0.72, correctly suggesting a good fit.The unrelated sampling scenario also produces a sampling posterior predictive p-value.We see a relatively low posterior predictive p-value of 0.15, reacting to differences between the true and inferred sampling intensity trajectories.
Sequence Data Inference Now, we expand the scope of our simulation study to be based on simulated sequence alignment data instead of a known genealogy.In this section, all of our examples will be based on an effective population size trajectory of N e,1,10,1,0.5 (t), mimicking the trajectory of a seasonal disease as measured in units of years.Similar to the previous section, we generate sampling times and genealogies according to different sampling scenarios and the coalescent, respectively.Given a genealogy, we simulate sequence data using the software SeqGen [Rambaut and Grassly, 1997] using the Jukes-Cantor 1969[Jukes et al., 1969] substitution model to generate 1500 sites.We set the substitution rate to produce an expected 0.9 mutations per site, in order to produce a sequence alignment with many sites having one mutation and some sites having zero or multiple mutations.
For our first simulation, we distribute 200 sampling times uniformly between t = 0 and t = 2 (years).We infer the underlying genealogy and effective population size trajectory using the software BEAST [Suchard et al., 2018] with an elliptical slice sampling transition kernel (ESS) [Murray et al., 2010] as implemented in Section 2, with a sampling-conditional posterior.Finally, we generate replicate genealogies as in the previous section, and we calculate our coalescent discrepancy D c for the observed BEAST results as well as the replicates.In Figure B-3 (first column), we see that the effective population estimate is close to the true trajectory, and when we compare the observed and replicate discrepancies, we calculate a posterior predictive p-value of 0.51, corroborating the model's adequacy.Next, we distribute 170 sampling times between t = 0 and t = 2 (years) with sampling log-intensity log[λ c (t)] = 2.90 + N e,1,10,1,0.5 (t).We infer the underlying genealogy and effective population size trajectory using the sampling-conditional model and calculate discrepancies as above.Note this is a model misspecification applying a sampling-conditional model to a preferential sampling sampling scenario in the style of [Karcher et al., 2016].Unfortunately, the posterior predictive p-value (0.50) does not detect this mismatch, as the bias effective population size estimate is hard to visually detect in Figure B-3.
In our third scenario, we distribute 199 sampling times between t = 0 and t = 2 (years) with increasing sampling log-intensity log[λ c (t)] = 3.35 − 0.5t + N e,1,10,1,0.5 (t).We infer as above, but targeting the sampling-aware posterior with sampling log-intensity log[λ s (t)] = β 0 + β 1 • γ(t).This is again a misspecification, as the model cannot recover the −0.5t term.However, the posterior predictive check does not clearly detect the mismatch, with a posterior predictive p-value of 0.47.Our sampling posterior predictive check does not detect the misspecification either, with a posterior predictive p-value of 0.56.In our final scenario, we distribute 222 sampling times between t = 0 and t = 2 (years) with a sampling logintensity log[λ c (t)] = 2.84 + P (t) (P (t) illustrated in Figure B-4, second column) unrelated to the effective population size.We target the sampling-aware posterior, with sampling logintensity log[λ s (t)] = β 0 + β 1 • γ(t).The model reconstructs the effective population size trajectory poorly, and this is successfully reflected in the posterior predictive p-value of 0.17.However, our sampling posterior predictive check does not detect the misspecification, with a posterior predictive p-value of 0.46.

B.2.2 Seasonal Influenza
We apply our posterior predictive check methods to the North American subset of global H3N2 influenza [Zinder et al., 2014].The data contains 520 sequences aligned to form a multiple sequence alignment with 1698 sites of the hemagglutinin gene.We use the same sequence data BEAST framework as the previous section, choosing four different specific sampling time models.We use a sampling-conditional model with no sampling time model, a simple log-linear sampling time model, and sampling models with different sets of covariates, including I w (t) = I (t mod 1)∈[0,0.25)as an indicator function for winter, I a (t) = I (t mod 1)∈[0.25,0.5)as an indicator function for autumn, and I s (t) = I (t mod 1)∈[0.5,075)as an indicator function B-10

Figure 3 :
Figure 3: Effective population size reconstruction for BNPR, BNPR-PS, and BNPR-PS with simple covariates.The dotted black line represents the true effective population trajectory.The solid colored line represents the marginal posterior median effective population trajectory inferred by BNPR (yellow), BNPR-PS (blue), and BNPR-PS with simple covariates (purple), and the gray region represents the corresponding pointwise 95% credible intervals for the effective population trajectory.The log sampling intensity was 1.557 + γ(t) − 0.025t.

Figure 4 :
Figure 4: Effective population size reconstructions for four sequence data simulations, all based on the same seasonal effective population size trajectory.Upper left: Uniform sampling times, sampling-conditional posterior.Upper right: Sampling frequency proportional to effective population size, sampling-aware posterior.Lower left: Sampling frequency proportional to effective population times a time-covariate (exp(t)), sampling-and covariate-aware posterior.Lower right: Sampling frequency proportional to effective population size with a sampling spike, sampling-and covariate-aware posterior.

Figure 5 :
Figure 5: Effective population size and sampling rate reconstructions for the USA and Canada influenza dataset.Upper row : Dashed lines and dotted black lines are the pointwise posterior effective population size estimates and credible intervals of the samplingconditional model.The blue lines and the light blue regions are the pointwise posterior effective population size estimates and credible intervals of that column's sampling-aware model.Lower row : Dashed lines and dotted black lines are the pointwise posterior sampling rate estimates and credible intervals of a nonparametric sampling-time-only model.The blue lines and the light blue regions are the pointwise posterior sampling rate estimates and credible intervals of that column's sampling-aware model.

Figure 6 :
Figure 6: Effective population size seasonal overlay for the USA and Canada influenza dataset.The light blue lines are the pointwise posterior estimates for each year, and the dark blue line is the median annual estimate.Upper left: Sampling-conditional posterior.Upper right: Sampling-aware posterior with only log-effective population size γ(t) informing the sampling time model.Lower left: Sampling-and covariate-aware posterior, with γ(t) and −t.Lower right: Sampling-and covariate-aware posterior, with γ(t) and seasonal indicators I winter , I autumn , I summer .

Figure A- 1 :
Figure A-1: Effective population size and sampling rate reconstructions for the USA and Canada influenza dataset.Upper row : Dashed lines and dotted black lines are the pointwise posterior effective population size estimates and credible intervals of the sampling-conditional model.The blue line and the light blue region are the pointwise posterior effective population size estimates and credible intervals of that column's sampling-aware model.Lower row : Dashed lines and dotted black lines are the pointwise posterior sampling rate estimates and credible intervals of a nonparametric sampling-time-only model.The blue line and the light blue region are the pointwise posterior sampling rate estimates and credible intervals of that column's sampling-aware model.
Figure B-2: Sampling intensity inference and sampling time posterior predictive check for fixed-tree simulations.The dashed black line represents the true sampling intensity.The solid blue line represents the posterior median sampling intensity inferred by fixed-tree MCMC, and the light blue region represents the corresponding pointwise 95% credible intervals for the sampling intensity.
Karcher et al. [2016]model times at which sequences are collected as a Poisson point process with intensity λ s (t) equal to a log-linear function of the log effective population size.

Table 5 :
Effective population size and sampling rate reconstructions for the Liberia Ebola dataset.Upper row : Dashed lines and dotted black lines are the pointwise posterior effective population size estimates and credible intervals of the sampling-conditional model.The blue lines and the light blue regions are the pointwise posterior effective population size estimates and credible intervals of that column's sampling-aware model.Lower row : Dashed lines and dotted black lines are the pointwise posterior sampling rate estimates and credible intervals of a nonparametric sampling-time-only model.The blue lines and the light blue regions are the pointwise posterior sampling rate estimates and credible intervals of that column's sampling-aware model.Summary of Liberia Ebola sequence data inference.Posterior distribution quantile summaries for SampESS with no covariates (model: {γ(t)}), SampESS with an ordinary covariate (model: {γ(t), −t}), and SampESS with both an ordinary and interaction covariate (model: {γ(t), −t, −t • γ(t)}).
, abbreviated {γ(t), I winter , I autumn , I summer , I winter • γ(t), I autumn • γ(t), I summer • γ(t)}, or more succinctly as {γ(t), I winter , I autumn , I summer , interactions}.The results are summarized in FigureA-1 and Table A-1.We see that only the coefficients for γ(t), I winter , and I autumn have credible intervals that do not contain zero, suggesting that additional terms are not necessary.

Table A -
1: Summary of USA/Canada influenza data inference.Posterior distribution quantile summaries for SampESS with seasonal indicator and interaction covariates (model: {γ(t), I winter , I autumn , I summer ,interactions}).
Effective population size inference and coalescent posterior predictive check for fixed-tree simulations.The dashed black line represents the true effective population trajectory.The solid blue line represents the posterior median effective population trajectory inferred by fixed-tree MCMC and the light blue region represents the corresponding pointwise 95% credible intervals for the effective population trajectory.