## pricing.RiskProfile


A risk profile for property per-risk business: bands of sum insured,


Usage


``` python
pricing.RiskProfile()
```


each with an expected loss (given, or premium times a loss ratio) and its own exposure curve.

Each band's representative risk has sum insured `SI` (its total sum insured over its number of risks, say), taken as its MPL. The band expects `EL / (SI * curve.mean_rate)` losses a year; each simulated loss is the band's `SI` times a destruction rate from the band's curve, and carries that `SI`, so a surplus treaty ([Layer.surplus](reinsurance.Layer.md#prospicio.reinsurance.Layer.surplus)) and the per-risk excess of loss it inures to apply to the events. The exposure-rated expectations ([expected_layer_loss](pricing.RiskProfile.md#prospicio.pricing.RiskProfile.expected_layer_loss), [expected_surplus_loss](pricing.RiskProfile.md#prospicio.pricing.RiskProfile.expected_surplus_loss)) check the simulation.


## Parameters


`sums_insured: list of float`  
One per band.

`risks: list of float`  
Number of risks per band (for reference).

`curves: Mbbefd or TabulatedCurve, or a list of them`  
One curve for every band, or one per band.

`expected_losses: list of float`  
Expected annual loss per band. Give this, or `premiums`.

`premiums: list of float`  
Premium per band, with [loss_ratio](pricing.Price.md#prospicio.pricing.Price.loss_ratio).

`loss_ratio: float or list of float`  
Expected loss ratio, one for all bands or one per band.

`lower: list of float or None`  
Bounds of each band's sums insured (`None` for a band without). A band with bounds spreads its risks' sums insured uniformly between them: its mean `SI` is `(lower + upper) / 2` (in place of [sums_insured](aggregate.EventSet.md#prospicio.aggregate.EventSet.sums_insured)), each simulated loss draws its own `SI` between the bounds, and the exposure-rated expectations average over the band, weighted by sum insured.

`upper: list of float or None`  
Bounds of each band's sums insured (`None` for a band without). A band with bounds spreads its risks' sums insured uniformly between them: its mean `SI` is `(lower + upper) / 2` (in place of [sums_insured](aggregate.EventSet.md#prospicio.aggregate.EventSet.sums_insured)), each simulated loss draws its own `SI` between the bounds, and the exposure-rated expectations average over the band, weighted by sum insured.

`spread: (uniform, tilted) = ``"uniform"`  
How a band with bounds spreads its sums insured. `"tilted"` keeps [sums_insured](aggregate.EventSet.md#prospicio.aggregate.EventSet.sums_insured) as the mean, so the spread matches both the bounds and the band's total sum insured: the density `∝ exp(θ s)` on the bounds with `θ` solved for that mean ([sums_insured](aggregate.EventSet.md#prospicio.aggregate.EventSet.sums_insured) must lie strictly between the bounds).


## Examples

``` python
>>> from prospicio.pricing import Mbbefd, RiskProfile
>>> p = RiskProfile([1e6, 10e6], [800, 50], Mbbefd.swiss_re(3.0),
...                 premiums=[2e6, 1e6], loss_ratio=0.6)
>>> round(p.expected_loss())
```

1800000

``` python
>>> events = p.simulate(1000, 7)
>>> events.has_sums_insured
```

True


## Methods

| Name | Description |
|----|----|
| [expected_claims()](#expected_claims) | Expected number of losses a year, per band. |
| [expected_layer_loss()](#expected_layer_loss) | Exposure-rated expected loss to a per-risk layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs |
| [expected_loss()](#expected_loss) | Expected annual loss, all bands. |
| [expected_surplus_loss()](#expected_surplus_loss) | Expected annual loss ceded to a surplus treaty. |
| [simulate()](#simulate) | [n_sims](aggregate.EventSet.md#prospicio.aggregate.EventSet.n_sims) years of losses, each with its risk's sum insured. |

------------------------------------------------------------------------


#### expected_claims()


Expected number of losses a year, per band.


Usage


``` python
expected_claims()
```


##### Returns


`list of float`  


------------------------------------------------------------------------


#### expected_layer_loss()


Exposure-rated expected loss to a per-risk layer [limit](reinsurance.Layer.md#prospicio.reinsurance.Layer.limit) xs


Usage


``` python
expected_layer_loss(
    limit, attachment, surplus_retention=None, surplus_lines=None
)
```


[attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment), optionally on each risk net of a surplus treaty.


##### Parameters


`limit: float`  
`inf` for unlimited.

`attachment: float`  

`surplus_retention: float = None`  
A surplus treaty the layer inures to.

`surplus_lines: float = None`  
A surplus treaty the layer inures to.


##### Returns


`float`  


------------------------------------------------------------------------


#### expected_loss()


Expected annual loss, all bands.


Usage


``` python
expected_loss()
```


##### Returns


`float`  


------------------------------------------------------------------------


#### expected_surplus_loss()


Expected annual loss ceded to a surplus treaty.


Usage


``` python
expected_surplus_loss(retention, lines)
```


##### Parameters


`retention: float`  

`lines: float`  


##### Returns


`float`  


------------------------------------------------------------------------


#### simulate()


[n_sims](aggregate.EventSet.md#prospicio.aggregate.EventSet.n_sims) years of losses, each with its risk's sum insured.


Usage


``` python
simulate(n_sims, seed)
```


##### Parameters


`n_sims: int`  

`seed: int`  


##### Returns


`EventSet`
