Skip to main content

Epydemics: Forecasting COVID-19 using time series and machine learning

Version 0.11.1 - Publication-Ready Reporting Tools with ModelReport

epydemics is a Python library for epidemiological modeling and forecasting. It provides tools for creating, fitting, and evaluating discrete SIRD/SIRDV models with time-dependent parameters. The library is designed to be flexible and extensible, allowing users to easily incorporate their own data and models.

📖 New Users? Start with the User Guide to understand when and how to use epydemics.

✅ v0.11.1 New: ModelReport class for one-line exports to Markdown, LaTeX tables, and publication-ready 300-600 DPI figures. Automated summary statistics, forecast accuracy evaluation, and model comparison utilities.

Features

  • Discrete SIRD Model: A discrete Susceptible-Infected-Recovered-Deceased (SIRD) model with time-dependent parameters.
  • SIRDV Vaccination Model (v0.7.0): Extended model including Vaccinated compartment (V) and vaccination rate (δ).
  • Time Series Forecasting: Use of VAR (Vector Autoregression) models to forecast epidemic rates with logit transformation.
  • Multi-Frequency Support (v0.9.0): Native processing of daily, business day, weekly, monthly, and annual data with automatic detection and handler-based validation (no artificial reindexing).
  • Temporal Aggregation (v0.9.0): Frequency-aware aggregation that skips resampling when source and target frequencies match.
  • Business Day Support (v0.9.0): Dedicated handler for trading-day calendars (252 days/year) with validated lags and recovery windows.
  • Data Container: A convenient class for loading, preprocessing, and storing epidemiological data.
  • Parallel Simulations: Multi-core support for faster Monte Carlo simulations (27 scenarios for SIRD, 81 for SIRDV).
  • Result Caching: File-based caching to avoid recomputing identical analyses.
  • Model Evaluation: Tools for evaluating model performance with MAE, MSE, RMSE, MAPE, SMAPE metrics.
  • Visualization: Professional plotting functions for results and forecasts.
  • Publication Tools (v0.11.1): ModelReport class for Markdown, LaTeX, and high-DPI figure generation in one call. Model comparison utilities and automated summary statistics.

✅ Native Multi-Frequency: v0.9.0+ processes annual/monthly/weekly/business-day data without artificial daily reindexing. See User Guide for frequency guidance.

✅ Publication-Ready Reports: v0.11.1 includes ModelReport for generating Markdown reports, LaTeX tables, and multi-panel figures. See examples/notebooks/07_reporting_and_publication.ipynb.

SIRDV Model (New in v0.7.0)

The SIRDV model extends the classical SIRD model by incorporating vaccination:

Compartments:

  • S: Susceptible
  • I: Infected (active cases)
  • R: Recovered
  • D: Deaths
  • V: Vaccinated (new)

Rates:

  • α: Infection rate
  • β: Recovery rate
  • γ: Mortality rate
  • δ: Vaccination rate (new)

Key Features:

  • Automatic detection from vaccination data
  • 81 simulation scenarios (3⁴ confidence levels)
  • Conservation law: N = S + I + R + D + V
  • Parallel execution recommended for performance

Getting Started

To get started with epydemics, we recommend following the tutorial in TUTORIAL.md.

Installation

You can install epydemics from PyPI:

pip install epydemics

To install the latest development version, you can clone this repository and install it in editable mode:

git clone https://github.com/julihocc/epydemics.git
cd epydemics
pip install -e .

Documentation

User Documentation:

  • User Guide: Complete guide on when to use epydemics, data preparation, and frequency handling
  • Tutorial: Step-by-step guide for COVID-19 forecasting
  • CHANGELOG.md: Version history and detailed changes

Developer Documentation:

Release Documentation:

Further work

Recent additions in v0.10.0:

  • ✅ Fractional Recovery Lag: Annual frequency now uses 14/365 years (0.0384) instead of 0, fixing LinAlgError with incidence mode
  • ✅ Annual + Incidence Mode: Production-ready native support for annual surveillance data with incident cases
  • ✅ Enhanced Testing: 10 new tests for fractional lag validation (421/423 tests passing)

Recent additions in v0.9.0:

  • ✅ Native Multi-Frequency: Daily, business day, weekly, monthly, annual handlers; no artificial reindexing
  • ✅ Frequency-Aware Aggregation: Skip resampling when source and target frequencies match
  • ✅ Frequency-Aware Seasonality: Adaptive seasonal detection per frequency
  • ✅ Business Day Support: Trading-day defaults (252 days/year, 10-lag VAR, 10-day recovery)

