pal.contracts module
Reinsurance contract modeling for excess of loss and tower structures.
Provides classes for modeling XoL (excess of loss) reinsurance contracts including individual layers and complete towers with aggregate limits, reinstatement premiums, franchise deductibles, and complex layering.
- class pal.contracts.ContractResults(recoveries, reinstatement_premium=None)[source]
Bases:
objectA class to hold the recoveries and reinstatement premiums.
This class stores the results of applying a reinsurance contract to a set of claims.
- __init__(recoveries, reinstatement_premium=None)[source]
Create a new contract results object.
- Parameters:
recoveries (
FreqSevSims) – Object representing the recoveries.reinstatement_premium (
StochasticScalar|None) – Optional Array representing the reinstatement premium.
- class pal.contracts.XoL(name, limit, excess, premium, reinstatement_cost=None, aggregate_limit=None, aggregate_deductible=None, franchise=None, reverse_franchise=None)[source]
Bases:
objectRepresents an excess of loss reinsurance contract.
- __init__(name, limit, excess, premium, reinstatement_cost=None, aggregate_limit=None, aggregate_deductible=None, franchise=None, reverse_franchise=None)[source]
Initialize a new XoL layer.
- Parameters:
name (
str) – The name of the XoL layer.limit (
float) – The limit of coverage.excess (
float) – The excess amount.premium (
float) – The premium amount.reinstatement_cost (
list[float] |None) – The reinstatement cost as a fraction of the base premium, by reinstatement. Defaults to None.aggregate_limit (
float|None) – The aggregate limit. Defaults to None.aggregate_deductible (
float|None) – The aggregate deductible. Defaults to None.franchise (
float|None) – The franchise amount. Defaults to None.reverse_franchise (
float|None) – The reverse franchise amount. Defaults to None.
- apply(claims)[source]
Apply the XoL contract to a set of claims.
- Parameters:
claims (
FreqSevSims) – The simulated claims to apply the contract to.- Returns:
The results of applying the contract.
- Return type:
Calculation of the recoveries from the excess of loss contract:
Firstly, the effect of any franchise or reverse franchise is calculated on the individual losses.
losses post franchise = loss if loss >= franchise and loss<= reverse franchise
Next the individual losses to the layer are calculated:
layer_loss = min(max(losses post franchise - excess, 0), limit)
Then the aggregate layer losses before aggregate limit and deductible are calculated. The aggregate limit and deductible are then applied to get the aggregate recoveries for the layer:
- aggregate_recoveries = min(
max(aggregate_layer_losses - aggregate_deductible, 0), aggregate_limit
)
The aggregate recoveries are then allocated back to the individual losses in proportion to the individual recoveries before aggregate limit and deductible.
The reinstatement premium is calculated as the sum of the reinstatement premium cost multiplied by the number of reinstatements used. The number of reinstatements used is calculated as the minimum of the aggregate recoveries divided by the limit and the number of reinstatements available (which is the aggregate limit divided by the occurrence limit, less one).
- calc_summary(gross_losses, aggregate_recoveries)[source]
Calculate a summary of the losses to the layer.
The results are stored in the summary attribute of the layer.
The summary includes the mean and standard deviation of the recoveries, the probability of attachment, the probability of vertical exhaustion and the probability of horizontal exhaustion.
- Parameters:
gross_losses (
FreqSevSims) – Object representing the gross losses.aggregate_recoveries (
StochasticScalar) – Array of aggregate recoveries.
- Returns:
None
- class pal.contracts.XoLTower(limit, excess, premium, name=None, reinstatement_cost=None, aggregate_deductible=None, aggregate_limit=None, franchise=None, reverse_franchise=None)[source]
Bases:
objectRepresents a tower of excess of loss reinsurance contracts.
- __init__(limit, excess, premium, name=None, reinstatement_cost=None, aggregate_deductible=None, aggregate_limit=None, franchise=None, reverse_franchise=None)[source]
Create an XoL Tower.
- Parameters:
name (
list[str] |None) – A list of names for each layer. Defaults to None.reinstatement_cost (
list[list[float] |None] |None) – A list of reinstatement costs for each reinstatement for each layer. Defaults to None.aggregate_deductible (
list[float|None] |None) – The aggregate deductible. Defaults to None.aggregate_limit (
list[float|None] |None) – The aggregate limit. Defaults to None.franchise (
list[float|None] |None) – The franchise amount. Defaults to None.reverse_franchise (
list[float|None] |None) – The reverse franchise amount. Defaults to None.
- apply(claims)[source]
Applies the XoL Tower to a set of claims.
- Parameters:
claims (
FreqSevSims) – The set of claims to apply the XoL Tower to.- Returns:
The results of applying the XoL Tower to the claims.
- Return type: