## reserving.DiscountedReserves


A fit's unpaid claims discounted simulation by simulation, from a fit's


Usage

``` python
reserving.DiscountedReserves()
```


[discounted](reserving.MackFit.md#prospicio.reserving.MackFit.discounted) method (`docs/design/reserving-ifrs17.md`).

Each simulation's unpaid (the reserves on the paid basis; the reserves plus each origin's case reserve on the incurred basis) is spread over that simulation's development pattern (the rises of its running maximum after each origin's latest age), timed at the middle or end of each development period and discounted on the curve; `Compartmental` is paid by its simulated paid cells instead. Quantiles of the discounted total are read from the discounted draws, never by scaling undiscounted quantiles.


## Examples

``` python
>>> from prospicio.reserving import MackBootstrap, Triangle
>>> tri = Triangle.from_long(
...     [2019] * 4 + [2020] * 3 + [2021] * 2 + [2022],
...     [12, 24, 36, 48, 12, 24, 36, 12, 24, 12],
...     {"paid": [100.0, 150, 170, 175, 110, 160, 185, 120, 185, 130]},
... )
>>> fit = MackBootstrap(n_sims=1000, seed=1).fit(tri, "paid")
>>> d = fit.discounted(basis="paid", rate=0.03)
>>> d.best_estimate < d.unpaid.mean()
```

True

``` python
>>> ra = d.risk_adjustment("confidence", 0.75)
>>> ra.implied_confidence >= 0.75
```

True


## Attributes

| Name | Description |
|----|----|
| [best_estimate](#best_estimate) | The best estimate: the mean discounted total. |
| [curve](#curve) | The curve the unpaid claims were discounted on. |
| [discount_factors](#discount_factors) | Each component's mean present value over its mean unpaid, in the |
| [discounted](#discounted) | The present value of each draw of [unpaid](reserving.UlaeEstimate.md#prospicio.reserving.UlaeEstimate.unpaid): the same components |
| [runoff](#runoff) | The best estimate outstanding at `t = 0, 1, 2, ...` whole years from |
| [segment_labels](#segment_labels) | Each segment's label as a list of key values, for a fit over |
| [timing](#timing) | When in each development period the payments fall: `"mid"` or |
| [unpaid](#unpaid) | The unpaid claims, undiscounted: the fit's reserves on the paid |

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


#### best_estimate


The best estimate: the mean discounted total.


`best_estimate: float`


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


#### curve


The curve the unpaid claims were discounted on.


`curve: DiscountCurve`


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


#### discount_factors


Each component's mean present value over its mean unpaid, in the


`discount_factors: list[float]`


order of the components; 1 where the mean unpaid is 0.


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


#### discounted


The present value of each draw of [unpaid](reserving.UlaeEstimate.md#prospicio.reserving.UlaeEstimate.unpaid): the same components


`discounted: PredictiveDistribution`


and simulations.


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


#### runoff


The best estimate outstanding at `t = 0, 1, 2, ...` whole years from


`runoff: list[float]`


the valuation date, valued at [t](distributions.Pareto.md#prospicio.distributions.Pareto.t), ending with 0 at the first whole year after the last payment. `runoff[0]` is the best estimate.


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


#### segment_labels


Each segment's label as a list of key values, for a fit over


`segment_labels: list[list[str]]`


segments; empty for a fit of one segment.


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


#### timing


When in each development period the payments fall: `"mid"` or


`timing: str`


`"end"`.


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


#### unpaid


The unpaid claims, undiscounted: the fit's reserves on the paid


`unpaid: PredictiveDistribution`


basis, the reserves plus each origin's case reserve on the incurred basis. The same components and simulations as the fit's [reserves](reserving.ApcGlmFit.md#prospicio.reserving.ApcGlmFit.reserves).


## Methods

| Name | Description |
|----|----|
| [risk_adjustment()](#risk_adjustment) | The risk adjustment on the discounted total `X`, whose mean is the |
| [segment_runoff()](#segment_runoff) | Segment `i`'s run-off, as [runoff](reserving.DiscountedReserves.md#prospicio.reserving.DiscountedReserves.runoff), in the order of |

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


#### risk_adjustment()


The risk adjustment on the discounted total `X`, whose mean is the


Usage

``` python
risk_adjustment(method, p=None, *, rate=None, capital=None, charge="end")
```


best estimate `BE`, with the confidence level it corresponds to (IFRS 17 para. 119), and for a fit over segments each segment's stand-alone one (not an allocation of the total).


##### Parameters


`method: (confidence, tvar, cost_of_capital) = ``"confidence"`  
`"confidence"`: `Q_p(X) - BE`, the inverted-cdf quantile. `"tvar"`: `TVaR_p(X) - BE`. `"cost_of_capital"`: [rate](pricing.CasualtyProfile.md#prospicio.pricing.CasualtyProfile.rate) times the capital held in each future year, discounted, the capital running off with the best estimate: `K_t = K_0 runoff[t] / runoff[0]`.

`p: float = None`  
The level of `"confidence"` and `"tvar"`, in `[0, 1]`.

`rate: float = None`  
The cost-of-capital rate, for `"cost_of_capital"`.

`capital: float or tuple = None`  
`K_0` for `"cost_of_capital"` (no default): a pair `("var", q)` (`Q_q(X) - BE`) or `("tvar", q)`, or an amount (a float or `("amount", k)`), such as the one-year view's capital, `cdr.mean() - cdr.quantile(0.005)` (the 99.5% loss less the expected loss). An amount is the total's, so no segment results are reported for it.

`charge: (end, start) = ``"end"`  
Charge each year's capital at its end, `rate sum K_t v(t + 1)` (Solvency II's risk margin), or its start, `rate sum K_t v(t)` ([price_over_payout](pricing.price_over_payout.md#prospicio.pricing.price_over_payout)).


##### Returns


`RiskAdjustmentResult`  


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


#### segment_runoff()


Segment `i`'s run-off, as [runoff](reserving.DiscountedReserves.md#prospicio.reserving.DiscountedReserves.runoff), in the order of


Usage

``` python
segment_runoff(i)
```


[segment_labels](reserving.DiscountedReserves.md#prospicio.reserving.DiscountedReserves.segment_labels).


##### Parameters


`i: int`  


##### Returns


`list of float`