Previous releases (v0.6.1-v0.7.0):

  • ✅ SIRDV Model Support: Automatic detection and modeling of vaccination data
  • ✅ Parallel Simulations: Multi-core execution for improved performance
  • ✅ Result Caching: Optional caching to avoid recomputation
  • ✅ Enhanced Testing: Comprehensive test coverage with slow test markers

Future directions (v1.0.0+):

  • Incidence-First Mode: Direct modeling of incident cases (not just cumulative)
  • Importation Modeling: Handle external case introductions for eliminated diseases
  • Probabilistic & Scenario Forecasting: Monte Carlo and intervention comparison workflows
  • More advanced time series models: SARIMAX, Prophet, or deep learning approaches
  • Support for other epidemiological models: Extend to SEIR, SEIRD, or metapopulation models
  • Improved visualization: Interactive dashboards and real-time updating plots

References

Allen u.a. 2008 Allen, L.J.S. ; Brauer, F. ; Driessche, P. van den ; Bauch, C.T. ; Wu, J. ; Castillo-Chavez, C. ; Earn, D. ; Feng, Z. ; Lewis, M.A. ; Li, J. u.a.: Mathematical Epidemiology. Springer Berlin Heidelberg, 2008 (Lecture Notes in Mathematics).– URL https://books. google.com/books?id=gcP5l1a22rQC.– ISBN 9783540789109

Andrade u.a. 2021 Andrade, Marinho G. ; Achcar, Jorge A. ; Conce icc˜ ao, Katiane S. ; Ravishanker, Nalini: Time Series Regression Models for COVID-19 Deaths. In: J. Data Sci 19 (2021), Nr. 2, S. 269–292

Hawas 2020 Hawas, Mohamed: Generated time-series prediction data of COVID-19s daily infections in Brazil by using recurrent neural networks. In: Data in brief 32 (2020), S. 106175

Maleki u.a. 2020 Maleki, Mohsen ; Mahmoudi, Mohammad R. ; Wraith, Darren ; Pho, Kim-Hung: Time series modelling to forecast the confirmed and recovered cases of COVID-19. In: Travel medicine and infectious disease 37 (2020), S. 101742

Martcheva 2015 Martcheva, M.: An Introduction to Mathematical Epi demiology. Springer US, 2015 (Texts in Applied Mathematics).– URL https: //books.google.com/books?id=tt7HCgAAQBAJ.– ISBN 9781489976123

Singh u.a. 2020 Singh, Vijander ; Poonia, Ramesh C. ; Kumar, Sandeep ; Dass, Pranav ; Agarwal, Pankaj ; Bhatnagar, Vaibhav ; Raja, Linesh: Prediction of COVID-19 coronavirus pandemic based on time series data using Support Vector Machine. In: Journal of Discrete Mathematical Sciences and Cryptography 23 (2020), Nr. 8, S. 1583–1597

Wacker und Schluter 2020 Wacker, Benjamin; Schluter, Jan: Time continuous and time-discrete SIR models revisited: theory and applications. In: Advances in Difference Equations 2020 (2020), Nr. 1, S. 1–44.– ISSN 1687-1847.– URL https://doi.org/10.1186/s13662-020-02907-9

Metadata

Release files for epydemics 0.11.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for epydemics 0.11.2
File Size Uploaded Provenance Actions
epydemics-0.11.2.tar.gz 84.7 kB With provenance Details for epydemics-0.11.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for epydemics 0.11.2
File Interpreter ABI Platform Actions
epydemics-0.11.2-py3-none-any.whl Python 3 none any Details for epydemics-0.11.2-py3-none-any.whl

Total release size: 170.1 kB

Release files / epydemics-0.11.2.tar.gz

Download URL epydemics-0.11.2.tar.gz
Size 84.7 kB
Tags Source
SHA-256 checksum
How to use checksums
74330cc0bd7c68706f26d8a8df26a74e6810804aafcd0847b84a017f2cf7fbf9
BLAKE2b-256 checksum
How to use checksums
2848a7b740c3c49fdf70ede5dbebfa320415f4bd5bec33e2033aeffb1dcb664a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.

Transparency log

Release files / epydemics-0.11.2-py3-none-any.whl

Download URL epydemics-0.11.2-py3-none-any.whl
Size 85.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0c3f19ddb13e51d486ded0e9a63f9f12a0a929dee456abf8dfe054f5a64752f
BLAKE2b-256 checksum
How to use checksums
00f2a7b4e271c0b12cfdf2662d12939698b5c79be016f3c4255ef1a3629e04a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.

Transparency log

Security for epydemics 0.11.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for epydemics-0.11.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page