Development model configurations

ChainLadder

class ledger_analytics.ChainLadder(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)

ChainLadder.

This model implements, by default, Ledger’s Bayesian chain ladder model with the form:

\[\begin{split}y_{ij} &\sim \mathrm{Gamma(\mu_{ij}, \sigma_{ij}^2)}, \quad{\forall j \in (1, M]}\\ \mu_{ij} &= ATA_{j - 1} y_{ij-1}\\ \sigma_{ij}^2 &= \exp(\sigma_{\mathrm{int}} + \sigma_{\mathrm{noise}_{j}} + \sigma_{\mathrm{slope}} j + \log(y_{ij-1}))\\\end{split}\]

where \(y\) represents losses and M is the total number of development lags. The hierarchical variance parameter, \(\sigma_{\mathrm{noise}_{j}}\), can be removed by setting the use_linear_noise argument to True. See the model-specific documentation in the User Guide for more details.

The fit and predict configurations are controlled by Config and PredictConfig classes, respectively.

class Config(*, loss_family: ~typing.Annotated[~typing.Literal['Gamma', 'Lognormal', 'Normal', 'InverseGaussian'], ~pydantic.functional_validators.BeforeValidator(func=~ledger_analytics.config.<lambda>, json_schema_input_type=PydanticUndefined)] = 'Gamma', loss_definition: ~typing.Literal['paid', 'reported', 'incurred'] = 'paid', use_linear_noise: bool = False, recency_decay: str | float | None = None, line_of_business: str | None = None, priors: dict[str, list[float] | float] | None = None, informed_priors_version: str | None = None, use_multivariate: bool = False, autofit_override: dict[str, float | int | None] = None, sigma_volume: bool = False, prior_only: bool = False, seed: int | None = None)

ChainLadder model configuration class.

loss_family

the likelihood family to use. One of "Gamma", "Lognormal", "Normal" or "InverseGaussian". Defaults to "Gamma". See the LossFamily type hint class in ledger_analytics.config.

Type:

Literal[‘Gamma’, ‘Lognormal’, ‘Normal’, ‘InverseGaussian’]

loss_definition

the field to model in the triangle. One of "paid" "reported" or "incurred".

Type:

Literal[‘paid’, ‘reported’, ‘incurred’]

use_linear_noise

Set to True to turn off the hierarchical variance parameter in ChainLadder.

Type:

bool

recency_decay

geometric decay parameter to downweight earlier diagonals (see Modeling rationale… section in the User Guide). Defaults to 1.0 for no geometric decay. Can be "lookup" to choose based on line_of_business.

Type:

str | float | None

line_of_business

Line of business used to specify informed priors. Must be provided if informed_priors_version is not None.

Type:

str | None

priors

dictionary of priors. Defaults to None to use the default priors. See the DefaultPriors class for default (non line-of-business) priors.

Type:

dict[str, list[float] | float] | None

informed_priors_version

If line_of_business is set, the priors are based on Ledger Investing’s proprietary values derived from industry data. "latest" uses priors derived from the most recent industry data. Defaults to None.

Type:

str | None

use_multivariate

Boolean indicating whether to use a correlated prior on age-to-age factors. The correlated prior needs to be combined with industry-informed priors for best results.

Type:

bool

autofit_override

override the MCMC autofitting procedure arguments. See the documentation for a fully description of options in the User Guide.

Type:

dict[str, float | int | None]

sigma_volume

Boolean indicating whether to use a volume parameter in the variance function.

Type:

bool

prior_only

should a prior predictive simulation be run?

Type:

bool

seed

Seed to use for model sampling. Defaults to None, but it is highly recommended to set.

Type:

int | None

class DefaultPriors(value)

Default priors for ChainLadder.

ata__loc

the location of the ATA priors, either a float or a list of floats, one for each ATA parameter.

Type:

float | list[float]

class PredictConfig(*, max_dev_lag: int | None = None, include_process_risk: bool = True)

