Algorithm 4. Importance sampled log-likelihood given a single datapoint |
---|
procedure SigmaLikelihood () ⊳ Takes mutant and susceptible counts for a particular site at a single timepoint. Returns an approximate log-likelihood function , up to an additive constant. SigmaLikelihood is a closure that returns a one-parameter function. We used N =103 samples. for do ⊳ Sample from the neutral distribution ⊳ Importance weight ratio ⊳ sample from the neutral distribution, conditioned on the observations ⊳ Importance weight ratio end for ⊳ importance sampling mean ⊳ Note the inversion in the weighting factor compared to Z0. return ⊳ Return a log-likelihood function. The same random variable realizations and are cached in memory and used for each function evaluation, making continuous and differentiable. end procedure |