heormodel
heormodel is a Python decision-analytic modeling framework for health economic evaluation and health technology assessment.
heormodel covers the full cost-effectiveness analysis workflow in one package. It supports probabilistic parameter specification for a range of models: Markov cohort state-transition models, microsimulation models, and discrete-event simulation models. It builds the incremental cost-effectiveness ratio (ICER) table and runs value-of-information analysis. If you are not ready to port your model to Python, you can also bring your existing model results directly into the package.
Read more in the documentation: pedroliman.github.io/heormodel
Install
If you are new to Python, I recommend installing it with uv. Once you have a working Python installation, run this from your terminal within your project's folder:
pip install heormodel
# or using uv, which I prefer:
# (run uv init once)
uv init
uv add heormodel
Quickstart
This example compares treatment with standard care in a three-state Markov cohort state-transition model, evaluated by probabilistic sensitivity analysis. The code builds the model, runs it, and reports the ICER table and the expected value of perfect information.
import numpy as np
import pandas as pd
from heormodel.models import CohortSpec, MarkovModel
from heormodel.params import Beta, Gamma, ParameterSet
from heormodel.run import SeedManager, run_psa
from heormodel.cea import icer_table
from heormodel.voi import evpi
# define your model.
def model(p, intervention):
p_progress = p["p_progress"] * (p["rr_treat"] if intervention == "Treatment" else 1.0)
# Transition matrix. Rows: Current state. Columns: Next state.
P = np.array([
[1 - p_progress - p["p_die"], p_progress, p["p_die"]],
[0.0, 1 - p["p_die_sick"], p["p_die_sick"]],
[0.0, 0.0, 1.0],
])
cost = np.array([0.0, p["c_sick"], 0.0])
if intervention == "Treatment":
cost[:2] += p["c_treat"]
return CohortSpec(P, cost, np.array([1.0, p["u_sick"], 0.0]))
# create the MarkovModel engine.
engine = MarkovModel(states=("Healthy", "Sick", "Dead"),
interventions=("Standard care", "Treatment"),
transitions_and_rewards=model, n_cycles=40)
# Define your parameters:
params = ParameterSet({
"p_progress": Beta(20, 180), "rr_treat": Beta(60, 40),
"p_die": Beta(5, 995), "p_die_sick": Beta(50, 450),
"c_sick": Gamma(100, 250.0), "c_treat": Gamma(100, 80.0),
"u_sick": Beta(150, 50),
})
# sample your parameters:
draws = params.sample(1000, seed=SeedManager(1).generator())
# run your model over your parameters.
outcomes = run_psa(engine, draws).outcomes
# Get the ICER table.
icer_table(outcomes).round(1)
# cost effect inc_cost inc_effect icer status
# intervention
# Standard care 142910.9 11.2 NaN NaN NaN ND
# Treatment 233676.2 13.4 90765.3 2.2 41130.9 ND
# And from here your EVPI
round(evpi(outcomes, wtp=50_000), 1)
# 2738.7
Beyond this workflow, the package supports microsimulations, discrete-event simulation models, and compartmental transmission models written as ordinary differential equations (the ODEModel engine, with a susceptible-exposed-infectious-recovered vaccination example). A calibration function calibrates some parameters, takes others from the literature, then runs a full probabilistic sensitivity analysis. When the model is expensive to run, a surrogate-accelerated calibration tutorial trains a Gaussian process on a small design and calibrates through it with the sbi package, reaching the same posterior with about a hundred times fewer model runs.
Development
Developer documentation lives in devdocs/. See the CHANGELOG.md for recent changes and follow the release process: RELEASING.md.
Requires Python 3.11+ and uv:
uv venv && uv pip install -e ".[dev]"
uv run pytest
uv run pytest --doctest-modules src
uv run ruff check . && uv run mypy
The site in docs/ builds with Quarto and quartodoc; tutorials execute at render time. With Quarto installed and uv sync --extra docs:
uv run quartodoc build --config docs/_quarto.yml
quarto preview docs
Each tutorial also carries an "Open in Colab" badge backed by a runnable notebook under docs/_notebooks/. Regenerate the badges and notebooks after editing a tutorial; continuous integration checks they stay in sync:
uv run python docs/build_colab_notebooks.py
Metadata
Release files for heormodel 0.7.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| heormodel-0.7.4.tar.gz | 104.9 kB | With provenance | Details for heormodel-0.7.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| heormodel-0.7.4-py3-none-any.whl | Python 3 | none | any | Details for heormodel-0.7.4-py3-none-any.whl |
Total release size: 195.0 kB
Release files / heormodel-0.7.4.tar.gz
| Download URL | heormodel-0.7.4.tar.gz |
|---|---|
| Size | 104.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79d798a8092bd6c3b29cc8ffbd91d1dc6cd7176ba05e088aec25782f1f8d174c
|
|
BLAKE2b-256 checksum How to use checksums |
5255824722b9a1f80bc4840009a92c248c9296b2c64cdfde4c5a04cf70a69a7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 18, 2026.
Transparency logRelease files / heormodel-0.7.4-py3-none-any.whl
| Download URL | heormodel-0.7.4-py3-none-any.whl |
|---|---|
| Size | 90.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be4869ca0e26562156fbc61cfea4e4ec1d128b9bf5470a72d60a9193e12d4e79
|
|
BLAKE2b-256 checksum How to use checksums |
daddbcb890fedae3850331040df19a6709b465afc541988c14d464a600d0f81f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 18, 2026.
Transparency logSecurity for heormodel 0.7.4
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
Both files in this release have been uploaded with provenance metadata.
Attestation for heormodel-0.7.4.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 Jul 18, 2026.
Transparency logA 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.