ChainLadder predict configuration class.

max_dev_lag

the maximum development lag to predict to. Defaults to the maximum in the training data.

Type:

int | None

include_process_risk

should process risk or aleatoric uncertainty be included in the predictions. Defaults to True. If False, predictions are based on the mean function, only.

Type:

bool

TraditionalChainLadder

class ledger_analytics.TraditionalChainLadder(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)

TraditionalChainLadder.

This model implements, by default, a traditional chain ladder model fit with maximum likelihood estimation with the form:

\[\begin{split}y_{ij} &\sim \mathrm{Normal(\mu_{ij}, \sigma_{ij}^2)}, \quad{\forall j \in (1, M]}\\ \mu_{ij} &= ATA_{j - 1} y_{ij-1}\\ \sigma_{ij}^2 &= \sigma^2 y_{ij-1}\end{split}\]

where \(y\) represents losses. The variance term implements volume-weighted averaging by weighting by the previous loss amount, but this can be turned off in the configuration. See the model-specific documentation in the User Guide for more details.

The fit and predict configurations are controlled by Config and PredictConfig classes, respectively.

class Config(*, loss_definition: Literal['paid', 'reported', 'incurred'] = 'paid', use_volume_weighting: bool = True, recency_decay: str | float | None = None, line_of_business: str | None = None, autofit_override: dict[str, float | int | None] = None, prior_only: bool = False)

TraditionalChainLadder model configuration class.

loss_definition

the field to model in the triangle. One of "paid" "reported" or "incurred".

Type:

Literal[‘paid’, ‘reported’, ‘incurred’]

use_volume_weighting

whether to compute ATA factors as volume-weighted averages of observed link ratios, as opposed to straight averages.

Type:

bool

recency_decay

geometric decay parameter to down-weight earlier diagonals (see Modeling rationale… section in the User Guide). Defaults to 1.0 for no geometric decay. Can be "lookup" to choose based on line_of_business.

Type:

str | float | None

line_of_business

Line of business used for decay weighting. Must be provided if recency_decay is "lookup". These weights are derived from historical industry data and are current proprietary.

Type:

str | None

autofit_override

override the MCMC autofitting procedure arguments. See the documentation

Type:

dict[str, float | int | None]

prior_only

should a prior predictive simulation be run?

Type:

bool

class DefaultPriors(value)

Default priors for TraditionalChainLadder.

Attributes:

class PredictConfig(*, max_dev_lag: int | None = None, include_process_risk: bool = True)

TraditionalChainLadder predict configuration class.

max_dev_lag

the maximum development lag to predict to. Defaults to the maximum in the training data.

Type:

int | None

include_process_risk

should process risk or aleatoric uncertainty be included in the predictions. Defaults to True. If False, predictions are based on the mean function, only.

Type:

bool

ManualATA

class ledger_analytics.ManualATA(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)

ManualAta.

This model is different from other loss development models in that it uses hard-coded age-to-age factors, rather than estimating them from the data.

\[\begin{split}y_{ij} &= \mu_{ij}\\ \mu_{ij} &= ATA_{j - 1} y_{ij-1}\\ \bf{ATA} &= \text{user input}\end{split}\]

The primary intended use case of this model is for supporting workflows where age-to-age factors are selected or adjusted by hand, or age-to-age factors are provided by a bureau or other external source without any supporting data behind them.

See the model-specific documentation in the User Guide for more details.

The fit and predict configurations are controlled by Config and PredictConfig classes, respectively.

class Config(*, loss_definition: Literal['paid', 'reported', 'incurred'] = 'paid', ata_factors: list[float], development_resolution: int = 12, development_offset: int = 0)

ManualAta model configuration class.

loss_definition

the field to model in the triangle. One of "paid" "reported" or "incurred".

Type:

Literal[‘paid’, ‘reported’, ‘incurred’]

ata_factors

