---
name: prospicio
description: >
  Actuarial and risk modeling on a Rust core: reserving, distributions, aggregate loss, reinsurance and pricing. Use when writing Python code that uses the prospicio package.
license: MIT
compatibility: Requires Python >=3.9.
---

# prospicio

Actuarial and risk modeling on a Rust core: reserving, distributions, aggregate loss, reinsurance and pricing.

## Installation

```bash
pip install prospicio
```

## API overview

### Distributions

Parametric, discretized and sampled representations.

- `distributions.Lognormal`
- `distributions.Gamma`
- `distributions.Tweedie`
- `distributions.Weibull`
- `distributions.Loglogistic`
- `distributions.Mixture`
- `distributions.Custom`
- `distributions.to_json`
- `distributions.from_json`
- `distributions.Grid`
- `distributions.DiscretizationReport`
- `distributions.Sampled`

### Large-loss severities

The Pareto family for layer and treaty pricing, with maximum likelihood fits.

- `distributions.Pareto`
- `distributions.PiecewisePareto`
- `distributions.LogAffinePareto`
- `distributions.GeneralizedPareto`
- `distributions.local_pareto_to_piecewise`

### Claim counts

Frequency distributions for frequency-severity aggregation.

- `distributions.Poisson`
- `distributions.NegativeBinomial`
- `distributions.Binomial`
- `distributions.claim_count`

### Predictive distributions

The joint result every model returns.

- `distributions.PredictiveDistribution`

### Aggregate loss

Compound distributions on a grid, and simulated years of losses.

- `aggregate.panjer`
- `aggregate.fft`
- `aggregate.CompoundReport`
- `aggregate.simulate_events`
- `aggregate.EventSet`

### Reinsurance

Excess-of-loss layers and towers, applied to simulated losses or exactly on the grid.

- `reinsurance.Layer`
- `reinsurance.Tower`
- `reinsurance.TowerGrids`

### Models

Terms and design matrices, GLMs and GAMs, metrics, resampling and MCMC diagnostics.

- `models.Terms`
- `models.Coding`
- `models.Design`
- `models.Glm`
- `models.GlmFit`
- `models.BayesGlm`
- `models.BayesGlmFit`
- `models.ElasticNet`
- `models.ElasticNetFit`
- `models.CvPath`
- `models.Gam`
- `models.GamFit`
- `models.deviance`
- `models.gini`
- `models.lift`
- `models.crps`
- `models.log_score`
- `models.pit`
- `models.pit_from_draws`
- `models.pit_histogram`
- `models.ks_uniform`
- `models.k_fold`
- `models.group_k_fold`
- `models.time_ordered`
- `models.mcmc_diagnostics`
- `models.elpd_loo`
- `models.stacking_weights`
- `models.pseudo_bma_weights`
- `models.BayesStacking`
- `models.HierarchicalStacking`
- `models.StackingFit`
- `models.elpd_waic`
- `models.lppd`
- `models.Elpd`
- `models.deviance_score`
- `models.cross_validate`
- `models.grid_search`
- `models.random_search`
- `models.log_uniform`
- `models.SearchResult`
- `models.compare`
- `models.Comparison`
- `models.actual_vs_expected`
- `models.simulate_from_means`

### Gradient boosting

LightGBM and XGBoost behind the model protocol, with joint predictive draws.

- `boosting.Booster`
- `boosting.BoosterFit`

### Pricing

The collective model, layer rating, reinsurance tower matching, and risk-loaded prices from simulated losses.

- `pricing.CollectiveModel`
- `pricing.ilf`
- `pricing.loss_elimination_ratio`
- `pricing.pareto_extrapolation`
- `pricing.alpha_between_layers`
- `pricing.alpha_between_frequency_and_layer`
- `pricing.alpha_between_frequencies`
- `pricing.match_tower`
- `pricing.fit_pml_curve`
- `pricing.fit_references`
- `pricing.TowerModel`
- `pricing.price`
- `pricing.price_portfolio`
- `pricing.Price`
- `pricing.PortfolioPrice`
- `pricing.Mbbefd`
- `pricing.TabulatedCurve`
- `pricing.RiskProfile`
- `pricing.severity_exposure_curve`

### Reserving

Loss triangles, the chain ladder with tail factors, Mack's model with its one-year view, the expected-loss methods, the ODP bootstrap and Clark's growth curves.

- `reserving.Triangle`
- `reserving.ChainLadder`
- `reserving.ChainLadderFit`
- `reserving.TailConstant`
- `reserving.TailCurve`
- `reserving.TailBondy`
- `reserving.TailLogLinear`
- `reserving.Mack`
- `reserving.MackFit`
- `reserving.ClaimsDevelopmentResult`
- `reserving.ExpectedLoss`
- `reserving.BornhuetterFerguson`
- `reserving.Benktander`
- `reserving.CapeCod`
- `reserving.ExpectedLossFit`
- `reserving.CapeCodFit`
- `reserving.OdpBootstrap`
- `reserving.OdpBootstrapFit`
- `reserving.MackBootstrap`
- `reserving.MackBootstrapFit`
- `reserving.OneYearFit`
- `reserving.ClarkLdf`
- `reserving.ClarkCapeCod`
- `reserving.ClarkFit`

### Risk measures

Distortion risk measures, and capital allocation to components.

- `risk.Distortion`
- `risk.allocate`
- `risk.capital`
- `risk.entropic`
- `risk.esscher`
- `risk.marginal_expected_shortfall`
- `risk.covar`
- `risk.esscher_allocation`
- `risk.Allocation`

### Dependence

Copulas, and reordering existing draws to a target correlation.

- `risk.GaussianCopula`
- `risk.StudentTCopula`
- `risk.ArchimedeanCopula`
- `risk.simulate`
- `risk.iman_conover`

### Extreme value tails

Generalized Pareto tails over a threshold, beyond the draws.

- `risk.Gpd`
- `risk.PotTail`
- `risk.mean_excess`
- `risk.hill`

## Resources

- [Full documentation](https://ekthesage.github.io/prospicio/)
- [llms.txt](llms.txt) — Indexed API reference for LLMs
- [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs
- [Source code](https://github.com/EKtheSage/prospicio)
