reserving.CapeCod
The Cape Cod (Stanard–Bühlmann) method: Bornhuetter–Ferguson with each
Usage
reserving.CapeCod()origin’s apriori estimated from the triangle, as chainladder-python’s 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 periods away,
decay ** n; from 0 to 1. With 1 every origin shares one loss ratio. average: (volume, simple, regression, geometric) = "volume"-
How link ratios are averaged, as in ChainLadder.
sigma_interpolation: (log - linear, mack) = "log-linear"n_periods: optional-
As ChainLadder: average only the latest diagonals and leave out the highest and lowest link ratios at each age.
drop_high: optional-
As ChainLadder: average only the latest diagonals and leave out the highest and lowest link ratios at each age.
drop_low: optional-
As ChainLadder: average only the latest diagonals and leave out the highest and lowest link ratios at each age.
tail: (float, TailConstant, TailCurve, TailBondy or TailLogLinear)-
As ChainLadder; no tail by default.
ldf: optional-
A selected development pattern, as in ChainLadder: the development pattern’s factors at the ages it gives, so cdf and the share developed
1 / cdffollow it. ldf_kind: optional-
A selected development pattern, as in ChainLadder: the development pattern’s factors at the ages it gives, so cdf and the share developed
1 / cdffollow it. ldf_weight: optional-
A selected development pattern, as in ChainLadder: the development pattern’s factors at the ages it gives, so cdf and the share developed
1 / cdffollow it. ldf_origin: optional-
A selected development pattern, as in ChainLadder: the development pattern’s factors at the ages it gives, so cdf and the share developed
1 / cdffollow it. ldf_underwriting: optional-
A selected development pattern, as in ChainLadder: the development pattern’s factors at the ages it gives, so cdf and the share developed
1 / cdffollow it.
Examples
>>> 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 | How link ratios are averaged. |
| decay | Weight of an origin one period away. |
| drop_high | Highest link ratios left out at each age. |
| drop_low | Lowest link ratios left out at each age. |
| ldf |
The selected pattern by age, as given; None without one.
|
| ldf_kind |
How ldf is expressed: "ldf", "cdf" or
|
| ldf_origin | The origin grain ldf was measured on, averaged over the fitted |
| ldf_underwriting | The underwriting basis ldf is converted to at fit time |
| ldf_weight | The weight on the selected factors: a number, a dict by age, or |
| n_periods |
Number of latest diagonals averaged; None uses every link ratio.
|
| sigma_interpolation | How unestimable variance parameters are filled in. |
| tail | The tail: a constant factor as a number, otherwise its estimator. |
| 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
drop_high
Highest link ratios left out at each age.
drop_high: int
drop_low
Lowest link ratios left out at each age.
drop_low: int
ldf
The selected pattern by age, as given; None without one.
ldf: dict | None
ldf_kind
How ldf is expressed: "ldf", "cdf" or
ldf_kind: str | None
"percent_developed"; None without a pattern.
ldf_origin
The origin grain ldf was measured on, averaged over the fitted
ldf_origin: str | None
origins’ periods at fit time; None reads it at the origin’s age.
ldf_underwriting
The underwriting basis ldf is converted to at fit time
ldf_underwriting: UnderwritingBasis | None
(UnderwritingBasis), or None.
ldf_weight
The weight on the selected factors: a number, a dict by age, or
ldf_weight: Any | None
None without a pattern.
n_periods
Number of latest diagonals averaged; None uses every link ratio.
n_periods: int | None
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() | Fits one loss column in every segment of a triangle, each with its |
| fit_diagonal() | CapeCod on a latest diagonal with its exposure, in every |
fit()
Fits one loss column in every segment of a triangle, each with its
Usage
fit(triangle, column, exposure)own exposure and apriori. Trend runs to the triangle’s valuation.
Parameters
triangle: Trianglecolumn: 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, if trend or decay is out of range, or if an origin has no observed, finite, positive exposure.
fit_diagonal()
CapeCod on a latest diagonal with its exposure, in every
Usage
fit_diagonal(diagonal, development=None, segment_map=None)segment, as ChainLadder.fit_diagonal projects one: its apriori is estimated on the diagonal and trended to one valuation, the latest month any origin of any segment is valued at.
Parameters
diagonal: LatestDiagonal-
With an exposure per origin.
development: ChainLadderFit = None-
As ChainLadder.fit_diagonal; this method keeps its own trend and decay.
segment_map: dict = None- As ChainLadder.fit_diagonal.
Returns
CapeCodFit