a list of age-to-age development factors. If development_resolution is 3 and development_offset is 6, then the first factor in the list should be a 6-to-9 month ATA, the second factor should be a 9-to-12 month ATA, and so forth.

Type:

list[float]

development_resolution

the number of months between development lags of successive development factors.

Type:

int

development_offset

the development lag (in months) of the first development factor provided.

Type:

int

class DefaultPriors(value)
class PredictConfig(*, max_dev_lag: int | None = None)

TraditionalChainLadder predict configuration class.

max_dev_lag

the maximum development lag to predict to.

Type:

int | None

MeyersCRC

class ledger_analytics.MeyersCRC(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)

Bayesian MeyersCRC.

This model implements the MeyersCRC model from Glenn Meyer’s 2019 monograph:

  • Meyers (2019). Stochastic loss reserving using Bayesian MCMC models (2nd edition).

    Casualty Actuarial Society.

The model has the form:

\[\begin{split}y_{ij} &\sim \mathrm{Gamma}(\mu_{ij}, \sigma_{ij}^2) \quad{\forall j \in (1, M]}\\ \mu_{ij} &= \exp(\mathrm{LR}_{\text{expected}} + \beta_{\text{lag},j} + \beta_{\text{year},i})\\ \sigma_{ij}^2 &= \exp(\sigma_{\text{int}} + \sigma_{\text{slope}} j - \log(\mathrm{EP}_{i}))\\\end{split}\]

where \(y\) is loss ratio. See the model-specific documentation and Glenn Meyer’s monograph in the User Guide for more details.

The fit and predict configurations are controlled by Config and PredictConfig classes, respectively.

class Config(*, loss_family: ~typing.Annotated[~typing.Literal['Gamma', 'Lognormal', 'Normal', 'InverseGaussian'], ~pydantic.functional_validators.BeforeValidator(func=~ledger_analytics.config.<lambda>, json_schema_input_type=PydanticUndefined)] = 'Gamma', loss_definition: ~typing.Literal['paid', 'reported', 'incurred'] = 'paid', recency_decay: str | float | None = None, priors: dict[str, list[float] | float] | None = None, autofit_override: dict[str, float | int | None] = None, prior_only: bool = False, seed: int | None = None)

MeyersCRC model configuration class.

loss_family

the likelihood family to use. One of "Gamma", "Lognormal", "Normal" or "InverseGaussian". Defaults to "Gamma". See the LossFamily type hint class in ledger_analytics.config.

Type:

Literal[‘Gamma’, ‘Lognormal’, ‘Normal’, ‘InverseGaussian’]

loss_definition

the field to model in the triangle. One of "paid" "reported" or "incurred".

Type:

Literal[‘paid’, ‘reported’, ‘incurred’]

recency_decay

geometric decay parameter to downweight earlier diagonals (see Modeling rationale… section in the User Guide). Defaults to 1.0 for no geometric decay. Can be "lookup" to choose based on line_of_business.

Type:

str | float | None

priors

dictionary of priors. Defaults to None to use the default priors. See the DefaultPriors class for default (non line-of-business) priors.

Type:

dict[str, list[float] | float] | None

autofit_override

override the MCMC autofitting procedure arguments. See the documentation for a fully description of options in the User Guide.

Type:

dict[str, float | int | None]

prior_only

should a prior predictive simulation be run?

Type:

bool

seed

Seed to use for model sampling. Defaults to None, but it is highly recommended to set.

Type:

int | None

class DefaultPriors(value)

Default priors for MeyersCRC.

Attributes:

class PredictConfig(*, max_dev_lag: int | None = None, include_process_risk: bool = True)

MeyersCRC predict configuration class.

max_dev_lag

the maximum development lag to predict to. Defaults to the maximum in the training data.

Type:

int | None

include_process_risk

should process risk or aleatoric uncertainty be included in the predictions. Defaults to True. If False, predictions are based on the mean function, only.

Type:

