## methods.ReserveResult


What a reserving method returns: pyarrow Tables with fixed column types.


Usage

``` python
methods.ReserveResult(
    method,
    as_of,
    dev_grain_months,
    origins,
    development,
    link_ratios,
    totals,
    cells=None,
    coefficients=None
)
```


A missing number is an Arrow null, never NaN. `to_polars(name)` gives any of the tables as a polars DataFrame.


## Attributes


`method: str`  
The function that made it, such as `"chain_ladder"`.

`as_of: datetime.date`  
The information date, the evaluation date of the latest cell, which is the last day of a period (the accident year 1988 at 12 months is 1988-12-31).

`dev_grain_months: int`  
Months per development step.

`origins: pyarrow.Table`  
One row per origin period: `origin` (the caller's label for the period, the value written in the cells' `origin_period` column, as an Arrow int64 for integer years of any width, string for text labels of any string or dictionary type, date32 for dates, or the input's own timestamp type, time zone included, for timestamps), `origin_period` (date32, always the first day of the period), `latest_dev_lag` (int64, months), [latest](kernels.MackFit.md#ibnr.kernels.MackFit.latest), [ultimate](kernels.MackFit.md#ibnr.kernels.MackFit.ultimate) and `ibnr` (float64; `ibnr` is `ultimate - latest`). Bornhuetter-Ferguson, Benktander and Cape Cod add `expected_loss_ratio`, the loss ratio applied to the origin's premium; Cape Cod also adds `trended_loss_ratio` (the loss ratio at the valuation date's level, chainladder-python's `apriori_`) and `trend_factor` (1.0 at `trend=0`); Mack adds `mack_se` and its two parts, `parameter_se` and `process_se`. With a tail the ultimates, reserves and standard errors include it, the oldest origin's too. An origin whose latest cumulative is zero keeps 0 as its latest amount, so its chain-ladder ultimate is 0 and, under Mack with `zero_cells="missing"`, its `mack_se` is 0 too; chainladder-python leaves both missing.

`development: pyarrow.Table`  
One row per observed development age, and with a tail `tail_rows` more for the ages after the last observed one: `dev_lag` (int64), `factor` (the factor from this row to the next, null on the final row), [cdf](kernels.TweedieFit.md#ibnr.kernels.TweedieFit.cdf) (the factor to ultimate, float64) and `pct_reported` (`1 / cdf`). Without a tail [cdf](kernels.TweedieFit.md#ibnr.kernels.TweedieFit.cdf) runs to the last observed age, so `pct_reported` is 1.0 there by construction rather than by measurement. With one it includes the tail, and on the final row it is what is left of the tail after the rows shown, so the factors from any row times the final row's [cdf](kernels.TweedieFit.md#ibnr.kernels.TweedieFit.cdf) are that row's [cdf](kernels.TweedieFit.md#ibnr.kernels.TweedieFit.cdf). `source` (string) is `"link_ratios"` for a factor averaged from link ratios and `"tail"` for one from the tail (an attached age, or a row beyond the triangle), null at the last age without a tail; `curve_factor` (float64) is a fitted curve's factor at each row but the final one; `in_tail_fit` (bool) says whether the curve was fitted through that age's factor, null from the last observed age on. Every method but [tweedie_glm()](methods.tweedie_glm.md#ibnr.methods.tweedie_glm) and [ml_development()](methods.ml_development.md#ibnr.methods.ml_development) adds `n_selected` (int64, the link ratios selected at that age; on an age whose `source` is `"tail"` the factor is the tail's, not their average), `extreme_trimming_skipped` and `bounds_skipped` (bool); the chain ladder, Bornhuetter-Ferguson, Benktander and Cape Cod add `unity_fallback` (bool); Mack adds `sigma`, `std_err` (the factor's standard error) and `sigma_extrapolated` (bool), all null at the last observed age and beyond it. The module docstring has the table of every column and the methods that carry it. [tweedie_glm()](methods.tweedie_glm.md#ibnr.methods.tweedie_glm) adds `n_observed` (int64) and [ml_development()](methods.ml_development.md#ibnr.methods.ml_development) `n_trained` (int64) and `unity_fallback`; both have none of the tail columns, and fit a pattern that can differ by origin, where `factor`, [cdf](kernels.TweedieFit.md#ibnr.kernels.TweedieFit.cdf) and `pct_reported` are null and each origin's are in `cells`.

`link_ratios: pyarrow.Table or None`  
Every observed link ratio, one row each: `origin` and `origin_period` (as in `origins`), `from_dev_lag` (int64, the age the ratio develops from), `previous` and `following` (float64, the cumulatives at that age and the next), `ratio` (float64, `following / previous`, null when `previous` is 0), `included` (bool, whether the factor used it) and `reason` (string: `included`, `zero_cell` (a zero at either end, left out under `zero_cells="missing"`), `undefined_ratio` (`previous` is 0, under `zero_cells="observed"`), `history_window`, `explicit_exclusion`, `valuation_exclusion`, `drop_above`, `drop_below`, `drop_low` or `drop_high`: the first rule that left it out, in the order the rules run). Mack's is the chain ladder's for the same options; under `zero_cells="observed"` with no development option every observed link ratio is `included`, a ratio out of a zero too (null, with its following amount in the volume sum), as R's `MackChainLadder` reads it. Every link-ratio method returns this table; `None` for [tweedie_glm()](methods.tweedie_glm.md#ibnr.methods.tweedie_glm) and [ml_development()](methods.ml_development.md#ibnr.methods.ml_development), which fit the cells rather than link ratios, and for a result built by hand.

`totals: pyarrow.Table`  
One row with [latest](kernels.MackFit.md#ibnr.kernels.MackFit.latest), [ultimate](kernels.MackFit.md#ibnr.kernels.MackFit.ultimate) and `ibnr` summed over the origins, and `tail_factor` (float64), the development beyond the last observed age: 1.0 without a tail, the constant itself for a constant tail attached at the last age, and what is left of it after the attached ages for one attached earlier (chainladder-python's `tail_`). Mack adds `mack_se`, `parameter_se` and `process_se` for the total, which is not the sum of the origins' standard errors: the origins share the estimated factors; and `tail_sigma`, `tail_std_err` (the tail step's sigma and the tail factor's standard error) and `tail_position` (where the tail sits on the link axis, link 1 developing from the first age), all float64 and null without a tail, `tail_position` also when `tail_sigma` and `tail_std_err` were both given or the tail factor is exactly 1. [tweedie_glm()](methods.tweedie_glm.md#ibnr.methods.tweedie_glm) and [ml_development()](methods.ml_development.md#ibnr.methods.ml_development) add the columns their docstrings list.

`cells: pyarrow.Table or None`  
One row per cell of the full rectangle, observed or not, from a method that fits a model to the cells ([tweedie_glm()](methods.tweedie_glm.md#ibnr.methods.tweedie_glm), [ml_development()](methods.ml_development.md#ibnr.methods.ml_development)); `None` for the others. Its columns are listed in each of those functions.

`coefficients: pyarrow.Table or None`  
One row per term of a fitted model ([tweedie_glm()](methods.tweedie_glm.md#ibnr.methods.tweedie_glm)); `None` for the others.


## Methods

| Name | Description |
|----|----|
| [to_polars()](#to_polars) | One of the result's tables as a polars DataFrame. |

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


#### to_polars()


One of the result's tables as a polars DataFrame.


Usage

``` python
to_polars(table="origins")
```


`table` is `"origins"` (the default), `"development"`, `"link_ratios"`, `"totals"`, `"cells"` or `"coefficients"`; a table the result does not carry is refused. Needs polars, which the `polars` extra installs: `pip install "ibnr[polars]"`.
