## reserving.CapeCod


The Cape Cod (Stanard-Bühlmann) method: Bornhuetter-Ferguson with each


Usage


``` python
reserving.CapeCod()
```


origin's apriori estimated from the triangle, as chainladder-python's [CapeCod](reserving.CapeCod.md#prospicio.reserving.CapeCod).

Origin `j`'s used-up exposure is `exposure[j] / cdf[j]` and its latest value is trended to the triangle's valuation by `(1 + trend) ** (months / 12)`, the months running from the end of the origin period. Origin `i`'s trended apriori is the sum of the trended latest values weighted by `decay ** abs(i - j)` over the same weighted sum of used-up exposures; dividing by its own trend factor gives the apriori of its Bornhuetter-Ferguson ultimate.


## Parameters


`trend: float = ``0.0`  
Annual trend of the loss ratio; above -1.

`decay: float = ``1.0`  
Weight of an origin [n](distributions.Binomial.md#prospicio.distributions.Binomial.n) periods away, `decay ** n`; from 0 to 1. With 1 every origin shares one loss ratio.

`average: (volume, simple, regression) = ``"volume"`  
How link ratios are averaged, as in [ChainLadder](reserving.ChainLadder.md#prospicio.reserving.ChainLadder).

`sigma_interpolation: (log - linear, mack) = ``"log-linear"`  

`tail: (float, TailConstant, TailCurve, TailBondy or TailLogLinear)`  
As [ChainLadder](reserving.ChainLadder.md#prospicio.reserving.ChainLadder); no tail by default.


## Examples

``` python
>>> from prospicio.reserving import CapeCod, Triangle
>>> tri = Triangle.from_long(
...     [2020, 2020, 2021], [12, 24, 12],
...     {"paid": [100.0, 150.0, 200.0], "premium": [250.0, 250.0, 400.0]},
... )
>>> fit = CapeCod().fit(tri, "paid", "premium")
>>> [round(a, 4) for a in fit.apriori], [round(u, 2) for u in fit.ultimate]
```

(\[0.6774, 0.6774\], \[150.0, 290.32\])


## Attributes

| Name | Description |
|----|----|
| [average](#average) | How link ratios are averaged. |
| [decay](#decay) | Weight of an origin one period away. |
| [sigma_interpolation](#sigma_interpolation) | How unestimable variance parameters are filled in. |
| [tail](#tail) | The tail: a constant factor as a number, otherwise its estimator. |
| [trend](#trend) | Annual trend of the loss ratio. |

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


#### average


How link ratios are averaged.


`average: str`


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


#### decay


Weight of an origin one period away.


`decay: float`


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


#### sigma_interpolation


How unestimable variance parameters are filled in.


`sigma_interpolation: str`


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


#### tail


The tail: a constant factor as a number, otherwise its estimator.


`tail: Any`


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


#### trend


Annual trend of the loss ratio.


`trend: float`


## Methods

| Name | Description |
|----|----|
| [fit()](#fit) | Fits one loss column in every segment of a triangle, each with its |

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


#### fit()


Fits one loss column in every segment of a triangle, each with its


Usage


``` python
fit(triangle, column, exposure)
```


own exposure and apriori. Trend runs to the triangle's valuation.


##### Parameters


`triangle: Triangle`  

`column: str`  
The losses to project.

`exposure: str`  
The exposure column; each origin's latest observed cumulative value is its exposure (an incremental triangle's is cumulated).


##### Returns


`CapeCodFit`  


##### Raises


`ValueError`  
As [ChainLadder.fit](reserving.ChainLadder.md#prospicio.reserving.ChainLadder.fit), if [trend](reserving.CapeCod.md#prospicio.reserving.CapeCod.trend) or [decay](reserving.CapeCod.md#prospicio.reserving.CapeCod.decay) is out of range, or if an origin has no observed, finite, positive exposure.