bool

GMCL

class ledger_analytics.GMCL(id: str, name: str, model_type: str, config: dict[str, Any] | None, model_class: str, endpoint: str, requester: Requester, asynchronous: bool = False)

GMCL.

This model implements, by default, a Bayesian (generalized) multivariate chain ladder model with or without intercepts. The multivariate chain ladder models paid and reported jointly, which we implement by assuming the log-scale age-to-age factors for paid and reported losses are multivariate normal. The generalized version of the model extends this to assuming the residual variances are also correlated between paid and reported losses. Finally, the addition of intercepts allows for cases where the regression of losses at development lag j + 1 on losses at lag j does not intersect the origin.

The generalized version of the model has the form:

\[\begin{split}y_{ijd} &\sim \text{Gamma}(\mu_{ijd}, \sigma_{jd}^2), \quad \forall j\in (1, M], d \in \{1,2\} \\ \mu_{ijd} &= \beta_{\text{int},d} + ATA_{j - 1, d} \cdot y_{ij-1, d}\\ \log \mathbf{ATA}_{(1:M-1) \times 2} &\sim \text{MVN}(\mathbf{ATA}_{\text{loc}}, \boldsymbol{\Sigma}_{\text{ATA}}) \\ \log \boldsymbol{\sigma}_{(1:M-1) \times 2} &\sim \text{MVN}(\boldsymbol{\sigma_{\text{loc}}}, \boldsymbol{\Sigma}_{\sigma})\end{split}\]

where \(y\) represents losses. See the model-specific documentation in the User Guide for more details.

The fit and predict configurations are controlled by Config and PredictConfig classes, respectively.

class Config(*, loss_family: ~typing.Annotated[~typing.Literal['Gamma', 'Lognormal', 'Normal', 'InverseGaussian'], ~pydantic.functional_validators.BeforeValidator(func=~ledger_analytics.config.<lambda>, json_schema_input_type=PydanticUndefined)] = 'Gamma', is_general: bool = False, include_intercepts: bool = False, recency_decay: str | float | None = None, priors: dict[str, list[float] | float] | None = None, autofit_override: dict[str, float | int | None] = None, prior_only: bool = False, seed: int | None = None)

GMCL model configuration class.

loss_family

the likelihood family to use. One of "Gamma", "Lognormal", "Normal" or "InverseGaussian". Defaults to "Gamma". See the LossFamily type hint class in ledger_analytics.config.

Type:

Literal[‘Gamma’, ‘Lognormal’, ‘Normal’, ‘InverseGaussian’]

is_general

should the general MCL model be used?

Type:

bool

include_intercepts

should intercepts be included in the mean function?

Type:

bool

recency_decay

geometric decay parameter to downweight earlier diagonals (see Modeling rationale… section in the User Guide). Defaults to 1.0 for no geometric decay. Can be "lookup" to choose based on line_of_business.

Type:

str | float | None

priors

dictionary of priors. Defaults to None to use the default priors. See the DefaultPriors class for default (non line-of-business) priors.

Type:

dict[str, list[float] | float] | None

autofit_override

override the MCMC autofitting procedure arguments. See the documentation for a fully description of options in the User Guide.

Type:

dict[str, float | int | None]

prior_only

should a prior predictive simulation be run?

Type:

bool

seed

Seed to use for model sampling. Defaults to None, but it is highly recommended to set.

Type:

int | None

class DefaultPriors(value)

Default priors for GMCL.

ata__loc

the location of the ATA priors, either a float or a list of floats, one for each ATA parameter.

Type:

float | list[float]

class PredictConfig(*, max_dev_lag: int | None = None, include_process_risk: bool = True)

GMCL predict configuration class.

max_dev_lag

the maximum development lag to predict to.

Type:

int | None

include_process_risk

should process risk or aleatoric uncertainty be included in the predictions. Defaults to True. If False, predictions are based on the mean function, only.

Type:

bool