lossmodels
Severity and frequency fitting and aggregate loss distributions.
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 —
CollectiveRiskModelsimulation, 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lossmodels-0.7.3.tar.gz.
File metadata
- Download URL: lossmodels-0.7.3.tar.gz
- Upload date:
- Size: 88.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fa26598264ad1957fdcd95ee60c5f137e1e3f197926b0754e1e776e991fe810
|
|
| MD5 |
22c167a46a3963cd984178060e1fc731
|
|
| BLAKE2b-256 |
7d13c391930f41f94ac8b0edced0ded931d3e92a153bd80977a175e9021ea237
|
Provenance
The following attestation bundles were made for lossmodels-0.7.3.tar.gz:
Publisher:
release.yml on OpenActuarial/lossmodels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lossmodels-0.7.3.tar.gz -
Subject digest:
1fa26598264ad1957fdcd95ee60c5f137e1e3f197926b0754e1e776e991fe810 - Sigstore transparency entry: 2145633707
- Sigstore integration time:
-
Permalink:
OpenActuarial/lossmodels@ea1373f251f0b84fec4e0959fd10e0489421e020 -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/OpenActuarial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ea1373f251f0b84fec4e0959fd10e0489421e020 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lossmodels-0.7.3-py3-none-any.whl.
File metadata
- Download URL: lossmodels-0.7.3-py3-none-any.whl
- Upload date:
- Size: 68.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42cb302644d5da1bd6ae9ab2e35ba841dc420c16b018ad9e0b426f6fd29891b1
|
|
| MD5 |
e0506559d5f79cbe82a1899e250d0ffb
|
|
| BLAKE2b-256 |
9c792c6010517a4ebef5f6a7bdf7d934f7ff9674d7c096f95a1b100509b8c484
|
Provenance
The following attestation bundles were made for lossmodels-0.7.3-py3-none-any.whl:
Publisher:
release.yml on OpenActuarial/lossmodels
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lossmodels-0.7.3-py3-none-any.whl -
Subject digest:
42cb302644d5da1bd6ae9ab2e35ba841dc420c16b018ad9e0b426f6fd29891b1 - Sigstore transparency entry: 2145633723
- Sigstore integration time:
-
Permalink:
OpenActuarial/lossmodels@ea1373f251f0b84fec4e0959fd10e0489421e020 -
Branch / Tag:
refs/tags/v0.7.3 - Owner: https://github.com/OpenActuarial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ea1373f251f0b84fec4e0959fd10e0489421e020 -
Trigger Event:
push
-
Statement type: