Getting started¶
The tools reconstruct a missing earlier event date, such as symptom onset, infection or sampling, from a later observed date, such as the report date. They also allow for right truncation. The examples here use symptom onsets and report dates.
There are four implementations. The JavaScript module drives the interactive page. The Python package is a stochastic simulation that cross-checks it. The R and Julia packages hold the line-list tools. All four can impute a real line list.
Install and load¶
The package is epidemic_dates.
It needs Python 3.11 or later, NumPy and SciPy.
Install it from GitHub with pip or uv:
Or clone the repository and let uv manage the environment:
git clone https://github.com/seabbs/EpidemicDates
cd EpidemicDates
uv run python -c "import epidemic_dates; print(epidemic_dates.METHODS)"
Load it in Python:
The package also installs the epidemic-dates command:
The module is the single file epidemic-dates.js.
It has no dependencies.
Copy it into your project, or clone the repository:
In Node 20 or later, load it with require:
const EpidemicDates = require("./epidemic-dates.js");
EpidemicDates.METHODS.map((m) => m.key); // ['backsampling', 'mean', 'fwd', 'gen']
In a browser, the script defines the global EpidemicDates:
The package is epidemicdates.
It needs R 4.1 or later and only base R and stats.
Install it from the r folder of the repository with remotes:
Load it and impute a small line list, with NA for missing onsets:
The package is EpidemicDates.jl.
It is not registered and needs Julia 1.10 or later.
Install it from the julia folder of the repository:
Load it and impute a small line list, with missing for missing onsets:
Quick start on your own data¶
Short versions of the worked example, in all four languages, are on the home page. The worked example goes through each step with the example line list.
Next steps¶
- Read how the methods work and what they assume.
- Follow the worked example on a real line list.
- Use the Python, JavaScript, R or Julia guide.
- Look up a function in the Python, JavaScript, R or Julia API reference.
Development¶
Development needs uv, Node 20 or later and optionally Task.