Skip to main content

lossmodels

Severity and frequency fitting and aggregate loss distributions.

CI PyPI Python

Overview

lossmodels covers the loss-distribution workflow from data to aggregate: a severity catalog spanning the classic distributions and the transformed beta and transformed gamma families, frequency models, maximum likelihood that is truncation- and censoring-aware, fit diagnostics and model selection, and aggregate distributions via simulation, FFT, and Panjer recursion.

Every severity model shares one interface — moments, quantiles, limited expected values, increased-limits tables — so fitted models drop directly into coverage modifications, aggregates, and the wider ecosystem.

Installation

pip install lossmodels

Requires Python 3.10 or newer.

Quick start

from lossmodels import Poisson, Lognormal, CollectiveRiskModel

freq = Poisson(lam=2.0)
sev = Lognormal(mu=10.0, sigma=0.8)
model = CollectiveRiskModel(freq, sev)

print("Mean     :", model.mean())
print("Variance :", model.variance())
print("VaR 95%  :", model.var(0.95))
print("TVaR 95% :", model.tvar(0.95))

samples = model.sample(50_000, rng=0)
print("Simulated mean:", samples.mean())

What's inside

  • Severity — classic and extended catalogs (including the transformed beta and transformed gamma families) behind one shared interface, plus increased-limits and loss-elimination tables.
  • Frequency — Poisson, negative binomial, and related counting models.
  • Estimation — MLE with truncation and censoring support, parameter uncertainty, goodness-of-fit diagnostics, and model comparison.
  • Aggregate — CollectiveRiskModel simulation, FFT and Panjer recursion, stop-loss and risk measures.
  • Coverage — deductibles, limits, and coinsurance applied analytically.
  • Empirical — nonparametric counterparts for validation.

The full API reference and end-to-end worked examples live at openactuarial.org/lossmodels.html.

The OpenActuarial ecosystem

lossmodels is one of seven packages that share conventions — tidy tables, explicit distribution parameterizations, reproducible random-number handling — and compose across package seams:

Package Role
actuarialpy Calculation primitives the workflow packages build on
experiencestudies Experience reporting, actual-vs-expected, claimant and concentration analysis
projectionmodels Claim, premium, and expense projection over a renewal horizon
ratingmodels Manual and experience rating, credibility, indication, GLM relativities
lossmodels Severity and frequency fitting, aggregate loss distributions
extremeloss Extreme-value tails: POT/GPD, GEV, return levels, splicing
risksim Portfolio Monte Carlo, dependence, reinsurance contracts, risk measures

Install everything at once with pip install openactuarial.

Development

git clone https://github.com/OpenActuarial/lossmodels
cd lossmodels
python -m pip install -e ".[dev]"
pytest
ruff check src tests

CI runs the same gate on Python 3.10–3.14 across Linux and Windows.

Versioning and stability

All ecosystem packages are pre-1.0: minor releases may change APIs, and every release is documented in CHANGELOG.md. Current per-package API stability is tracked at openactuarial.org/stability.html.

License

MIT — see LICENSE.

Release files for lossmodels 0.8.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 lossmodels 0.8.2
File Size Uploaded
lossmodels-0.8.2.tar.gz 93.2 kB Details

Built distribution (wheel)

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

Total release size: 164.9 kB

Release files / lossmodels-0.8.2.tar.gz

Download URL lossmodels-0.8.2.tar.gz
Size 93.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a06bbdb0e2151776c3ae81e859113f71816cb9da0479640215aa7be6f4fbe3ad
BLAKE2b-256 checksum
How to use checksums
73af3eab0098514e2d169a9ddb292143273eb4fba1eedbf1b093833aaa121a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 13, 2026.

Transparency log

Release files / lossmodels-0.8.2-py3-none-any.whl

Download URL lossmodels-0.8.2-py3-none-any.whl
Size 71.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
445f275d2ff77cedf137e1252d39fdfbe3e26dceffe7f8fc917745326a2c4d76
BLAKE2b-256 checksum
How to use checksums
9389a27ca18bc2b2a748d7ab245cacf84e12d3158241bf3993f162ce123716d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.2 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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