## pricing.CasualtyProfile


A book of casualty policies, each rated on its own curve


Usage

``` python
pricing.CasualtyProfile()
```


(`docs/design/casualty-exposure.md`).

Policy `i` pays `share * min((X - attachment)+, limit)` for a ground-up loss `X` per occurrence. A per-policy treaty [limit](pricing.Quote.md#prospicio.pricing.Quote.limit) xs [attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment) cedes the part above its retention, and the share of the policy's expected loss it takes is its exposure factor.


## Parameters


`curves: list`  
Severities, [IlfTable](pricing.IlfTable.md#prospicio.pricing.IlfTable) or [ElfTable](pricing.ElfTable.md#prospicio.pricing.ElfTable); each policy names one.

`limit: list of float`  
One per policy: the policy limit above its attachment (`inf` for none, as in workers compensation), on-level premium and expected loss ratio.

`premium: list of float`  
One per policy: the policy limit above its attachment (`inf` for none, as in workers compensation), on-level premium and expected loss ratio.

`elr: list of float`  
One per policy: the policy limit above its attachment (`inf` for none, as in workers compensation), on-level premium and expected loss ratio.

`attachment: list of float`  
Underlying attachment (0) and share of the layer written (1).

`share: list of float`  
Underlying attachment (0) and share of the layer written (1).

`curve: list of int`  
Each policy's index into `curves` (0).

`tag: list of str or None`  
A segment or line, for reporting and for leaving a segment out.


## Examples

Clark's workers compensation example, 750,000 xs 250,000:

``` python
>>> from prospicio.pricing import CasualtyProfile, ElfTable
>>> book = CasualtyProfile(
...     [ElfTable([250e3, 1e6], [0.030, 0.006])], limit=[float("inf")],
...     premium=[100e3], elr=[0.70])
>>> round(book.rate(750e3, 250e3, alae="in_severity").ceded, 6)
```

1680.0


## Methods

| Name | Description |
|----|----|
| [count_test()](#count_test) | Expected against observed claims at each size, with the Poisson |
| [expected_claims()](#expected_claims) | The expected number of claims a year recorded at or above the |
| [exposure_factors()](#exposure_factors) | Each policy's exposure factor for the treaty [limit](pricing.Quote.md#prospicio.pricing.Quote.limit) xs |
| [occurrences_above()](#occurrences_above) | Each policy's expected ground-up occurrences above [t](distributions.Pareto.md#prospicio.distributions.Pareto.t) a year, |
| [rate()](#rate) | The ILF form: each policy's `premium * elr` times its exposure |
| [rate_by_frequency()](#rate_by_frequency) | The frequency form: each policy's expected number of ground-up |
| [sweep()](#sweep) | The frequency form at each alpha of a Pareto from [threshold](risk.PotTail.md#prospicio.risk.PotTail.threshold), |

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


#### count_test()


Expected against observed claims at each size, with the Poisson


Usage

``` python
count_test(sizes, *, threshold, counts, excess, exposure_years, observed)
```


probability of a count at least as extreme in the direction observed.


##### Parameters


`sizes: list of float`  
Ground-up sizes, at or above [threshold](risk.PotTail.md#prospicio.risk.PotTail.threshold).

`threshold: float`  
As in [rate_by_frequency](pricing.CasualtyProfile.md#prospicio.pricing.CasualtyProfile.rate_by_frequency).

`counts: float`  
As in [rate_by_frequency](pricing.CasualtyProfile.md#prospicio.pricing.CasualtyProfile.rate_by_frequency).

`excess: float`  
As in [rate_by_frequency](pricing.CasualtyProfile.md#prospicio.pricing.CasualtyProfile.rate_by_frequency).

`exposure_years: float`  
The experience period in the profile's years: each year's on-level premium over the profile's, summed.

`observed: list of float`  
The trended ground-up losses ([PreparedLosses.trended](pricing.PreparedLosses.md#prospicio.pricing.PreparedLosses.trended)), a claim closed at its limit at the limit.


##### Returns


`dict`  
Columns `size`, [expected](pricing.Portfolio.md#prospicio.pricing.Portfolio.expected), `observed` and `p_value`.


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


#### expected_claims()


The expected number of claims a year recorded at or above the


Usage

``` python
expected_claims(t, threshold, counts, excess)
```


ground-up size [t](distributions.Pareto.md#prospicio.distributions.Pareto.t): a policy records an occurrence once it passes its attachment and caps it at `a + l`, so it adds `counts[i] * S(max(t, a))` when `t <= a + l`, `S` the survival of `excess`.


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


#### exposure_factors()


Each policy's exposure factor for the treaty [limit](pricing.Quote.md#prospicio.pricing.Quote.limit) xs


Usage

``` python
exposure_factors(limit, attachment, *, alae, loading=None)
```


[attachment](reinsurance.Layer.md#prospicio.reinsurance.Layer.attachment).


##### Parameters


`limit: float`  

`attachment: float`  

`alae: (pro_rata, on_top, in_severity) = ``"pro_rata"`  
`pro_rata`: ALAE in proportion to loss, the ceded loss times `1 + loading` on a loss-only ELR. `on_top`: the policy limit caps loss only and ALAE is `loading` times it; the treaty's retention and limit apply to loss and ALAE (Clark's second formula). `in_severity`: the curves are of loss and ALAE.

`loading: float = None`  
Required with `pro_rata` and `on_top`, refused otherwise.


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


#### occurrences_above()


Each policy's expected ground-up occurrences above [t](distributions.Pareto.md#prospicio.distributions.Pareto.t) a year,


Usage

``` python
occurrences_above(t)
```


from its own curve: `premium * elr / (share * [LEV(a + l) - LEV(a)]) * S(t)`, a table's `S` its slope just above [t](distributions.Pareto.md#prospicio.distributions.Pareto.t).


##### Returns


`list of float`  


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


#### rate()


The ILF form: each policy's `premium * elr` times its exposure


Usage

``` python
rate(limit, attachment, *, alae, loading=None)
```


factor, with the ALAE loading. Arguments as [exposure_factors](pricing.CasualtyProfile.md#prospicio.pricing.CasualtyProfile.exposure_factors).


##### Returns


`CasualtyRating`  


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


#### rate_by_frequency()


The frequency form: each policy's expected number of ground-up


Usage

``` python
rate_by_frequency(
    limit, attachment, *, alae, threshold, counts, excess, loading=None
)
```


occurrences above [threshold](risk.PotTail.md#prospicio.risk.PotTail.threshold) ([counts](aggregate.EventSet.md#prospicio.aggregate.EventSet.counts)) times the expected ceded amount given `X > threshold` under `excess`, a severity of the losses above it (a Pareto from it, say). Fails when an exposed policy's cession starts below the threshold.


##### Returns


`CasualtyRating`  


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


#### sweep()


The frequency form at each alpha of a Pareto from [threshold](risk.PotTail.md#prospicio.risk.PotTail.threshold),


Usage

``` python
sweep(limit, attachment, *, alae, threshold, counts, alphas, loading=None)
```


the counts held fixed. The central alpha and its source are yours to state beside the result; prospicio ships no benchmark.


##### Returns


`dict`  
Columns [alpha](models.ElasticNet.md#prospicio.models.ElasticNet.alpha), [ceded](reinsurance.Layer.md#prospicio.reinsurance.Layer.ceded) and [loss_cost](pricing.BurningCost.md#prospicio.pricing.BurningCost.loss_cost).


##### Examples

``` python
>>> from prospicio.distributions import Pareto
>>> from prospicio.pricing import CasualtyProfile
>>> book = CasualtyProfile([Pareto(1e6, 1.5)], limit=[10e6], premium=[1e6], elr=[0.6])
>>> s = book.sweep(5e6, 5e6, alae="in_severity", threshold=1e6, counts=[1.0],
...                alphas=[1.0, 2.0])
>>> round(s["ceded"][0] / s["ceded"][1], 2)
```

6.93
