bioRxiv · 10.1101/2025.10.02.679989
EWF 2.0: Exact sampling from the Wright-Fisher diffusion with time-varying demography
Abstract
Accurate modelling of allele frequency trajectories requires incorporation of both genetic mechanisms such as selection and mutation, as well as realistic population demography. Accounting for a non-constant demography within a Wright-Fisher diffusion framework induces a time-inhomogenous drift coefficient, a regime falling outside the scope of existing exact simulation routines. To address this gap, we introduce EWF 2.0, an exact simulation algorithm that accommodates time-varying demography within Wright-Fisher diffusions whilst retaining all the functionality of previous EWF versions. We validate correctness using distributional tests (Kolmogorov-Smirnov, QQ plots), confirming agreement with theoretical expectations. In spite of its greater generality, EWF 2.0 retains the same runtime as in previous versions, ensuring computational efficiency and scalability. All software is available at https://github.com/JaroSant/EWF. EWF 2.0 is particularly valuable for bridge simulation, where existing methods cannot handle time-varying mutation and selection rates. For a specified demographic history, mutation parameters, selection function and sampling times, EWF 2.0 generates exact draws from the law of the corresponding Wright-Fisher diffusion or diffusion bridge.
Source connections
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Sant, J., Jenkins, P. A., Koskela, J., Spano, D.. 2025-10-03. EWF 2.0: Exact sampling from the Wright-Fisher diffusion with time-varying demography. https://doi.org/10.1101/2025.10.02.679989
Cite the original work for its findings. Save a collection to share your selection of sources.