Skip to main content

fair-risk-engine

Monte Carlo simulation engine for FAIR (Factor Analysis of Information Risk) cyber risk quantification. You describe a loss scenario with P10/P50/P90 ranges; the engine simulates many years and returns the distribution of annual loss.

pip install fair-risk-engine
from fair_risk_engine import FAIRCalculator, FAIRInputs

inputs = FAIRInputs(
    tef_p10=1, tef_p50=3, tef_p90=5,                 # threat events per year
    susc_p10=20, susc_p50=40, susc_p90=70,           # % of threat events that become loss events
    productivity_p10=50_000, productivity_p50=150_000, productivity_p90=500_000,
    response_p10=20_000, response_p50=75_000, response_p90=250_000,
)
r = FAIRCalculator(n_simulations=100_000, random_state=42).calculate(inputs)

print(f"Mean annual loss: ${r.ale_mean:,.0f} ± ${r.ale_mean_se:,.0f} (Monte Carlo error)")
print(f"P90: ${r.ale_p90:,.0f}   P99: ${r.ale_p99:,.0f}   ES99: ${r.ale_es99:,.0f}")
print(f"Years with no loss: {r.to_dict()['p_no_loss']:.0%}")

What it computes

  • Compound annual loss. Each simulated year draws its own number of loss events and a separate loss for each; the year's loss is their sum. Years without loss and years with several losses both occur.
  • The six FAIR loss forms (productivity, response, replacement, fines & judgments, competitive advantage, reputation), with secondary loss occurring per event with probability SLEF.
  • Outputs: mean, percentiles, VaR and expected shortfall, the loss exceedance curve, the share of years without loss, each loss form's share of the mean, and Monte Carlo standard errors.
  • Sensitivity: curves, coupled changes and a tornado ranking of the inputs.
  • Portfolios: independent or correlated (Gaussian copula) aggregation of scenarios.

Bursty attack counts: threat event frequency is Poisson (default), negative binomial or a lognormal rate. tef_dispersion adds a year-to-year shock on the rate, which widens the tail (and, with the lognormal rate, keeps the mean); it takes the annual_shape that tef-estimator estimates. With the Poisson default the tail is understated when counts are bursty (model reference, limitations).

# Example values in the form tef-estimator prints them ("For fair-risk-engine: ..."; in Python,
# FAIRInputs(**result.fair_risk_engine_inputs(), ...))
bursty = FAIRInputs(tef_model="lognormal", tef_p10=1.2, tef_p50=3.0, tef_p90=7.5, tef_dispersion=2.4,
                    susc_p10=20, susc_p50=40, susc_p90=70,
                    response_p10=20_000, response_p50=75_000, response_p90=250_000)

Reproducibility

Every result stores its inputs, seed and engine version; a seeded result reproduces itself exactly. Any input the engine adjusts before use is listed in result.clamps.

Validation

The simulated loss distribution is tested against an exact (FFT) calculation. The engine is self-assessed against the 24 checks of the CRQ Vendor Validation Checklist: Level 2 (control prioritisation, scenario planning). It is not Level 1: there is no independent validation and no calibration against observed loss data yet. Every number comes from your inputs; the engine shows how uncertain the result is given those inputs.

Documentation

The engine also powers the FAIR Risk Quantification Tool, a web app in the same repository.

Licence

CC BY-NC-SA 4.0: free for non-commercial use with attribution; adaptations under the same licence. This is an independent implementation of the FAIR methodology; FAIR is a trademark of the FAIR Institute.

Metadata

Release files for fair-risk-engine 1.1.0

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

Source distribution (sdist)

Source distribution for fair-risk-engine 1.1.0
File Size Uploaded Provenance Actions
fair_risk_engine-1.1.0.tar.gz 40.4 kB Without provenance Details for fair_risk_engine-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fair-risk-engine 1.1.0
File Interpreter ABI Platform Actions
fair_risk_engine-1.1.0-py3-none-any.whl Python 3 none any Details for fair_risk_engine-1.1.0-py3-none-any.whl

Total release size: 68.9 kB

Release files / fair_risk_engine-1.1.0.tar.gz

Download URL fair_risk_engine-1.1.0.tar.gz
Size 40.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8ceb0b1843a2a7eef2514608e7fa6cb940920af6765acc60e62b202130efa950
BLAKE2b-256 checksum
How to use checksums
beee31d6d04c1b887829ac12dcbcebcef4ac620379fb22a2e0457bab60fc69a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / fair_risk_engine-1.1.0-py3-none-any.whl

Download URL fair_risk_engine-1.1.0-py3-none-any.whl
Size 28.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f484cc9545a52ecf455245885235f4a84c5fae8cb60c3f7f6a4b29a78218f5c
BLAKE2b-256 checksum
How to use checksums
aea089d3b71897d05098e50df680d815bae293d6f7960e4e03e9fcdc8222deba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for fair-risk-engine 1.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

1.1.0 This release

2 release files No 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