# rippy
Reinsurance Modeling and Pricing in Python!
## Getting Started
Install rippy from pypi:
```pip install rippy```
## Introduction
Rippy is a simple, fast and lightweight simulation-based reinsurance modeling package. It has two main components:
1. Frequency-Severity, otherwise known as compound distribution simulation
Rippy contains the ```FrequencySeverityModel``` class to set up and simulate from compound distributions with a variety of frequency and severity distributions
```python
from rippy import FrequencySeverityModel, Distributions
claims = FrequencySeverityModel(Distributions.Poisson(5),Distributions.Pareto(0.5,100000)).generate()
```
2. Reinsurance contract calculation
Rippy can then calculate the recoveries of a number of types of reinsurance contract for the simulated claims.
```python
from rippy import XoL
xol_layer = XoL(name="Layer 1", limit=1000000, excess=100000, premium=1000)
xol_layer.apply(claims)
xol_layer.print_summary()
```
Rippy is based on the scientific python stack of numpy and scipy. It is designed for interoperability with numpy and ndarrays, so for example the simulated claims can be operated on with
numpy ufuncs:
```python
import numpy as np
capped_claims = np.minimum(claims,2000000)
```
Under the hood/bonnet, rippy represents the simulations of the Frequency-Severity model in sparse storage, keeping two lists of simulation indices and values:
|sim_index | values|
|-----|-----|
| 0 | 13231.12
| 0 | 432.7 |
| 2 | 78935.12 |
| 3 | 3213.9 |
| 3 | 43843.1 |
| ...| ...|
Frequency-Severity simulations can be aggregated (summed within a sim_index), which results in a standard ```np.ndarray```
```python
aggregate_claims = claims.aggregate()
```
```python
np.array([13663.82,0,78935,12,47957.0,....])
```
### Configuring the simulation settings
The global number of simulations can be changed from the ```config``` class (the default is 100,000 simulations)
```python
from rippy import config
config.n_sims = 1000000
```
The global random seed can also be configured from the ```config``` class
```python
config.set_random_seed(123456)
```
Rippy uses the ```default_rng``` class of the ```numpy.random``` module. This can also be configured using the ```config.rng``` property.
## Project Status
Rippy is currently a proof of concept. There are a limited number of supported distributions and reinsurance contracts. We are working on:
* Adding more distributions and loss generation types
* Adding support for Catastrophe loss generation and reinsurance contracts
* Adding support for more reinsurance contract types (Surplus, Stop Loss etc)
* Grouping reinsurance contracts into programs and structures
* Stratified sampling and Quasi-Monte Carlo methods
* GPU support
* Reporting dashboards
## Issues
Please log issues in github
## Contributing
You are welcome to contribute pull requests
Raw data
{
"_id": null,
"home_page": "",
"name": "rippy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "reinsurance,actuarial,insurance",
"author": "James Norman",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/e5/2e/4d2a40ef96f255a764b1cb75288dd48bda6b89805c89ce808b7dadb44dd9/rippy-0.0.5.tar.gz",
"platform": null,
"description": "# rippy\nReinsurance Modeling and Pricing in Python!\n\n## Getting Started\n\nInstall rippy from pypi:\n\n```pip install rippy```\n\n## Introduction\n\nRippy is a simple, fast and lightweight simulation-based reinsurance modeling package. It has two main components:\n\n1. Frequency-Severity, otherwise known as compound distribution simulation\n\n Rippy contains the ```FrequencySeverityModel``` class to set up and simulate from compound distributions with a variety of frequency and severity distributions\n\n ```python\n from rippy import FrequencySeverityModel, Distributions\n claims = FrequencySeverityModel(Distributions.Poisson(5),Distributions.Pareto(0.5,100000)).generate()\n ```\n\n2. Reinsurance contract calculation\n \n Rippy can then calculate the recoveries of a number of types of reinsurance contract for the simulated claims.\n\n ```python\n from rippy import XoL\n xol_layer = XoL(name=\"Layer 1\", limit=1000000, excess=100000, premium=1000)\n xol_layer.apply(claims)\n xol_layer.print_summary()\n ```\n\n\nRippy is based on the scientific python stack of numpy and scipy. It is designed for interoperability with numpy and ndarrays, so for example the simulated claims can be operated on with\nnumpy ufuncs:\n\n```python\nimport numpy as np\ncapped_claims = np.minimum(claims,2000000)\n```\n\nUnder the hood/bonnet, rippy represents the simulations of the Frequency-Severity model in sparse storage, keeping two lists of simulation indices and values: \n\n|sim_index | values|\n|-----|-----|\n| 0 | 13231.12\n| 0 | 432.7 |\n| 2 | 78935.12 |\n| 3 | 3213.9 |\n| 3 | 43843.1 |\n| ...| ...|\n\nFrequency-Severity simulations can be aggregated (summed within a sim_index), which results in a standard ```np.ndarray```\n\n```python\naggregate_claims = claims.aggregate()\n\n```\n\n```python\nnp.array([13663.82,0,78935,12,47957.0,....])\n```\n\n### Configuring the simulation settings\n\nThe global number of simulations can be changed from the ```config``` class (the default is 100,000 simulations)\n\n```python\nfrom rippy import config\nconfig.n_sims = 1000000\n```\n\nThe global random seed can also be configured from the ```config``` class\n\n```python\nconfig.set_random_seed(123456)\n```\n\nRippy uses the ```default_rng``` class of the ```numpy.random``` module. This can also be configured using the ```config.rng``` property.\n\n\n\n## Project Status\n\nRippy is currently a proof of concept. There are a limited number of supported distributions and reinsurance contracts. We are working on:\n\n* Adding more distributions and loss generation types\n* Adding support for Catastrophe loss generation and reinsurance contracts\n* Adding support for more reinsurance contract types (Surplus, Stop Loss etc)\n* Grouping reinsurance contracts into programs and structures\n* Stratified sampling and Quasi-Monte Carlo methods\n* GPU support\n* Reporting dashboards\n\n## Issues\n\nPlease log issues in github\n\n## Contributing\n\nYou are welcome to contribute pull requests\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Reinsurance Pricing in Python",
"version": "0.0.5",
"project_urls": {
"Bug Reports": "https://github.com/ProteusLLP/rippy/issues",
"Source": "https://github.com/ProteusLLP/rippy"
},
"split_keywords": [
"reinsurance",
"actuarial",
"insurance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "970b8c10ff3f0d22d6c6b31d9fda3724957b3a41b0c837c375f4967e95030b9b",
"md5": "01c32d36da780ac2c41b14246bf5ee19",
"sha256": "a06f1f15c825a59afba3fd62f7df0a8fd118234dcd22dabf209c911e25280f96"
},
"downloads": -1,
"filename": "rippy-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "01c32d36da780ac2c41b14246bf5ee19",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 11152,
"upload_time": "2024-02-01T15:36:59",
"upload_time_iso_8601": "2024-02-01T15:36:59.645879Z",
"url": "https://files.pythonhosted.org/packages/97/0b/8c10ff3f0d22d6c6b31d9fda3724957b3a41b0c837c375f4967e95030b9b/rippy-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e52e4d2a40ef96f255a764b1cb75288dd48bda6b89805c89ce808b7dadb44dd9",
"md5": "2d2c4baadc131c875d416c4827256f98",
"sha256": "a7ca737ece4c12c0e04456a4c49f901c25a6f55f668138673f62f834dbeda380"
},
"downloads": -1,
"filename": "rippy-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "2d2c4baadc131c875d416c4827256f98",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 11584,
"upload_time": "2024-02-01T15:37:01",
"upload_time_iso_8601": "2024-02-01T15:37:01.230927Z",
"url": "https://files.pythonhosted.org/packages/e5/2e/4d2a40ef96f255a764b1cb75288dd48bda6b89805c89ce808b7dadb44dd9/rippy-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-01 15:37:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ProteusLLP",
"github_project": "rippy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": []
},
{
"name": "scipy",
"specs": []
}
],
"lcname": "rippy"
}