The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Package {NetSimR}


Type: Package
Title: Non-Life Actuarial Pricing, Reserving, Reinsurance and Capital
Version: 0.4.0
Description: Actuarial methods for pricing, reserving, reinsurance and capital in non-life insurance, with six 'shiny' tools that run them without writing code, and that also run in a web browser, without installing R, on the package's website. Pricing: a Tweedie family for generalised linear models of the loss cost, rate reviews with on-level premiums, the indicated rate change and Buhlmann-Straub credibility, and the simulation of claims from frequency and severity distributions with Pareto tails. Reserving: the chain ladder with Mack's standard errors and tail factors, the Bornhuetter-Ferguson, Benktander and Cape Cod methods, a bootstrap of the reserves, the one-year view of Merz and Wuthrich, the Munich chain ladder of paid and incurred claims, the growth curves of Clark (2003), a chain ladder for claims inflation, and actual against expected development. 'IFRS' 17 and 'Solvency II': the discounting of reserves, the risk adjustment, and the standard formula's non-life premium and reserve risk. Reinsurance: excess of loss pricing with the burning cost, a Pareto model of the large losses and exposure rating with the MBBEFD curves of Bernegger (1997) <doi:10.2143/AST.27.1.563208> or a claim size distribution, the technical premium with reinstatements, and the comparison of reinsurance programmes by their cost and the capital they save. Capital: portfolios of several lines joined by a Gaussian or t copula, with value at risk, tail value at risk and capital allocation. Severity: capped means, exposure curves and increased limit factors for LogNormal, Gamma, Pareto, sliced LogNormal-Pareto and sliced Gamma-Pareto distributions, the density, distribution and quantile functions of the sliced distributions, and pure incurred but not reported (IBNR) exposure from a LogNormal or Gamma reporting delay. The tools are a claims simulator with reinsurance structures, and tools for fitting claim frequency and severity distributions, fitting generalised linear models with rate tables, claims reserving, reinsurance pricing and portfolio capital; each writes a report. Methods used in the package refer to Free for All by Yiannis Parizas (2023) https://www.theactuary.com/2023/03/02/free-all; Escaping the triangle by Yiannis Parizas (2019) https://www.theactuary.com/features/2019/06/2019/06/05/escaping-triangle; Taken to excess by Yiannis Parizas (2019) https://www.theactuary.com/features/2019/03/2019/03/06/taken-excess.
License: GPL-3
Copyright: file inst/COPYRIGHTS
URL: https://netsimr.netsimanalytics.com/, https://github.com/NetSimAnalytics/NetSimR
BugReports: https://github.com/NetSimAnalytics/NetSimR/issues
Encoding: UTF-8
Language: en-GB
Depends: R (≥ 4.1.0)
Imports: shiny (≥ 1.8.1), bslib (≥ 0.9.0), parallel, methods, splines, stats, utils, graphics, grDevices
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0), shinytest2, chromote, pkgload, htmltools, jsonlite, DBI, RODBC, RPostgres, RSQLite, glmnet, readxl, writexl
VignetteBuilder: knitr
LazyData: true
Config/testthat/edition: 3
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-12-02 22:24:35 UTC; yiann
Author: Yiannis Parizas ORCID iD [aut, cre], The Inter Project Authors [cph] (The Inter font, in inst/fonts), The JetBrains Mono Project Authors [cph] (The JetBrains Mono font, in inst/fonts)
Maintainer: Yiannis Parizas <yiannis.parizas@gmail.com>
Repository: CRAN
Date/Publication: 2026-12-03 14:00:09 UTC

NetSimR: Non-Life Actuarial Pricing, Reserving, Reinsurance and Capital

Description

The NetSimR package provides eight categories of functions:

  1. Capped means, Exposure and ILF curves from various severity distributions, and the special functions behind them

  2. Pure IBNR and UPR earned periods

  3. Sliced distributions

  4. Frequency-severity claims simulation, applying a reinsurance layer to simulated claims, and portfolios of lines joined by a copula

  5. Claims reserving: chain ladder with Mack's standard errors, Bornhuetter-Ferguson, Benktander, Cape Cod, a bootstrap, Clark's growth curves and a chain ladder for claims inflation; IFRS 17 discounting and risk adjustment, and the Solvency II standard formula's premium and reserve risk

  6. Pricing models: a Tweedie family for generalised linear models, and rate reviews: on-level premiums, the indicated rate change and Buhlmann-Straub credibility

  7. Excess of loss pricing: burning cost, Pareto rating, exposure rating with MBBEFD curves, and the technical premium

  8. Shiny apps for simulating claims, fitting distributions, fitting GLMs, reserving, reinsurance pricing and portfolio capital

NetSimR special functions

IGamma erf

NetSimR mean functions

SlicedGammaParetoMean SlicedLNormParetoMean

NetSimR capped mean functions

GammaCappedMean LNormCappedMean ParetoCappedMean ParetoCappedMeanCalc SlicedGammaParetoCappedMean SlicedLNormParetoCappedMean

NetSimR exposure curve functions

ExposureCurveGamma ExposureCurveLNorm ExposureCurvePareto ExposureCurveSlicedGammaPareto ExposureCurveSlicedLNormPareto

NetSimR ILF curve functions

ILFGamma ILFLNorm ILFPareto ILFSlicedGammaPareto ILFSlicedLNormPareto

NetSimR pure IBNR functions

PureIBNRGamma PureIBNRLNorm

NetSimR Sliced distribution functions

dSlicedGammaPareto dSlicedLNormPareto pSlicedGammaPareto pSlicedLNormPareto qSlicedGammaPareto qSlicedLNormPareto

NetSimR claims simulation functions

simulate_claims simulate_function simulate_portfolio apply_deductible_limit

NetSimR reserving functions

chain_ladder bornhuetter_ferguson cape_cod bootstrap_chain_ladder merz_wuthrich munich_chain_ladder actual_vs_expected clark_growth inflation_adjusted_chain_ladder as_triangle

NetSimR pricing model functions

tweedie_family

NetSimR reinsurance pricing functions

burning_cost pareto_rating property_exposure_rating casualty_exposure_rating mbbefd_curve technical_premium credibility_weight

Function names

The older functions have CamelCase names (ParetoCappedMean); each also has a snake_case name, the same function, as the newer functions are named (pareto_capped_mean). Both work.

NetSimR Shiny apps

run_shiny_simulator run_shiny_distribution_fitting_tool run_shiny_glm_fitting_tool run_shiny_reserving_tool run_shiny_reinsurance_pricing_tool run_shiny_portfolio_tool

Author(s)

Maintainer: Yiannis Parizas yiannis.parizas@gmail.com (ORCID)

Authors:

Other contributors:

See Also

Useful links:


Exposure Curve from a Gamma severity distribution

Description

Gives the share of the expected claim cost of a Gamma severity distribution that falls below the amount x (the capped mean divided by the mean), as used to exposure rate a layer.

Usage

ExposureCurveGamma(x, shape, rate)

exposure_curve_gamma(x, shape, rate)

Arguments

x

A non-negative real number - the claim amount where the exposure curve will be evaluated.

shape

A positive real number - the shape parameter of the Claim Severity's Gamma distribution.

rate

A positive real number - the rate parameter of the Claim Severity's Gamma distribution.

Value

The value of the Exposure curve at x with Claim Severity from a Gamma distribution with parameters shape and rate. The arguments are recycled to a common length. A non-numeric argument, a negative x or a non-positive shape or rate is an error; NA values give NA.

See Also

Other exposure curve functions: ExposureCurveLNorm(), ExposureCurvePareto(), ExposureCurveSlicedGammaPareto(), ExposureCurveSlicedLNormPareto()

Examples

ExposureCurveGamma(700,1,0.0005)
ExposureCurveGamma(1000,1.5,0.0006)

Exposure Curve from a LogNormal severity distribution

Description

Gives the share of the expected claim cost of a LogNormal severity distribution that falls below the amount x (the capped mean divided by the mean), as used to exposure rate a layer.

Usage

ExposureCurveLNorm(x, mu, sigma)

exposure_curve_lnorm(x, mu, sigma)

Arguments

x

A non-negative real number - the claim amount where the exposure curve will be evaluated.

mu

A real number - the first parameter of the Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the Claim Severity's LogNormal distribution.

Value

The value of the Exposure curve at x with Claim Severity from a LogNormal distribution with parameters mu and sigma. An infinite x gives 1. The arguments are recycled to a common length. A non-numeric argument, a negative x or a non-positive sigma is an error; NA values give NA.

See Also

Other exposure curve functions: ExposureCurveGamma(), ExposureCurvePareto(), ExposureCurveSlicedGammaPareto(), ExposureCurveSlicedLNormPareto()

Examples

ExposureCurveLNorm(2000,6,1.5)
ExposureCurveLNorm(1000,5,1.6)

Exposure Curve from a Pareto severity distribution

Description

Gives the share of the expected claim cost of a Pareto severity distribution that falls below the amount x (the capped mean divided by the mean), as used to exposure rate a layer.

Usage

ExposureCurvePareto(x, scale, shape)

exposure_curve_pareto(x, scale, shape)

Arguments

x

A non-negative real number - the claim amount where the exposure curve will be evaluated.

scale

A positive real number - the scale parameter of the Claim Severity's Pareto distribution.

shape

A positive real number - the shape parameter of the Claim Severity's Pareto distribution.

Value

The value of the Exposure curve at x with Claim Severity from a Pareto distribution with parameters scale and shape. The exposure curve divides by the mean, which is infinite when shape <= 1; the function returns 0 in that case.

See Also

Other exposure curve functions: ExposureCurveGamma(), ExposureCurveLNorm(), ExposureCurveSlicedGammaPareto(), ExposureCurveSlicedLNormPareto()

Examples

ExposureCurvePareto(700,500,1.2)
ExposureCurvePareto(20000,200,1.1)

Exposure Curve from a Sliced Gamma Pareto severity distribution

Description

Gives the share of the expected claim cost of a sliced Gamma-Pareto severity distribution that falls below the amount x (the capped mean divided by the mean), as used to exposure rate a layer.

Usage

ExposureCurveSlicedGammaPareto(x, GShape, GRate, SlicePoint, PShape)

exposure_curve_sliced_gamma_pareto(x, GShape, GRate, SlicePoint, PShape)

Arguments

x

A non-negative real number - the claim amount where the exposure curve will be evaluated.

GShape

A positive real number - the shape parameter of the Claim Severity's Gamma distribution.

GRate

A positive real number - the rate parameter of the Claim Severity's Gamma distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the Claim Severity's Pareto distribution. An infinite slice point gives the Gamma distribution.

PShape

A positive real number - the shape parameter of the Claim Severity's Pareto distribution.

Details

PShape is the Pareto shape parameter, usually written alpha; the sliced LogNormal-Pareto functions call the same parameter shape.

Value

The value of the Exposure curve at x with an attritional claim Gamma distribution with parameters GShape and GRate and a large claim Pareto distribution with parameters SlicePoint and PShape. The exposure curve divides by the mean, which is infinite when PShape <= 1 (and SlicePoint is finite); the function returns 0 in that case.

See Also

Other exposure curve functions: ExposureCurveGamma(), ExposureCurveLNorm(), ExposureCurvePareto(), ExposureCurveSlicedLNormPareto()

Examples

ExposureCurveSlicedGammaPareto(3000,1,0.0005,1000,1.2)
ExposureCurveSlicedGammaPareto(1000,1.1,0.0006,2000,1.6)
ExposureCurveSlicedGammaPareto(2000,1.2,0.0004,3000,1.4)

Exposure Curve from a Sliced LogNormal Pareto severity distribution

Description

Gives the share of the expected claim cost of a sliced LogNormal-Pareto severity distribution that falls below the amount x (the capped mean divided by the mean), as used to exposure rate a layer.

Usage

ExposureCurveSlicedLNormPareto(x, mu, sigma, SlicePoint, shape)

exposure_curve_sliced_lnorm_pareto(x, mu, sigma, SlicePoint, shape)

Arguments

x

A non-negative real number - the claim amount where the exposure curve will be evaluated.

mu

A real number - the first parameter of the attritional Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the attritional Claim Severity's LogNormal distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the LogNormal distribution.

shape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

shape is the Pareto shape parameter, usually written alpha; the sliced Gamma-Pareto functions call the same parameter PShape.

Value

The value of the Exposure curve at x with an attritional claim LogNormal distribution with parameters mu and sigma and a large claim Pareto distribution with parameters SlicePoint and shape. The exposure curve divides by the mean, which is infinite when shape <= 1 (and SlicePoint is finite); the function returns 0 in that case.

See Also

Other exposure curve functions: ExposureCurveGamma(), ExposureCurveLNorm(), ExposureCurvePareto(), ExposureCurveSlicedGammaPareto()

Examples

ExposureCurveSlicedLNormPareto(1200,6,1.5,1000,1.2)
ExposureCurveSlicedLNormPareto(4000,7,1.6,3000,1.4)

Server function for the GLM Fitting tool application

Description

Runs a session of the GLM fitting tool: imports the data, fits the models, compares the stored ones, draws the actual against predicted chart and saves and loads the settings.

Usage

GLMFittingToolServer(input, output, session)

Arguments

input

Input for the server function.

output

Output for the server function.

session

Session for the server function.

Value

Called by shiny for its side effects, the outputs and observers of a session; the value is not used.


User interface of the Shiny GLM fitting tool

Description

Builds the pages of the GLM fitting tool: Welcome, Data, Model, Actual vs predicted, Validation and Save & load, with the theme switch.

Usage

GLMFittingToolUI(request)

Arguments

request

The request, supplied by shiny.

Details

A function of the request, so that it is built when the app starts, after every helper of the package is defined.

Value

The user interface of the application, a bslib navbar page.


Gamma capped mean

Description

Gives the expected claim amount when each claim from a Gamma severity distribution is capped at cap, as needed to price a policy limit or a reinsurance layer.

Usage

GammaCappedMean(cap, shape, rate)

gamma_capped_mean(cap, shape, rate)

Arguments

cap

A non-negative real number - the claim severity cap.

shape

A positive real number - the shape parameter of the Claim Severity's Gamma distribution.

rate

A positive real number - the rate parameter of the Claim Severity's Gamma distribution.

Value

The mean of the claim severity capped at cap with a Gamma distribution with parameters shape and rate. The arguments are recycled to a common length. A non-numeric argument, a negative cap or a non-positive shape or rate is an error; NA values give NA.

See Also

Other capped mean functions: LNormCappedMean(), ParetoCappedMean(), ParetoCappedMeanCalc(), SlicedGammaParetoCappedMean(), SlicedLNormParetoCappedMean()

Examples

GammaCappedMean(700,1,0.0005)
GammaCappedMean(1000,1.5,0.0006)

Upper incomplete gamma function

Description

Evaluates the upper incomplete gamma function, the integral of t^(a - 1) * exp(-t) from x to infinity, which appears in the closed form of the Gamma capped mean.

Usage

IGamma(a, x)

upper_incomplete_gamma(a, x)

Arguments

a

A positive real number - the shape parameter.

x

A non-negative real number.

Value

The value of the upper incomplete gamma function at x with shape parameter a, i.e. gamma(a) * pgamma(x, a, lower.tail = FALSE). The arguments are recycled to a common length. A non-numeric or non-positive a or a negative x is an error.

See Also

GammaCappedMean

Examples

IGamma(1,1)
IGamma(0.1,2)

Increased Limit Factor Curve from a Gamma severity distribution

Description

Gives the ratio of the Gamma capped mean at xHigh to that at xLow, the factor that takes the expected cost of a policy limit of xLow to that of a limit of xHigh.

Usage

ILFGamma(xLow, xHigh, shape, rate)

ilf_gamma(xLow, xHigh, shape, rate)

Arguments

xLow

A non-negative real number - the claim amount where the Increased Limit Factor Curve will be evaluated from.

xHigh

A non-negative real number - the claim amount where the Increased Limit Factor Curve will be evaluated to.

shape

A positive real number - the shape parameter of the Claim Severity's Gamma distribution.

rate

A positive real number - the rate parameter of the Claim Severity's Gamma distribution.

Value

The value of the Increased Limit Factor curve from xLow to xHigh with Claim Severity from a Gamma distribution with parameters shape and rate.

See Also

Other ILF functions: ILFLNorm(), ILFPareto(), ILFSlicedGammaPareto(), ILFSlicedLNormPareto()

Examples

ILFGamma(700,1000,1,0.0005)
ILFGamma(1000,1200,1.5,0.0006)

Increased Limit Factor Curve from a LogNormal severity distribution

Description

Gives the ratio of the LogNormal capped mean at xHigh to that at xLow, the factor that takes the expected cost of a policy limit of xLow to that of a limit of xHigh.

Usage

ILFLNorm(xLow, xHigh, mu, sigma)

ilf_lnorm(xLow, xHigh, mu, sigma)

Arguments

xLow

A non-negative real number - the claim amount where the Increased Limit Factor Curve will be evaluated from.

xHigh

A non-negative real number - the claim amount where the Increased Limit Factor Curve will be evaluated to.

mu

A real number - the first parameter of the Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the Claim Severity's LogNormal distribution.

Value

The value of the Increased Limit Factor curve from xLow to xHigh with Claim Severity from a LogNormal distribution with parameters mu and sigma.

See Also

Other ILF functions: ILFGamma(), ILFPareto(), ILFSlicedGammaPareto(), ILFSlicedLNormPareto()

Examples

ILFLNorm(1000,2000,6,1.5)
ILFLNorm(1000,1500,5,1.6)

Increased Limit Factor Curve from a Pareto severity distribution

Description

Gives the ratio of the Pareto capped mean at xHigh to that at xLow, the factor that takes the expected cost of a policy limit of xLow to that of a limit of xHigh.

Usage

ILFPareto(xLow, xHigh, scale, shape)

ilf_pareto(xLow, xHigh, scale, shape)

Arguments

xLow

A non-negative real number - the claim amount where the Increased Limit Factor Curve will be evaluated from.

xHigh

A non-negative real number - the claim amount where the Increased Limit Factor Curve will be evaluated to.

scale

A positive real number - the scale parameter of the Claim Severity's Pareto distribution.

shape

A positive real number - the shape parameter of the Claim Severity's Pareto distribution.

Value

The value of the Increased Limit Factor curve from xLow to xHigh with Claim Severity from a Pareto distribution with parameters scale and shape.

See Also

Other ILF functions: ILFGamma(), ILFLNorm(), ILFSlicedGammaPareto(), ILFSlicedLNormPareto()

Examples

ILFPareto(700,1200,500,1.2)
ILFPareto(1200,20000,200,1.1)

Increased Limit Factor Curve from a Sliced Gamma Pareto severity distribution

Description

Gives the ratio of the sliced Gamma-Pareto capped mean at xHigh to that at xLow, the factor that takes the expected cost of a policy limit of xLow to that of a limit of xHigh.

Usage

ILFSlicedGammaPareto(xLow, xHigh, GShape, GRate, SlicePoint, PShape)

ilf_sliced_gamma_pareto(xLow, xHigh, GShape, GRate, SlicePoint, PShape)

Arguments

xLow

A non-negative real number - the claim amount where the Limit Factor Curve will be evaluated from.

xHigh

A non-negative real number - the claim amount where the Limit Factor Curve will be evaluated to.

GShape

A positive real number - the shape parameter of the attritional Claim Severity's Gamma distribution.

GRate

A positive real number - the rate parameter of the attritional Claim Severity's Gamma distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the Gamma distribution.

PShape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

PShape is the Pareto shape parameter, usually written alpha; the sliced LogNormal-Pareto functions call the same parameter shape.

Value

The value of the Increased Limit Factor curve from xLow to xHigh with an attritional claim Gamma distribution with parameters GShape and GRate and a large claim Pareto distribution with parameters SlicePoint and PShape.

See Also

Other ILF functions: ILFGamma(), ILFLNorm(), ILFPareto(), ILFSlicedLNormPareto()

Examples

ILFSlicedGammaPareto(2000,3000,1,0.0005,1000,1.2)
ILFSlicedGammaPareto(800,1000,1.1,0.0006,2000,1.6)
ILFSlicedGammaPareto(1200,2000,1.2,0.0004,3000,1.4)

Increased Limit Factor Curve from a Sliced LogNormal Pareto severity distribution

Description

Gives the ratio of the sliced LogNormal-Pareto capped mean at xHigh to that at xLow, the factor that takes the expected cost of a policy limit of xLow to that of a limit of xHigh.

Usage

ILFSlicedLNormPareto(xLow, xHigh, mu, sigma, SlicePoint, shape)

ilf_sliced_lnorm_pareto(xLow, xHigh, mu, sigma, SlicePoint, shape)

Arguments

xLow

A non-negative real number - the claim amount where the Limit Factor Curve will be evaluated from.

xHigh

A non-negative real number - the claim amount where the Limit Factor Curve will be evaluated to.

mu

A real number - the first parameter of the attritional Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the attritional Claim Severity's LogNormal distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the LogNormal distribution.

shape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

shape is the Pareto shape parameter, usually written alpha; the sliced Gamma-Pareto functions call the same parameter PShape.

Value

The value of the Increased Limit Factor curve from xLow to xHigh with an attritional claim LogNormal distribution with parameters mu and sigma and a large claim Pareto distribution with parameters SlicePoint and shape.

See Also

Other ILF functions: ILFGamma(), ILFLNorm(), ILFPareto(), ILFSlicedGammaPareto()

Examples

ILFSlicedLNormPareto(800,1200,6,1.5,1000,1.2)
ILFSlicedLNormPareto(2000,4000,7,1.6,3000,1.4)

Lognormal capped mean

Description

Gives the expected claim amount when each claim from a LogNormal severity distribution is capped at cap, as needed to price a policy limit or a reinsurance layer.

Usage

LNormCappedMean(cap, mu, sigma)

lnorm_capped_mean(cap, mu, sigma)

Arguments

cap

A non-negative real number - the claim severity cap.

mu

A real number - the first parameter of the Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the Claim Severity's LogNormal distribution.

Value

The mean of the claim severity capped at cap with a LogNormal distribution with parameters mu and sigma. The arguments are recycled to a common length. A non-numeric argument, a negative cap or a non-positive sigma is an error; NA values give NA.

See Also

Other capped mean functions: GammaCappedMean(), ParetoCappedMean(), ParetoCappedMeanCalc(), SlicedGammaParetoCappedMean(), SlicedLNormParetoCappedMean()

Examples

LNormCappedMean(2000,6,1.5)
LNormCappedMean(1000,5,1.6)

Pareto capped mean

Description

Gives the expected claim amount when each claim from a Pareto severity distribution is capped at cap, as needed to price a policy limit or a reinsurance layer.

Usage

ParetoCappedMean(cap, scale, shape)

pareto_capped_mean(cap, scale, shape)

Arguments

cap

A non-negative real number - the claim severity cap.

scale

A positive real number - the scale parameter of the Claim Severity's Pareto distribution.

shape

A positive real number - the shape parameter of the Claim Severity's Pareto distribution.

Value

The mean of the claim severity capped at cap with a Pareto distribution with parameters scale and shape. A cap at or below scale is returned unchanged, as no claim is smaller than scale. The arguments are recycled to a common length. A non-numeric argument, a negative cap or a non-positive scale or shape is an error; NA values give NA.

See Also

Other capped mean functions: GammaCappedMean(), LNormCappedMean(), ParetoCappedMeanCalc(), SlicedGammaParetoCappedMean(), SlicedLNormParetoCappedMean()

Examples

ParetoCappedMean(600,200,1.2)
ParetoCappedMean(800,100,1)
ParetoCappedMean(1000,500,0.8)
ParetoCappedMean(50,100,2)

Pareto capped mean intermediary calculation

Description

Evaluates the closed-form expression (shape * scale - cap * (scale / cap)^shape) / (shape - 1) that the Pareto capped mean is built on, for checking or reusing the intermediate step.

Usage

ParetoCappedMeanCalc(cap, scale, shape)

pareto_capped_mean_calc(cap, scale, shape)

Arguments

cap

A non-negative real number - the claim severity cap.

scale

A positive real number - the scale parameter of the Claim Severity's Pareto distribution.

shape

A positive real number - the shape parameter of the Claim Severity's Pareto distribution.

Value

An interim calculation for the mean of the claim severity capped at cap with a Pareto distribution with parameters scale and shape. It is the closed form for cap >= scale and shape != 1; use ParetoCappedMean for the capped mean itself. The arguments are recycled to a common length.

See Also

Other capped mean functions: GammaCappedMean(), LNormCappedMean(), ParetoCappedMean(), SlicedGammaParetoCappedMean(), SlicedLNormParetoCappedMean()

Examples

ParetoCappedMeanCalc(800,100,1.1)
ParetoCappedMeanCalc(1000,500,0.9)

Pure IBNR exposure from a Gamma reporting delay distribution

Description

Gives the unearned and pure IBNR exposure of each policy period at a valuation date, from a Gamma reporting delay, as needed to reserve for claims that have occurred but have not yet been reported.

Usage

PureIBNRGamma(IncDate, ExpDate, ValDate, shape, rate)

pure_ibnr_gamma(IncDate, ExpDate, ValDate, shape, rate)

Arguments

IncDate

A Date or POSIXct vector - the inception dates of the periods. Numbers and character strings are not accepted; convert them with as.Date() first.

ExpDate

A Date or POSIXct vector - the expiry dates of the periods. Must not be before the inception dates.

ValDate

A Date or POSIXct date - the valuation date.

shape

A positive real number - the shape parameter of the reporting delay's Gamma distribution, with the delay measured in days.

rate

A positive real number - the rate parameter (per day) of the reporting delay's Gamma distribution.

Details

Durations are counted in days on each date's own calendar and clock: a POSIXct time of day counts as a fraction of a day, and daylight saving changes do not add fractions of a day, so Date and POSIXct dates (or a mix of them) give the same results.

Value

A data frame with the unearned and pure IBNR exposure of each period in days (UnearnedDuration, and PureIBNRDuration rounded to 2 decimals) and as proportions between 0 and 1 of the period's duration (UnearnedDurationRatio and PureIBNRDurationRatio, rounded to 5 decimals), where the reporting delay has a Gamma distribution with parameters shape and rate. The ratios are computed before the durations are rounded. A period of zero length (ExpDate equal to IncDate) gives ratios of 0. The dates and parameters are recycled to a common length, one row each; lengths that do not recycle are an error.

See Also

Other pure IBNR functions: PureIBNRLNorm()

Examples

Dates = data.frame(
    inceptionDate = c("01/01/2006", "01/07/2006", "01/01/2007")
    ,expiryDate = c("31/12/2006", "30/06/2007", "31/12/2007")
)

Dates$inceptionDate<-as.POSIXct(Dates$inceptionDate, format="%d/%m/%Y")

Dates$expiryDate<-as.POSIXct(Dates$expiryDate, format="%d/%m/%Y")

ValuationDate<-as.POSIXct("30/10/2007", format="%d/%m/%Y")

PureIBNRGamma(Dates$inceptionDate,Dates$expiryDate,ValuationDate,7,0.15)

Pure IBNR exposure from a LogNormal reporting delay distribution

Description

Gives the unearned and pure IBNR exposure of each policy period at a valuation date, from a LogNormal reporting delay, as needed to reserve for claims that have occurred but have not yet been reported.

Usage

PureIBNRLNorm(IncDate, ExpDate, ValDate, mu, sigma)

pure_ibnr_lnorm(IncDate, ExpDate, ValDate, mu, sigma)

Arguments

IncDate

A Date or POSIXct vector - the inception dates of the periods. Numbers and character strings are not accepted; convert them with as.Date() first.

ExpDate

A Date or POSIXct vector - the expiry dates of the periods. Must not be before the inception dates.

ValDate

A Date or POSIXct date - the valuation date.

mu

A real number - the first parameter of the reporting delay's LogNormal distribution, with the delay measured in days.

sigma

A positive real number - the second parameter of the reporting delay's LogNormal distribution.

Details

Durations are counted in days on each date's own calendar and clock: a POSIXct time of day counts as a fraction of a day, and daylight saving changes do not add fractions of a day, so Date and POSIXct dates (or a mix of them) give the same results.

Value

A data frame with the unearned and pure IBNR exposure of each period in days (UnearnedDuration, and PureIBNRDuration rounded to 2 decimals) and as proportions between 0 and 1 of the period's duration (UnearnedDurationRatio and PureIBNRDurationRatio, rounded to 5 decimals), where the reporting delay has a LogNormal distribution with parameters mu and sigma. The ratios are computed before the durations are rounded. A period of zero length (ExpDate equal to IncDate) gives ratios of 0. The dates and parameters are recycled to a common length, one row each; lengths that do not recycle are an error.

See Also

Other pure IBNR functions: PureIBNRGamma()

Examples

Dates = data.frame(
    inceptionDate = c("01/01/2006", "01/07/2006", "01/01/2007")
    ,expiryDate = c("31/12/2006", "30/06/2007", "31/12/2007")
)

Dates$inceptionDate<-as.POSIXct(Dates$inceptionDate, format="%d/%m/%Y")

Dates$expiryDate<-as.POSIXct(Dates$expiryDate, format="%d/%m/%Y")

ValuationDate<-as.POSIXct("30/10/2007", format="%d/%m/%Y")

PureIBNRLNorm(Dates$inceptionDate,Dates$expiryDate,ValuationDate,4,1.5)

Sliced Gamma Pareto capped mean

Description

Gives the expected claim amount when each claim from a sliced severity distribution, with Gamma attritional claims below the slice point and a Pareto tail above it, is capped at cap.

Usage

SlicedGammaParetoCappedMean(cap, GShape, GRate, SlicePoint, PShape)

sliced_gamma_pareto_capped_mean(cap, GShape, GRate, SlicePoint, PShape)

Arguments

cap

A non-negative real number - the claim severity cap.

GShape

A positive real number - the shape parameter of the attritional Claim Severity's Gamma distribution.

GRate

A positive real number - the rate parameter of the attritional Claim Severity's Gamma distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the Gamma distribution.

PShape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

PShape is the Pareto shape parameter, usually written alpha; the sliced LogNormal-Pareto functions call the same parameter shape.

Value

The mean of the claim severity capped at cap with an attritional claim Gamma distribution with parameters GShape and GRate and a large claim Pareto distribution with parameters SlicePoint and PShape. A non-numeric argument, a negative cap or a non-positive parameter is an error; NA values give NA.

See Also

Other capped mean functions: GammaCappedMean(), LNormCappedMean(), ParetoCappedMean(), ParetoCappedMeanCalc(), SlicedLNormParetoCappedMean()

Examples

SlicedGammaParetoCappedMean(3000,1,0.0005,1000,1.2)
SlicedGammaParetoCappedMean(1000,1.1,0.0006,2000,1.6)
SlicedGammaParetoCappedMean(2000,1.2,0.0004,3000,1.4)

Sliced Gamma Pareto mean

Description

Gives the expected claim amount of a sliced severity distribution, with Gamma attritional claims below the slice point and a Pareto tail above it.

Usage

SlicedGammaParetoMean(GShape, GRate, SlicePoint, PShape)

sliced_gamma_pareto_mean(GShape, GRate, SlicePoint, PShape)

Arguments

GShape

A positive real number - the shape parameter of the attritional Claim Severity's Gamma distribution.

GRate

A positive real number - the rate parameter of the attritional Claim Severity's Gamma distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the Gamma distribution.

PShape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

PShape is the Pareto shape parameter, usually written alpha; the sliced LogNormal-Pareto functions call the same parameter shape.

Value

The mean of the claim severity with an attritional claim Gamma distribution with parameters GShape and GRate and a large claim Pareto distribution with parameters SlicePoint and PShape. The mean is Inf when PShape <= 1 (and SlicePoint is finite), as the Pareto tail then has no finite mean. A non-numeric or non-positive parameter is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedLNormParetoMean(), dSlicedGammaPareto(), dSlicedLNormPareto(), pSlicedGammaPareto(), pSlicedLNormPareto(), qSlicedGammaPareto(), qSlicedLNormPareto()

Examples

SlicedGammaParetoMean(1,0.0005,1000,1.2)
SlicedGammaParetoMean(1.1,0.0006,2000,1.6)
SlicedGammaParetoMean(1.2,0.0004,3000,1.4)

Sliced LogNormal Pareto capped mean

Description

Gives the expected claim amount when each claim from a sliced severity distribution, with LogNormal attritional claims below the slice point and a Pareto tail above it, is capped at cap.

Usage

SlicedLNormParetoCappedMean(cap, mu, sigma, SlicePoint, shape)

sliced_lnorm_pareto_capped_mean(cap, mu, sigma, SlicePoint, shape)

Arguments

cap

A non-negative real number - the claim severity cap.

mu

A real number - the first parameter of the attritional Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the attritional Claim Severity's LogNormal distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the LogNormal distribution.

shape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

shape is the Pareto shape parameter, usually written alpha; the sliced Gamma-Pareto functions call the same parameter PShape.

Value

The mean of the claim severity capped at cap with an attritional claim LogNormal distribution with parameters mu and sigma and a large claim Pareto distribution with parameters SlicePoint and shape. A non-numeric argument, a negative cap or a non-positive sigma, SlicePoint or shape is an error; NA values give NA.

See Also

Other capped mean functions: GammaCappedMean(), LNormCappedMean(), ParetoCappedMean(), ParetoCappedMeanCalc(), SlicedGammaParetoCappedMean()

Examples

SlicedLNormParetoCappedMean(1200,6,1.5,1000,1.2)
SlicedLNormParetoCappedMean(2500,6.5,1.4,2000,1.6)
SlicedLNormParetoCappedMean(4000,7,1.6,3000,1.4)

Sliced LogNormal Pareto mean

Description

Gives the expected claim amount of a sliced severity distribution, with LogNormal attritional claims below the slice point and a Pareto tail above it.

Usage

SlicedLNormParetoMean(mu, sigma, SlicePoint, shape)

sliced_lnorm_pareto_mean(mu, sigma, SlicePoint, shape)

Arguments

mu

A real number - the first parameter of the attritional Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the attritional Claim Severity's LogNormal distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the LogNormal distribution.

shape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

shape is the Pareto shape parameter, usually written alpha; the sliced Gamma-Pareto functions call the same parameter PShape.

Value

The mean of the claim severity with an attritional claim LogNormal distribution with parameters mu and sigma and a large claim Pareto distribution with parameters SlicePoint and shape. The mean is Inf when shape <= 1 (and SlicePoint is finite), as the Pareto tail then has no finite mean. A non-numeric argument or a non-positive sigma, SlicePoint or shape is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedGammaParetoMean(), dSlicedGammaPareto(), dSlicedLNormPareto(), pSlicedGammaPareto(), pSlicedLNormPareto(), qSlicedGammaPareto(), qSlicedLNormPareto()

Examples

SlicedLNormParetoMean(6,1.5,1000,1.2)
SlicedLNormParetoMean(6.5,1.4,2000,1.6)
SlicedLNormParetoMean(7,1.6,3000,1.4)

Actual against expected development

Description

Checks the chain ladder against the claims of the latest calendar period: the chain ladder of the triangle without its latest diagonal predicts how much each origin develops in that period, which is compared with what was reported.

Usage

actual_vs_expected(triangle, ...)

Arguments

triangle

A triangle of cumulative claims, as for chain_ladder.

...

Arguments passed to chain_ladder() for the earlier triangle, such as average or periods.

Details

The triangle without its latest diagonal (each origin's latest value left out) gives development factors f_k and Mack's \sigma_k and factor standard errors. An origin with C claims at its previous age k was expected to develop by C (f_k - 1), with a standard error \sqrt{C^{2 - \alpha} \sigma_k^2 + C^2 se(f_k)^2} (process and parameter error, \alpha as in chain_ladder). The standardised difference (actual less expected, over its standard error) shows which origins moved more than the method allows for: beyond about 2 in either direction is worth a look. The total's standard error adds that the origins at the same age share a factor. An origin that has a single value, or whose previous age has no development factor in the earlier triangle (the oldest origin, at the end of the triangle), has no expected development and is left out of the total.

Value

An object of class netsimr_reserve: a list with by_origin, a data frame with each origin's claims at its previous age, the expected and the actual development, their difference, the ratio of actual to expected, the standard error of the expected development and the standardised difference; total, the same for all origins; and chain_ladder, the chain ladder of the earlier triangle.

See Also

chain_ladder; merz_wuthrich for the uncertainty of the next period's development.

Examples

ave <- actual_vs_expected(raa_triangle)
ave
ave$by_origin[, c("origin", "expected", "actual", "z")]

Apply a deductible and limit to claims

Description

Works out what a reinsurance structure cedes (or, for an excluded layer, leaves) of each claim, for pricing a layer or checking the simulator's figures by hand.

Usage

apply_deductible_limit(
  gross_claims_data,
  reinsurance_structure,
  deductible,
  limit
)

Arguments

gross_claims_data

A vector of Claims.

reinsurance_structure

The chosen reinsurance structure, a single string. Options are: 'No Reinsurance Structure', 'Unlimited Layer', 'Limited Layer', 'Exclude Layer'; anything else is an error.

deductible

The deductible of the reinsurance structure, zero or more. Not used by 'No Reinsurance Structure'.

limit

The limit of the reinsurance structure, zero or more. Used only by 'Limited Layer' and 'Exclude Layer'.

Value

A vector with one value per claim: for 'Unlimited Layer' and 'Limited Layer', the amount ceded to the layer; for 'Exclude Layer', the claims with the layer taken out (the claims less what a 'Limited Layer' with the same deductible and limit would cede); for 'No Reinsurance Structure', the claims unchanged. Stops with an error when a deductible or limit the structure uses is negative.

Examples

apply_deductible_limit(c(100, 50, 20), 'Limited Layer', 40, 20)
apply_deductible_limit(c(100, 50, 20), 'Limited Layer', 10, 30)
apply_deductible_limit(c(100, 50, 20), 'Exclude Layer', 40, 20)

Build a claims triangle from a table

Description

Makes the triangle of cumulative claims that the reserving functions take, from a table with a row per origin and development period (such as payments by accident year and development year), or from a table with a row per origin and a column per development period.

Usage

as_triangle(
  data,
  origin = "origin",
  development = "development",
  value = "value",
  cumulative = TRUE
)

Arguments

data

A data frame: in the long form with origin, development and value columns; in the wide form with a row per origin and a column per development period (and the origin in the column named by origin, or in the row names).

origin, development, value

The names of the origin, development period and value columns of the long form. For the wide form, give development = NULL and value = NULL, and origin the name of the origin column or NULL for the row names.

cumulative

TRUE (the default) if the values are cumulative, FALSE if they are incremental.

Details

In the long form, the origin and development periods are each sorted and taken to be consecutive: the development periods can be numbered (1, 2, ...) or ages (12, 24, ... months). Incremental values of the same origin and development period are added up, so claim transactions can be given as they are; a cell of the past with no value is then zero. The past is every cell on or before the latest calendar diagonal in the data. Cumulative values must have one value per cell of the past.

In the wide form, the values of each origin run from the first development period, with NA (or empty) for the future.

Value

A numeric matrix of cumulative claims, one row per origin and one column per development period, with NA for the future.

Examples

head(simulated_motor_claims)
as_triangle(simulated_motor_claims, "accident_year", "development_year", "paid", cumulative = FALSE)

Bootstrap of the chain ladder reserves

Description

Simulates the distribution of the reserves with England and Verrall's bootstrap of the over-dispersed Poisson chain ladder: resampling its residuals for the estimation error, then simulating each future payment for the process error.

Usage

bootstrap_chain_ladder(
  triangle,
  n = 1000,
  process = c("gamma", "odp"),
  tail = 1,
  probs = c(0.75, 0.9, 0.95, 0.99, 0.995),
  seed = NULL
)

Arguments

triangle

A triangle of cumulative claims, as for chain_ladder.

n

The number of simulations.

process

The distribution of the future increments: "gamma" (the default) or "odp", the over-dispersed Poisson.

tail

A tail factor applied to each simulated ultimate (1, the default, for none).

probs

The probabilities of the percentiles reported.

seed

A whole number for a reproducible run, or NULL (the default) to use the current random number stream. The stream of the R session is restored after a run with a seed.

Details

The volume-weighted chain ladder factors of the whole triangle give fitted incremental claims m_{ij}, working back from the latest diagonal. The Pearson residuals (X_{ij} - m_{ij}) / \sqrt{|m_{ij}|} give the scale parameter \phi, their sum of squares over N - p (N incremental values and p parameters, one per origin and one per development period less one), and, scaled by \sqrt{N / (N - p)}, the residuals that are resampled; the residuals that are zero by construction (an origin with one value, a development period with one origin) are left out of the sampling. Each simulation builds a pseudo triangle m_{ij} + r^*_{ij} \sqrt{|m_{ij}|}, refits the chain ladder to it and projects its latest diagonal, then draws each future increment from a gamma or over-dispersed Poisson distribution with that mean and variance \phi times it. A tail factor scales each simulated ultimate.

Value

An object of class netsimr_bootstrap, a list with:

by_origin

a data frame with each origin's latest claims, mean ultimate, mean IBNR, its standard deviation and coefficient of variation, and the percentiles of the IBNR;

total

the same for the total;

reserves

the simulated IBNR, a matrix with a row per simulation and a column per origin;

total_reserves

the simulated total IBNR;

residuals, fitted, scale, factors

the scaled Pearson residuals, the fitted incremental claims, \phi and the chain ladder factors.

References

England, P. D. and Verrall, R. J. (1999). Analytic and bootstrap estimates of prediction errors in claims reserving. Insurance: Mathematics and Economics 25(3), 281-293.

England, P. D. and Verrall, R. J. (2002). Stochastic claims reserving in general insurance. British Actuarial Journal 8(3), 443-518.

Examples

boot <- bootstrap_chain_ladder(raa_triangle, n = 1000, seed = 1)
boot$total
hist(boot$total_reserves, main = "Total IBNR", xlab = NULL)

Bornhuetter-Ferguson and Benktander reserves

Description

Reserves from an a priori expected loss ratio: the latest claims plus the share of the expected ultimate still to emerge, by the chain ladder's development pattern.

Usage

bornhuetter_ferguson(triangle, premium, loss_ratio, iterations = 1, ...)

Arguments

triangle

A triangle of cumulative claims, as for chain_ladder, or the result of chain_ladder(), whose development pattern is then used.

premium

The premium (or other exposure) of each origin.

loss_ratio

The a priori expected loss ratio: one for all origins or one for each, as a share of the premium (0.7 for 70%).

iterations

1 (the default) for Bornhuetter-Ferguson, 2 for Benktander.

...

Arguments passed to chain_ladder() for the development pattern, such as average and tail, when triangle is a triangle.

Details

With p_i = 1 / CDF_i the share developed of origin i (the inverse of its chain ladder cumulative development factor, with the tail) and U_0 = P_i \times LR_i the a priori ultimate, each iteration gives U_{k} = C_i + (1 - p_i) U_{k-1}. One iteration is the Bornhuetter-Ferguson method, two the Benktander (iterated Bornhuetter-Ferguson) method, and as the iterations increase the ultimate tends to the chain ladder's.

Value

An object of class netsimr_reserve: a list with by_origin, a data frame with the latest claims, premium, a priori loss ratio, share developed, a priori ultimate, ultimate, IBNR and ultimate loss ratio of each origin, total, the same for all origins together, and chain_ladder, the development pattern.

References

Bornhuetter, R. L. and Ferguson, R. E. (1972). The actuary and IBNR. Proceedings of the Casualty Actuarial Society 59, 181-195.

Mack, T. (2000). Credible claims reserves: the Benktander method. ASTIN Bulletin 30(2), 333-347.

See Also

cape_cod, which estimates the loss ratio from the triangle, and chain_ladder.

Examples

premium <- c(50000, 52000, 54000, 56000, 58000, 60000, 62000, 64000, 66000, 68000)
bornhuetter_ferguson(raa_triangle, premium, loss_ratio = 0.35)

# Benktander, with the chain ladder of simple averages
cl <- chain_ladder(raa_triangle, average = "simple")
bornhuetter_ferguson(cl, premium, loss_ratio = 0.35, iterations = 2)$total

Buhlmann-Straub credibility

Description

The credibility estimates of the risk of several groups (schemes, fleets, regions, ...) from their experience over several periods, each weighted by its volume: each group's own mean, shrunk towards the collective by its credibility.

Usage

buhlmann_straub(value, weight, group)

Arguments

value

The value of each group and period.

weight

The weight of each value.

group

The group of each value.

Details

With X_{ij} the value (such as a loss ratio or a claim frequency) of group i in period j and w_{ij} its weight (premium, exposure), w_i = \sum_j w_{ij}, \bar X_i the weighted mean of the group and \bar X of all, the within-group variance is estimated by

s^2 = \frac{\sum_i \sum_j w_{ij} (X_{ij} - \bar X_i)^2}{\sum_i (n_i - 1)}

and the variance between the groups by

a = \frac{\sum_i w_i (\bar X_i - \bar X)^2 - (I - 1) s^2}{w - \sum_i w_i^2 / w},

with w = \sum_i w_i. A group's credibility is Z_i = w_i / (w_i + s^2 / a) (0 for all when a \le 0: the groups do not differ more than chance), the collective mean \hat\mu = \sum_i Z_i \bar X_i / \sum_i Z_i (the weighted mean when every Z is 0), and its estimate \hat\mu + Z_i (\bar X_i - \hat\mu).

Value

A list with by_group (each group's weight, number of periods, mean, credibility and estimate), the collective mean, the within and between variances (s2, a) and k = s^2 / a.

References

Buhlmann, H. and Straub, E. (1970). Glaubwurdigkeit fur Schadensatze. Mitteilungen der Vereinigung Schweizerischer Versicherungsmathematiker 70, 111-133.

See Also

credibility_weight, limited fluctuation credibility.

Examples

set.seed(1)
schemes <- data.frame(scheme = rep(c("A", "B", "C", "D"), each = 5),
                      premium = round(runif(20, 1e5, 1e6)))
true <- c(A = 0.55, B = 0.65, C = 0.70, D = 0.80)[schemes$scheme]
schemes$loss_ratio <- rgamma(20, shape = schemes$premium / 2e4, rate = schemes$premium / 2e4 / true)
buhlmann_straub(schemes$loss_ratio, schemes$premium, schemes$scheme)$by_group

Burning cost of an excess of loss layer

Description

Experience rating of a layer of limit excess of deductible: the past large losses are brought to the money of the rating year, put through the layer as if it had been in force, developed to ultimate and divided by the premium of their year, brought to the rating year's rates.

Usage

burning_cost(
  losses,
  premium,
  deductible,
  limit,
  aggregate_deductible = 0,
  aggregate_limit = Inf,
  inflation = 0,
  rating_year = NULL,
  development = 1,
  premium_index = 1,
  threshold = NULL,
  exclude = NULL,
  weights = c("premium", "equal"),
  rating_premium = NULL
)

Arguments

losses

A data frame of the large losses with the columns year and amount (in the money of their year); other columns, such as a claim number, are kept.

premium

The subject premium of each year: a data frame with the columns year and premium, or numbers named by year. Its years are those of the experience; a year without losses has none in the layer.

deductible, limit

The layer, limit (or Inf) excess of deductible, for each loss.

aggregate_deductible, aggregate_limit

The annual aggregate deductible and limit of the layer's losses; the aggregate limit is often the limit times one plus the number of reinstatements.

inflation

An annual rate (0.05 for 5%) or index values named by year, including the rating year.

rating_year

The year being priced; by default the year after the last.

development

One factor for all years, one per year, or factors named by year, applied to each year's layer losses. Defaults to 1.

premium_index

The factor that brings each year's premium to the rating year's rates and exposure, as development. Defaults to 1.

threshold

The reporting threshold of the losses, used for the warning; NULL (the default) for none.

exclude

Years left out of the burning cost (they are still shown).

weights

"premium" (the default) for the total layer losses over the total on-level premium, or "equal" for the mean of the years' burning costs.

rating_premium

The subject premium of the rating year; the expected layer loss is the burning cost times it. NULL (the default) gives no expected loss.

Details

Each loss is indexed to the rating year with inflation, and its part in the layer, \min(\max(x - d, 0), l), taken. Each year's layer losses are multiplied by its development factor (for the late reported claims and the development of the known ones, e.g. from chain_ladder), and then the aggregate deductible and limit apply. The burning cost of a year is its layer losses over its subject premium times its premium_index (the on-level premium). The burning cost of the layer is the total over the total, weighting years by premium, or the mean of the years' rates.

Losses are usually given above a reporting threshold. A loss just below the threshold, indexed, reaches the layer when the indexed threshold exceeds the deductible; a warning names the years where it does.

Value

An object of class netsimr_burning_cost, a list with by_year (each year's number of losses and of losses in the layer, its indexed losses, layer losses, development, developed and aggregate layer losses, premium, premium index, on-level premium, burning cost and whether it is included, and, with rating_premium, the layer losses at the rating year's premium), losses (each loss indexed and in the layer), rate (the burning cost), expected_loss, rating_year, rating_premium, n_layer_losses (in the years included) and the layer.

See Also

pareto_rating, property_exposure_rating and technical_premium.

Other reinsurance pricing functions: credibility_weight(), mbbefd_curve(), pareto_rating(), property_exposure_rating(), technical_premium()

Examples

bc <- burning_cost(xl_large_losses, xl_premium[, c("year", "premium")],
                   deductible = 1e6, limit = 4e6, inflation = 0.04,
                   development = setNames(xl_premium$development, xl_premium$year),
                   premium_index = setNames(xl_premium$rate_index, xl_premium$year),
                   threshold = 5e5, rating_premium = 60e6)
bc
bc$by_year[, c("year", "layer_losses", "onlevel_premium", "burning_cost")]

Cape Cod reserves

Description

Bornhuetter-Ferguson reserves whose expected loss ratio is estimated from the triangle: the latest claims over the premium already earned by development (the used-up premium).

Usage

cape_cod(triangle, premium, decay = 1, ...)

Arguments

triangle

A triangle of cumulative claims, as for chain_ladder, or the result of chain_ladder(), whose development pattern is then used.

premium

The premium (or other exposure) of each origin.

decay

The weight of an origin one period away in an origin's loss ratio, from 0 to 1 (the default, the classical Cape Cod with one loss ratio).

...

Arguments passed to chain_ladder() for the development pattern, such as average and tail, when triangle is a triangle.

Details

The expected loss ratio is LR = \sum_i C_i / \sum_i P_i p_i, with p_i = 1 / CDF_i the share developed of origin i, and each origin's ultimate is C_i + (1 - p_i) P_i LR. With decay below 1 (the generalised Cape Cod of Gluck), each origin has its own loss ratio, in which origin k weighs decay^{|i - k|}, so that nearby origins count most; with decay 0 the method is the chain ladder.

Value

An object of class netsimr_reserve, as for bornhuetter_ferguson, whose loss ratios are the estimated ones.

References

Stanard, J. N. (1985). A simulation test of prediction errors of loss reserve estimation techniques. Proceedings of the Casualty Actuarial Society 72, 124-148.

Gluck, S. M. (1997). Balancing development and trend in loss reserve analysis. Proceedings of the Casualty Actuarial Society 84, 482-532.

Examples

premium <- c(50000, 52000, 54000, 56000, 58000, 60000, 62000, 64000, 66000, 68000)
cape_cod(raa_triangle, premium)
cape_cod(raa_triangle, premium, decay = 0.75)$by_origin$loss_ratio

Chain ladder reserves with Mack's standard errors

Description

Projects a triangle of cumulative claims to ultimate with the chain ladder, and estimates the standard error of each origin's reserve and of the total with Mack's distribution-free model, including the tail.

Usage

chain_ladder(
  triangle,
  average = c("volume", "simple", "regression"),
  periods = NULL,
  exclude = NULL,
  tail = 1,
  tail_from = 1,
  sigma = c("log-linear", "Mack"),
  tail_periods = 100
)

Arguments

triangle

A numeric matrix of cumulative claims: one row per origin period, oldest first, and one column per development period, with NA for the future. A data frame is converted with as.matrix(); see as_triangle to build one from a table of claims.

average

"volume" (the default) for volume-weighted development factors, "simple" for simple averages of the link ratios, or "regression" for least squares through the origin.

periods

The number of latest calendar periods (diagonals) whose link ratios are used, or NULL (the default) for all of them.

exclude

Link ratios to leave out: a logical matrix with a row per origin and a column per development factor (TRUE to leave out), or NULL (the default) for none.

tail

The tail factor from the last development period to ultimate: a positive number (1, the default, for none), or "exponential" or "inverse power" for a curve fitted to the development factors above 1 and extrapolated over tail_periods periods.

tail_from

The first development factor the tail curve is fitted to.

sigma

How \sigma is found for a period with a single link ratio: "log-linear" or "Mack".

tail_periods

The number of periods beyond the triangle over which a tail curve is extrapolated (100, the default). An inverse power curve falls slowly, so its tail grows with this; an exponential one has nearly all of its tail in the first few periods.

Details

The development factor from period j to j + 1 is the weighted average of the link ratios F_{ij} = C_{i,j+1} / C_{ij} that are used, with weights C_{ij}^\alpha: \alpha = 1 for the volume-weighted average (the usual chain ladder), 0 for the simple average and 2 for the regression through the origin. Link ratios can be left out with exclude, or by using only the latest periods calendar periods. Link ratios from claims that are zero or negative are always left out.

The standard errors follow Mack (1993, 1999): the variance parameter of each period is \sigma_j^2 = \sum w_{ij} C_{ij}^\alpha (F_{ij} - f_j)^2 / (n_j - 1), and the reserve's mean squared error is the sum of the process and the parameter error, found recursively; the total adds the correlation of the origins through the shared factors. Where a period has a single link ratio, its \sigma is extrapolated: by a log-linear regression on the others ("log-linear", the default, falling back to Mack's rule when that regression is not significant at 5%), or by Mack's rule \sigma_{n-1}^2 = \min(\sigma_{n-2}^4 / \sigma_{n-3}^2, \sigma_{n-3}^2, \sigma_{n-2}^2) ("Mack"). With a tail factor, the tail's standard error and \sigma are extrapolated by log-linear regressions to where a curve through the factors reaches the tail factor. These choices are those of the ChainLadder package's MackChainLadder(), whose results the function reproduces.

Value

An object of class netsimr_chain_ladder, a list with:

by_origin

a data frame with, for each origin, the latest claims, the share developed (latest over ultimate), the ultimate, the IBNR (ultimate less latest: for a paid triangle, the IBNR and case reserves), its Mack standard error and coefficient of variation, and the process and parameter parts of the standard error;

total

the same for all origins together;

factors, cdf, tail

the development factors, the cumulative development factor from each period to ultimate (with the tail) and the tail factor;

sigma, factor_se

Mack's \sigma and the standard error of each factor, the tail's last;

link_ratios, used

the link ratios and which of them the factors use;

triangle, full_triangle

the triangle and the triangle completed with the projections, with an ultimate column;

notes

messages on the choices made, such as an extrapolated \sigma.

References

Mack, T. (1993). Distribution-free calculation of the standard error of chain ladder reserve estimates. ASTIN Bulletin 23(2), 213-225.

Mack, T. (1999). The standard error of chain ladder reserve estimates: recursive calculation and inclusion of a tail factor. ASTIN Bulletin 29(2), 361-366.

See Also

bornhuetter_ferguson, cape_cod and bootstrap_chain_ladder; run_shiny_reserving_tool, an application for all of them.

Examples

cl <- chain_ladder(raa_triangle)
cl
cl$factors

# simple averages of the latest five years, with a fitted tail
chain_ladder(raa_triangle, average = "simple", periods = 5, tail = "exponential")$total

Clark's growth curve reserves

Description

Reserves from a growth curve fitted to the incremental claims by maximum likelihood, after Clark (2003): the LDF method, with an ultimate for each origin, or the Cape Cod method, with one expected loss ratio on the premiums. Its standard errors have a process part and a parameter part.

Usage

clark_growth(
  triangle,
  curve = c("loglogistic", "weibull"),
  premium = NULL,
  method = c("ldf", "cape cod"),
  truncation = Inf,
  offset = 0.5
)

Arguments

triangle

A triangle of cumulative claims, as for chain_ladder.

curve

"loglogistic" (the default) or "weibull".

premium

The premium of each origin: needed by the Cape Cod method, and used for the loss ratios when given to the LDF method.

method

"ldf" (the default) or "cape cod".

truncation

The age, in development periods, at which the curve is cut off and the claims are taken to be fully developed: Inf (the default) for none.

offset

The average date of the claims in an origin period, as a share of a period from its start: 0.5 (the default) for claims spread evenly over it, 0 to measure ages from the start.

Details

The share of an origin's ultimate developed by age x is a growth curve: the log-logistic G(x) = x^\omega / (x^\omega + \theta^\omega) or the Weibull G(x) = 1 - e^{-(x / \theta)^\omega}. The age is measured from the average date of the claims in an origin period, offset of a period after its start (a half for claims spread evenly over it), so the increment of development period t is expected to be \mu_{it} = U_i (G(t - o) - G(t - 1 - o)), with G = 0 at ages up to 0. U_i is the ultimate of each origin (LDF method) or its premium times one expected loss ratio (Cape Cod method). The increments are taken to be over-dispersed Poisson: the parameters maximise \sum c_{it} \log \mu_{it} - \mu_{it}, so that each U_i (or the loss ratio) has a closed form given \omega and \theta, which are found numerically. The scale \sigma^2 is the sum of the squared Pearson residuals over the degrees of freedom (the cells less the parameters).

The reserve of an origin is U_i (G(T - o) - G(a_i - o)), from its latest age a_i to the truncation age T (infinite by default; the growth curves can have long tails, so a finite truncation is often used with the LDF method). Its process variance is \sigma^2 times the reserve; its parameter variance comes from the covariance of the parameters, \sigma^2 times the inverse of minus the second derivatives of the log-likelihood, by the delta method. The results agree with the ChainLadder package's ClarkLDF() and ClarkCapeCod().

Value

An object of class netsimr_reserve: a list with by_origin, a data frame with each origin's latest claims, share developed, ultimate, IBNR, standard error, coefficient of variation and its process and parameter parts (and premium and ultimate loss ratio when there are premiums); total; parameters, the curve's \omega and \theta (and the loss ratio of the Cape Cod method), \sigma^2 and the degrees of freedom; growth, the fitted curve as a function of the age; fitted and residuals, the fitted increments and the Pearson residuals (c - \mu) / \sqrt{\sigma^2 \mu}, as triangles; and covariance.

References

Clark, D. R. (2003). LDF curve-fitting and stochastic reserving: a maximum likelihood approach. Casualty Actuarial Society Forum, Fall 2003, 41-92.

See Also

chain_ladder and cape_cod.

Examples

clark <- clark_growth(raa_triangle)
clark
clark$parameters

# the Cape Cod method with a Weibull curve
premium <- c(50000, 52000, 54000, 56000, 58000, 60000, 62000, 64000, 66000, 68000)
clark_growth(raa_triangle, curve = "weibull", premium = premium, method = "cape cod")$total

Compare reinsurance programmes

Description

Simulates the claims of a portfolio once and puts them through each of several reinsurance programmes (a surplus treaty, a quota share, an excess of loss layer on each claim and an aggregate stop loss, alone or together), to compare what each costs with the capital it saves: the expected ceded losses, the reinsurance premiums, the margin paid to the reinsurers, the net result, its value at risk and the capital it needs.

Usage

compare_reinsurance(
  frequency,
  frequency_params,
  severity,
  severity_params,
  programmes,
  premium,
  n = 10000,
  level = 0.995,
  loading = 0.25,
  coc_rate = 0.1,
  seed = NULL,
  pareto_thresholds = NULL,
  pareto_alphas = NULL
)

Arguments

frequency, frequency_params

The claim count distribution and its parameters, as in simulate_claims, such as "Poisson" (lambda) or "Negative Binomial" (r, beta).

severity, severity_params

The claim size distribution and its parameters, as in simulate_claims, such as "LogNormal" (meanlog, sdlog) or "Pareto" (alpha, x_m).

programmes

A named list of programmes, each a list with any of: surplus, a list with the retention (a line), the lines ceded above it, sum_insured (the sum insured of each risk, or of each band of risks), and optionally weights (the chance a claim falls on each risk and its share of the premium, such as its premium; equal by default), premium (the ceded premium) and commission (the ceding commission, a share of the ceded premium); quota_share (the share ceded) and commission (the ceding commission, a share of the ceded premium); xl, a list with the deductible, limit, reinstatements (Inf, the default, for unlimited and free), reinstatement_rate (1 by default) and optionally premium; and stop_loss, a list with the attachment, limit and optionally premium. "No reinsurance" is added as the first programme.

premium

The subject premium of the year.

n

The number of simulated years.

level

The level of the value at risk, such as 0.995.

loading

The share of a priced layer's or stop loss's premium for the reinsurer's expenses and profit.

coc_rate

The cost of capital a year, for the value of the capital relief.

seed

A whole number for a reproducible run, or NULL. The stream of the R session is restored after a run with a seed.

pareto_thresholds, pareto_alphas

Pareto slices of the claim size, as in simulate_claims: increasing claim sizes above which the tail of the severity is a Pareto, and the alpha of each. NULL (the default) for none.

Details

Every programme sees the same simulated claims. In each, the surplus treaty cedes its share of every claim first, then the quota share its share of what is left; the excess of loss layer then recovers from each retained claim the part above its deductible, up to its limit, and at most (1 + \textrm{reinstatements}) limits a year; the stop loss last recovers the part of the year's retained claims above its attachment, up to its limit.

A surplus treaty cedes of each risk the part of its sum insured above the retention, up to lines retentions, and that share of the risk's premium and of each of its claims: nothing of a risk within the retention, and \min(S - R, \textrm{lines} \times R) / S of a risk of sum insured S above the retention R. Each simulated claim falls on one of the risks of sum_insured, drawn with the chances weights (the same risk in every programme with the same risks), and its size is drawn as every other claim's, whatever the sum insured of its risk. The treaty's premium is given or, when it is not, the subject premium times the ceded share of the risks, weighted by weights, so give each risk's premium as its weight.

The premium of a quota share is its share of the subject premium (of what the surplus treaty leaves of it), less its ceding commission. A layer's or stop loss's premium is given or, when it is not, priced at the expected ceded loss with loading as the share of the premium for the reinsurer's expenses and profit (technical_premium, with the reinstatements the simulations use). The excess of loss layer's reinstatement premiums are paid pro rata to the cover reinstated.

The net result of a year is the subject premium less the reinsurance premiums paid, plus the ceding commission, less the retained claims (before other expenses). The capital a programme needs is the mean net result less its 1 - \textrm{level} quantile: what a bad year at that level costs against an average one. The capital relief is the capital without reinsurance less the programme's, and its value is coc_rate of the relief less the margin paid for it: positive when the programme saves more in the cost of capital than it costs.

Value

An object of class netsimr_programmes, a list with summary, a data frame with a row per programme (the expected ceded loss, the reinsurance premium and margin, the net mean result and its standard deviation, the probability of a loss-making year, the value at risk of the net result, the capital, the capital relief and its value), results, the simulated net result of each programme (a column each), and the settings.

See Also

simulate_claims, technical_premium and run_shiny_reinsurance_pricing_tool, which compares programmes on its Programmes tab.

Examples

programmes <- list(
  `Quota share 30%` = list(quota_share = 0.3, commission = 0.25),
  `XL 4m xs 1m` = list(xl = list(deductible = 1e6, limit = 4e6, reinstatements = 1)),
  `Stop loss 30m xs 45m` = list(stop_loss = list(attachment = 45e6, limit = 30e6)),
  # four lines above a retention of 1m, on bands of sum insured weighted by premium
  `Surplus 4 lines` = list(surplus = list(retention = 1e6, lines = 4, commission = 0.3,
                                          sum_insured = c(0.5e6, 1e6, 2e6, 5e6, 10e6),
                                          weights = c(20, 15, 12, 8, 5)))
)
cmp <- compare_reinsurance("Poisson", 200, "LogNormal", c(11, 1.5), programmes,
                           premium = 60e6, n = 5000, seed = 1)
cmp

Credibility of the loss experience

Description

The weight of the experience rating against the exposure rating, by limited fluctuation credibility: Z = \min(1, \sqrt{n / n_{full}}) for n losses, with n_{full} the number of losses for full credibility. The blended rate is Z times the experience rate plus 1 - Z times the exposure rate.

Usage

credibility_weight(n, full = 1082)

Arguments

n

The number of losses in the layer (or above the threshold).

full

The number of losses for full credibility; the default, 1082, gives the observed frequency within 5% of the true one with a probability of 90% for Poisson counts.

Value

The credibility weight, between 0 and 1.

See Also

Other reinsurance pricing functions: burning_cost(), mbbefd_curve(), pareto_rating(), property_exposure_rating(), technical_premium()

Examples

credibility_weight(25)
credibility_weight(25, full = 100)

The probability density function (pdf) of a Sliced Gamma Pareto severity distribution

Description

Gives the probability density at the claim amount x of a sliced severity distribution, with Gamma attritional claims below the slice point and a Pareto tail above it.

Usage

dSlicedGammaPareto(x, GShape, GRate, SlicePoint, PShape)

dsliced_gamma_pareto(x, GShape, GRate, SlicePoint, PShape)

Arguments

x

A real number - the claim amount where the probability density function (pdf) will be evaluated. The pdf is 0 for negative x.

GShape

A positive real number - the shape parameter of the attritional Claim Severity's Gamma distribution.

GRate

A positive real number - the rate parameter of the attritional Claim Severity's Gamma distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the Gamma distribution.

PShape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

PShape is the Pareto shape parameter, usually written alpha; the sliced LogNormal-Pareto functions call the same parameter shape.

Value

The value of the probability density function (pdf) at x with an attritional claim Gamma distribution with parameters GShape and GRate and a large claim Pareto distribution with parameters SlicePoint and PShape. A non-numeric argument or a non-positive parameter is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedGammaParetoMean(), SlicedLNormParetoMean(), dSlicedLNormPareto(), pSlicedGammaPareto(), pSlicedLNormPareto(), qSlicedGammaPareto(), qSlicedLNormPareto()

Examples

dSlicedGammaPareto(3000,1,0.0005,1000,1.2)
dSlicedGammaPareto(1000,1.1,0.0006,2000,1.6)
dSlicedGammaPareto(2000,1.2,0.0004,3000,1.4)

The probability density function (pdf) of a Sliced LogNormal Pareto severity distribution

Description

Gives the probability density at the claim amount x of a sliced severity distribution, with LogNormal attritional claims below the slice point and a Pareto tail above it.

Usage

dSlicedLNormPareto(x, mu, sigma, SlicePoint, shape)

dsliced_lnorm_pareto(x, mu, sigma, SlicePoint, shape)

Arguments

x

A real number - the claim amount where the probability density function (pdf) will be evaluated. The pdf is 0 for negative x.

mu

A real number - the first parameter of the attritional Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the attritional Claim Severity's LogNormal distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the Claim Severity's Pareto distribution. An infinite slice point gives the LogNormal distribution.

shape

A positive real number - the shape parameter of the Claim Severity's Pareto distribution.

Details

shape is the Pareto shape parameter, usually written alpha; the sliced Gamma-Pareto functions call the same parameter PShape.

Value

The value of the probability density function (pdf) at x with an attritional claim LogNormal distribution with parameters mu and sigma and a large claim Pareto distribution with parameters SlicePoint and shape. A non-numeric argument or a non-positive sigma, SlicePoint or shape is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedGammaParetoMean(), SlicedLNormParetoMean(), dSlicedGammaPareto(), pSlicedGammaPareto(), pSlicedLNormPareto(), qSlicedGammaPareto(), qSlicedLNormPareto()

Examples

dSlicedLNormPareto(1200,6,1.5,1000,1.2)
dSlicedLNormPareto(4000,7,1.6,3000,1.4)

Discounted reserves from the chain ladder's payment pattern

Description

The future payments of a paid triangle, as the chain ladder projects them, by calendar period, discounted with a yield curve: the best estimate of the liability for incurred claims under IFRS 17, or of the claims provision under Solvency II (before expenses).

Usage

discount_reserves(
  x,
  yield_curve = 0,
  period = 1,
  timing = 0.5,
  tail_periods = 1,
  ...
)

Arguments

x

A triangle of cumulative paid claims, or its chain_ladder.

yield_curve

The annual spot rates, as shares (0.03 for 3%), for terms of 1, 2, 3, ... years, or one rate for all terms.

period

The length of a development period in years: 1 (the default) for an annual triangle, 0.25 for a quarterly one.

timing

When the payments of a period are made, as a share of the period: 0.5 (the default) for the middle, 0 for its start, 1 for its end.

tail_periods

The number of periods over which the claims of a tail factor are paid.

...

Arguments of chain_ladder when x is a triangle.

Details

Each origin's projected payments of each future development period fall in a future calendar period, the first being the one after the triangle's latest diagonal. A payment of calendar period t is taken to be made timing of the way through it, at (t - 1 + \code{timing}) \times \code{period} years, and discounted with the spot rate of that term, (1 + r)^{-\textrm{term}}. The claims of a tail factor beyond the triangle are paid evenly over the tail_periods periods after its last development period.

The spot rates of the yield curve are given for terms of 1, 2, 3, ... years; a term between two is interpolated linearly, one before the first takes the first rate and one beyond the last the last rate. One rate gives a flat curve.

Value

An object of class netsimr_discounted, a list with:

by_origin

a data frame with each origin's reserve (its IBNR: the undiscounted future payments), the reserve discounted, the discount and the mean term of its payments in years;

cash_flows

a data frame with a row per future calendar period: its payments, their term, the spot rate, the discount factor and their present value;

total

the reserve, the discounted reserve, the discount and the mean term.

See Also

risk_adjustment, sii_premium_reserve_risk and chain_ladder; run_shiny_reserving_tool, an application for them.

Examples

paid <- as_triangle(simulated_motor_claims, "accident_year", "development_year", "paid",
                    cumulative = FALSE)
# a rising yield curve: 3% at one year to 3.8% at five years and beyond
be <- discount_reserves(paid, yield_curve = c(0.030, 0.032, 0.034, 0.036, 0.038))
be$total
head(be$cash_flows)

The class of the distribution objects

Description

Each object describes one frequency or severity distribution of the simulator: its parameters (ids used as app input ids, labels, allowed ranges and whether they must be whole numbers) and the functions the simulator needs. simulate_func draws values; moments_func gives the mean and standard deviation. Severity distributions also have survival_func and tail_quantile_func (the upper-tail probability and its inverse), used to splice Pareto tails and to draw only the claims that reach a layer, and optionally sum_func, which draws the total of a given number of claims in one step. Frequency distributions may have split_func, which draws the number of claims and how many of them are large. Allowed ranges are param_min_values and param_max_values (NA for no bound), with param_min_strict and param_max_strict marking bounds the value may not equal. param_display_order is the order the app shows the parameters' inputs in, as positions in paramIDs (empty for that order): the Pareto shows its minimum, x_m, before alpha, the order actuaries enter them in, while its parameters stay c(alpha, x_m) wherever they are passed as a vector. param_amounts marks the parameters that are amounts of money (empty for none), which the app shows with thousands separators.


Server function for the Distribution Fitting tool application

Description

Reads the uploaded file, fits the frequency, severity, sliced and piecewise Pareto models the user asks for and renders their tables and charts; paired with distribution_fitting_tool_UI by run_shiny_distribution_fitting_tool.

Usage

distribution_fitting_tool_Server(input, output, session)

Arguments

input

Input for the server function.

output

Output for the server function.

session

Session for the server function.

Value

Called by shiny for its side effects, the outputs and observers of a session; the value is not used.


User interface of the Shiny distribution fitting tool

Description

The page of the distribution fitting application: a welcome tab, the data upload and one tab for each analysis, with the settings beside the results; run_shiny_distribution_fitting_tool pairs it with distribution_fitting_tool_Server. The page is built each time the application starts, not when the package is installed: its theme compiles Bootstrap's SCSS files from where bslib is installed on the machine running it, and a page built at installation kept the paths of the machine that built the package (for a CRAN binary, CRAN's build machine).

Usage

distribution_fitting_tool_UI(request)

Arguments

request

The request of the browser, passed by shiny; not used.

Value

The user interface of the application, a bslib navbar page.


Error function

Description

Evaluates the Gauss error function, 2 * pnorm(sqrt(2) * x) - 1, which appears in the closed form of the LogNormal capped mean.

Usage

erf(x)

Arguments

x

A real number.

Value

The value of the error function at x. A non-numeric x is an error.

See Also

LNormCappedMean

Examples

erf(0.1)
erf(0.5)

A vector with the frequency distribution objects

Description

A named list of distributionClass objects, one for each claim count distribution of the simulator: Poisson, Negative_Binomial, Binomial, Zero_Inflated_Poisson, Zero_Inflated_Negative_Binomial and Fixed_number_of_Counts. The names are the values accepted by the freqDistr argument of simulate_function(), and the objects hold the parameter ids, labels and ranges of the app's inputs and the functions that draw the claim counts. A zero-inflated count is zero with the probability of its last parameter, and otherwise drawn from the Poisson or Negative Binomial of its other parameters: more periods without a claim than those distributions give on their own.

Usage

freq_dist_options

Value

The frequency distribution objects.


A data frame with the frequency distribution parameter placeholders

Description

One row per parameter of the frequency distribution with the most parameters, giving the number and output id of the placeholder in which the simulator app renders that parameter's input for the chosen distribution.

Usage

freq_dist_parameter_placeholders

Value

The frequency distribution parameter placeholders.


The indicated rate change: the loss ratio method

Description

Projects each year's ultimate losses to the period the new rates will apply to, with a claims trend, divides them by the year's on-level premium, and compares the projected loss ratio with the permissible one, which leaves room for the expenses and the profit.

Usage

indicated_rate_change(
  losses,
  premium,
  years,
  trend = 0,
  effective,
  rate_period = 1,
  term = 1,
  expense_ratio = 0,
  profit = 0,
  weights = NULL,
  credibility = 1,
  complement = NULL
)

Arguments

losses

The ultimate losses of each year, such as from chain_ladder.

premium

The on-level earned premium of each year (on_level_premium).

years

The years.

trend

The annual claims trend (inflation of the loss cost), as a share.

effective

The date the new rates take effect: a Date or a decimal year.

rate_period

How long the new rates will be in force, in years.

term

The length of the policies in years.

expense_ratio

The expenses (commissions and other costs varying with the premium) as a share of the premium.

profit

The profit and contingencies provision, as a share of the premium.

weights

Weights of the years, such as to give the latest more weight; by default their on-level premium.

credibility

The credibility of the experience, from 0 to 1.

complement

The loss ratio blended with the experience when its credibility is below 1.

Details

Each year's losses are trended from the middle of the year, y + 0.5 for calendar or accident year y, to the average date of the claims of the policies the new rates will price: the date they take effect, plus half the period they will be in force, plus half a policy term. The experience loss ratio weighs the years by their on-level premium (or weights); with credibility below 1 it is blended with the complement, such as the loss ratio the current rates assume. The indicated change is that loss ratio over the permissible loss ratio, 1 - \textrm{expense ratio} - \textrm{profit}, less 1.

Value

A list with by_year (each year's losses, trend factor, trended losses, premium and projected loss ratio), the experience loss ratio, the blended loss ratio, the permissible loss ratio and the indicated rate change.

See Also

on_level_premium, buhlmann_straub and credibility_weight.

Examples

changes <- data.frame(date = as.Date(c("2021-07-01", "2023-01-01", "2024-04-01")),
                      change = c(0.05, -0.02, 0.08))
onl <- on_level_premium(c(9.2e6, 9.8e6, 10.4e6, 11.1e6), 2021:2024, changes)
rate <- indicated_rate_change(c(6.3e6, 6.6e6, 7.4e6, 7.6e6), onl$on_level_premium, 2021:2024,
                              trend = 0.04, effective = as.Date("2026-01-01"),
                              expense_ratio = 0.27, profit = 0.05)
rate[c("experience_loss_ratio", "indicated_change")]

Chain ladder for claims inflation

Description

The chain ladder of a triangle restated in today's money: past payments are brought to the level of the latest calendar period by past claims inflation, developed, and the future payments are then inflated by the expected future inflation, so that the reserve reflects inflation that differs from the past's.

Usage

inflation_adjusted_chain_ladder(
  triangle,
  past = 0,
  future = if (length(past) == 1) past else 0,
  ...
)

Arguments

triangle

A triangle of cumulative claims, as for chain_ladder; paid claims, as incurred claims include case reserves that are not inflated by period.

past

The past claims inflation: one rate per calendar period (0.05 for 5% a period), or a rate for each step between consecutive calendar periods, oldest first (one fewer than the number of calendar periods).

future

The future claims inflation per calendar period: one rate, or a rate for each future calendar period, nearest first. By default the same single rate as past when that is one rate, otherwise 0.

...

Arguments passed to chain_ladder() for the restated triangle, such as average or tail.

Details

The chain ladder of nominal claims projects the average inflation of the past into the future. Here each incremental payment of calendar period c is multiplied by the inflation from c to the latest calendar period, the chain ladder of the restated cumulative triangle projects the future increments in today's money, and each is multiplied by the future inflation from the latest calendar period to its own. With no inflation the result is the chain ladder's. A tail is paid in the calendar period after the triangle's last development period.

Value

An object of class netsimr_reserve: a list with by_origin, a data frame with each origin's latest claims, ultimate and IBNR, the IBNR in today's money (before future inflation) and the cost of future inflation; total; chain_ladder, the chain ladder of the restated triangle; and restated, the triangle in today's money.

See Also

chain_ladder.

Examples

# 5% a year in the past, 8% expected in the future
inflation_adjusted_chain_ladder(raa_triangle, past = 0.05, future = 0.08)

# the same inflation for both is close to the plain chain ladder
inflation_adjusted_chain_ladder(raa_triangle, past = 0.05)$total[["ibnr"]]
chain_ladder(raa_triangle)$total[["ibnr"]]

Simulated liability claims at their policy limits

Description

2,500 simulated liability claims of four accident years, each paid up to its policy limit, so the largest are cut at the limits: the example of the severity fits of the distribution fitting tool, which fits them as censored. The script that made it is in the package's source, under data-raw.

Usage

liability_claims

Format

A data frame with 2,500 rows, one per claim, and 4 columns:

claim_id

the claim's identifier;

accident_year

2021 to 2024;

amount

the amount paid, at most the policy limit;

policy_limit

the policy's limit: 100,000, 250,000, 500,000 or 1,000,000.

See Also

run_shiny_distribution_fitting_tool.

Examples

# the claims paid at their limit
mean(liability_claims$amount >= liability_claims$policy_limit)

Parameter to set the maximum number of Pareto slices

Description

The largest number of Pareto slices that the simulator app and simulate_claims accept, so that the app can build one row of slice inputs for each.

Usage

max_number_of_pareto_slices

Value

The maximum number of Pareto Slices.


MBBEFD exposure curves

Description

The exposure curves of Bernegger's MBBEFD class, used to rate property excess of loss treaties from a risk profile. mbbefd_curve() gives the share of a risk's expected loss that falls below a deductible of x times its sum insured (or maximum possible loss), for the parameters b and g. swiss_re_parameters() gives b and g of the one-parameter curves of Swiss Re, and swiss_re_curve() the curve itself: c = 1.5, 2, 3 and 4 are the curves Y1 to Y4, from personal lines to large industrial risks, and c = 5 the curve used at Lloyd's for industrial risks.

Usage

mbbefd_curve(x, b, g)

swiss_re_parameters(c)

swiss_re_curve(x, c)

Arguments

x

The deductible as a share of the sum insured: numbers from 0; those above 1 are taken as 1.

b, g

The parameters of the curve: b at least 0 and g at least 1. The arguments are recycled to a common length.

c

The parameter of a Swiss Re curve, at least 0, or the name of one: "Y1", "Y2", "Y3", "Y4" or "Lloyds".

Details

With g = 1 or b = 0 every loss is a total loss and G(x) = x; with b = 1, G(x) = \log(1 + (g - 1)x) / \log(g); with bg = 1, G(x) = (1 - b^x) / (1 - b); otherwise

G(x) = \log\left(\frac{(g - 1)b + (1 - gb)b^x}{1 - b}\right) / \log(gb).

The probability of a total loss is 1/g. The Swiss Re curves have b = e^{3.1 - 0.15(1 + c)c} and g = e^{(0.78 + 0.12c)c}.

A layer of limit excess of deductible on a risk with sum insured M takes the share G((d + l) / M) - G(d / M) of the risk's expected loss; see property_exposure_rating.

Value

mbbefd_curve() and swiss_re_curve(): the curve at x, between 0 and 1. swiss_re_parameters(): a data frame with the columns c, b and g, a row for each value of c.

References

Bernegger, S. (1997). The Swiss Re exposure curves and the MBBEFD distribution class. ASTIN Bulletin 27(1), 99-111.

See Also

Other reinsurance pricing functions: burning_cost(), credibility_weight(), pareto_rating(), property_exposure_rating(), technical_premium()

Examples

# a layer of 4m excess of 1m on a risk of 10m, on the Y3 curve
swiss_re_curve(0.5, "Y3") - swiss_re_curve(0.1, "Y3")
swiss_re_parameters(c("Y1", "Y2", "Y3", "Y4", "Lloyds"))
mbbefd_curve(c(0, 0.25, 0.5, 1), b = 2, g = 10)

The one-year view of the reserves: Merz and Wuthrich's claims development result

Description

The standard error of the claims development result (CDR) of the next year: how much the chain ladder's ultimate can move in one year, as the year's claims emerge and the factors are estimated again. It is the reserve risk over one year that Solvency II measures, against Mack's standard error of the reserves until they are all paid.

Usage

merz_wuthrich(triangle, sigma = c("log-linear", "Mack"))

Arguments

triangle

A numeric matrix of cumulative claims: one row per origin period, oldest first, and one column per development period, with NA for the future. A data frame is converted with as.matrix(); see as_triangle to build one from a table of claims.

sigma

How \sigma is found for a period with a single link ratio: "log-linear" or "Mack".

Details

The formulas of Merz and Wuthrich (2008) hold for the volume-weighted chain ladder of every link ratio without a tail, which the function fits; with Mack's \sigma_j and the shares \alpha_j = C_{I-j,j} / \sum_{i \le I-j} C_{ij}, the mean squared error of each origin's CDR is its next year's process error, \hat C_{iJ}^2 \hat\sigma_j^2 / (\hat f_j^2 C_{ij}), plus the error of the factors, which counts each later factor's error by the share \alpha of its estimate that the year's claims change; the total adds the correlation of the origins. The results match the ChainLadder package's CDR(), and for the Taylor and Ashe triangle Merz and Wuthrich's paper.

Value

An object of class netsimr_reserve: a list with by_origin, a data frame with each origin's latest claims, ultimate, IBNR, the standard error of its one-year CDR and Mack's standard error until ultimate; total, the same for all origins; and chain_ladder, the chain ladder they come from.

References

Merz, M. and Wuthrich, M. V. (2008). Modelling the claims development result for solvency purposes. CAS E-Forum, Fall 2008, 542-568.

See Also

chain_ladder for Mack's standard error until ultimate, and bootstrap_chain_ladder.

Examples

merz_wuthrich(taylor_ashe_triangle, sigma = "Mack")

Simulated motor policies

Description

A simulated year of 10,000 motor policies, with their rating factors, exposure, claim counts and claim costs: the example of the GLM fitting tool and of the claim count fits of the distribution fitting tool. Claims are most frequent for the youngest drivers, in the North and for motorcycles, and cost more for vans and dearer vehicles. The script that made it is in the package's source, under data-raw.

Usage

motor_policies

Format

A data frame with 10,000 rows, one per policy, and 8 columns:

policy_id

the policy's identifier;

age

the driver's age, 18 to 85;

region

North, South, East or West;

vehicle

car, van or motorcycle;

vehicle_value

the vehicle's value;

exposure

the share of the year the policy was in force;

claim_count

the number of claims in the year;

claim_cost

the total cost of the claims, 0 without a claim.

See Also

run_shiny_glm_fitting_tool, tweedie_family.

Examples

frequency <- glm(claim_count ~ offset(log(exposure)) + region + vehicle,
                 family = poisson(), data = motor_policies)
round(exp(coef(frequency)), 3)

Munich chain ladder of paid and incurred claims

Description

Projects a paid and an incurred triangle together, so that their ultimates agree: where an origin's paid to incurred ratio is below the average, its paid claims develop faster and its incurred claims slower than the chain ladder's, and the other way round.

Usage

munich_chain_ladder(paid, incurred, sigma = c("log-linear", "Mack"))

Arguments

paid, incurred

Triangles of cumulative paid and incurred claims, as for chain_ladder, with values in the same cells.

sigma

How the chain ladders' \sigma is found for a period with a single link ratio: "log-linear" or "Mack".

Details

Following Quarg and Mack (2004), the chain ladder factor of each triangle is corrected by the origin's deviation from the average paid to incurred ratio (q_j, or its inverse for the paid triangle) of the development period: \hat f^P_j + \lambda^P \hat\sigma^P_j / \hat\rho^P_j (I_{ij} / P_{ij} - 1 / q_j), and likewise for incurred, where \lambda is the slope of the link ratio residuals on the ratio residuals. The \sigma of a development period with a single link ratio or ratio is extrapolated log-linearly, as in the ChainLadder package's MunichChainLadder(), whose results the function reproduces.

Value

An object of class netsimr_reserve: a list with by_origin, a data frame with each origin's latest paid and incurred claims, their ratio, the Munich chain ladder ultimates of both and their ratio, and the separate chain ladder ultimates; total; the completed triangles paid_full and incurred_full; lambda (paid and incurred), q (the average paid to incurred ratio of each development period) and the two chain ladders.

References

Quarg, G. and Mack, T. (2004). Munich chain ladder. Blatter DGVFM 26(4), 597-630.

See Also

chain_ladder.

Examples

munich_chain_ladder(quarg_mack_paid, quarg_mack_incurred)

Premiums at today's rates: the parallelogram method

Description

Brings each calendar year's earned premium to the current rate level, allowing for the rate changes made since: the on-level factor of a year is the current rate level over the average rate level of the premium the year earned.

Usage

on_level_premium(premium, years, changes, term = 1)

Arguments

premium

The earned premium of each calendar year.

years

The calendar years, such as 2020:2024.

changes

A data frame of the rate changes: their date (a Date, or a decimal year such as 2023.5) and the change (0.05 for +5%), applying to the policies written from that date.

term

The length of the policies in years: 1 (the default) for annual policies.

Details

Policies are taken to be written evenly over time, each for term years, and to earn their premium evenly over their term. The premium a calendar year earns comes from the policies written in the term years before its end; its average rate level weighs the rate level at each writing date by the part of that policy's term within the year. This is the parallelogram method, worked out exactly for any dates of change and any term (numerically, on a fine grid).

Value

A data frame with each year's earned premium, its average rate level (the rate level of the policies written before the first change being 1), the on-level factor and the premium at the current rate level; the current rate level is in its attribute current_level.

See Also

indicated_rate_change and buhlmann_straub.

Examples

changes <- data.frame(date = as.Date(c("2021-07-01", "2023-01-01", "2024-04-01")),
                      change = c(0.05, -0.02, 0.08))
on_level_premium(c(9.2e6, 9.8e6, 10.4e6, 11.1e6), 2021:2024, changes)

The cumulative distribution function (cdf) of a Sliced Gamma-Pareto severity distribution

Description

Gives the probability that a claim from a sliced severity distribution, with Gamma attritional claims below the slice point and a Pareto tail above it, is at most x.

Usage

pSlicedGammaPareto(x, GShape, GRate, SlicePoint, PShape)

psliced_gamma_pareto(x, GShape, GRate, SlicePoint, PShape)

Arguments

x

A real number - the claim amount where the cumulative distribution function (cdf) will be evaluated. The cdf is 0 for negative x.

GShape

A positive real number - the shape parameter of the attritional Claim Severity's Gamma distribution.

GRate

A positive real number - the rate parameter of the attritional Claim Severity's Gamma distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the Gamma distribution.

PShape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

PShape is the Pareto shape parameter, usually written alpha; the sliced LogNormal-Pareto functions call the same parameter shape.

Value

The value of the cumulative distribution function (cdf) at x with an attritional claim Gamma distribution with parameters GShape and GRate and a large claim Pareto distribution with parameters SlicePoint and PShape. A non-numeric argument or a non-positive parameter is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedGammaParetoMean(), SlicedLNormParetoMean(), dSlicedGammaPareto(), dSlicedLNormPareto(), pSlicedLNormPareto(), qSlicedGammaPareto(), qSlicedLNormPareto()

Examples

pSlicedGammaPareto(3000,1,0.0005,1000,1.2)
pSlicedGammaPareto(1000,1.1,0.0006,2000,1.6)
pSlicedGammaPareto(2000,1.2,0.0004,3000,1.4)

The cumulative distribution function (cdf) of a Sliced LogNormal Pareto severity distribution

Description

Gives the probability that a claim from a sliced severity distribution, with LogNormal attritional claims below the slice point and a Pareto tail above it, is at most x.

Usage

pSlicedLNormPareto(x, mu, sigma, SlicePoint, shape)

psliced_lnorm_pareto(x, mu, sigma, SlicePoint, shape)

Arguments

x

A real number - the claim amount where the cumulative distribution function (cdf) will be evaluated. The cdf is 0 for negative x.

mu

A real number - the first parameter of the attritional Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the attritional Claim Severity's LogNormal distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the LogNormal distribution.

shape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

shape is the Pareto shape parameter, usually written alpha; the sliced Gamma-Pareto functions call the same parameter PShape.

Value

The value of the cumulative distribution function (cdf) at x with an attritional claim LogNormal distribution with parameters mu and sigma and a large claim Pareto distribution with parameters SlicePoint and shape. A non-numeric argument or a non-positive sigma, SlicePoint or shape is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedGammaParetoMean(), SlicedLNormParetoMean(), dSlicedGammaPareto(), dSlicedLNormPareto(), pSlicedGammaPareto(), qSlicedGammaPareto(), qSlicedLNormPareto()

Examples

pSlicedLNormPareto(1200,6,1.5,1000,1.2)
pSlicedLNormPareto(4000,7,1.6,3000,1.4)

Pareto rating of an excess of loss layer

Description

Experience rating of a layer with a Pareto distribution fitted to the large losses: the losses above a threshold, brought to the money of the rating year, give the frequency of large losses per unit of on-level premium and the Pareto alpha; the layer's expected loss is the frequency times the expected part of a large loss in the layer. Unlike the burning cost it prices layers above the largest loss seen.

Usage

pareto_rating(
  losses,
  premium,
  threshold,
  deductible,
  limit,
  inflation = 0,
  rating_year = NULL,
  development = 1,
  premium_index = 1,
  exclude = NULL,
  alpha = NULL,
  rating_premium = NULL
)

Arguments

losses

A data frame of the large losses with the columns year and amount (in the money of their year); other columns, such as a claim number, are kept.

premium

The subject premium of each year: a data frame with the columns year and premium, or numbers named by year. Its years are those of the experience; a year without losses has none in the layer.

threshold

The threshold of the Pareto, in the money of the rating year: the losses above it, indexed, are used. At most the deductible.

deductible, limit

The layer, limit (or Inf) excess of deductible, for each loss.

inflation

An annual rate (0.05 for 5%) or index values named by year, including the rating year.

rating_year

The year being priced; by default the year after the last.

development

One factor for all years, one per year, or factors named by year, applied to each year's number of large losses. Defaults to 1.

premium_index

The factor that brings each year's premium to the rating year's rates and exposure, as development. Defaults to 1.

exclude

Years left out of the burning cost (they are still shown).

alpha

The Pareto alpha, to use a market or selected alpha instead of the one estimated; NULL (the default) estimates it.

rating_premium

The subject premium of the rating year; the expected layer loss is the burning cost times it. NULL (the default) gives no expected loss.

Details

Alpha is estimated by maximum likelihood, corrected for its bias: \hat\alpha = (n - 1) / \sum \log(x_i / t) for the n indexed losses x_i above the threshold t. The number of large losses of each year is multiplied by its development factor, for the losses not reported yet, and their total divided by the total on-level premium. The expected part of a large loss in the layer is E[\min(X, d + l)] - E[\min(X, d)] for a Pareto with minimum t (ParetoCappedMean), which needs a deductible of at least the threshold. Aggregate terms are not applied.

Value

An object of class netsimr_pareto_rating, a list with alpha, alpha_estimated (the estimate, also when alpha is given), n (the losses above the threshold in the years included), frequency (large losses per unit of on-level premium), expected_count (at the rating premium), layer_severity (the expected part of a large loss in the layer), rate, expected_loss, by_year and losses (the indexed losses above the threshold).

References

Schmutz, M. and Doerr, R. R. (1998). The Pareto model in property reinsurance: formulas and applications. Swiss Re.

See Also

burning_cost and technical_premium.

Other reinsurance pricing functions: burning_cost(), credibility_weight(), mbbefd_curve(), property_exposure_rating(), technical_premium()

Examples

pareto_rating(xl_large_losses, xl_premium[, c("year", "premium")], threshold = 7.5e5,
              deductible = 1e6, limit = 4e6, inflation = 0.04,
              premium_index = setNames(xl_premium$rate_index, xl_premium$year),
              rating_premium = 60e6)

Server function of the portfolio capital tool

Description

Reads the lines (a frequency and a severity for each, or uploaded simulated losses) and their dependence, runs simulate_portfolio and shows the capital of the portfolio and of each line; paired with portfolio_tool_UI by run_shiny_portfolio_tool.

Usage

portfolio_tool_Server(input, output, session)

Arguments

input

Input for the server function.

output

Output for the server function.

session

Session for the server function.

Value

Called by shiny for its side effects, the outputs and observers of a session; the value is not used.


User interface of the Shiny portfolio capital tool

Description

The page of the portfolio capital application: a welcome tab, the lines, their dependence and the capital, with the settings beside the results; run_shiny_portfolio_tool pairs it with portfolio_tool_Server. Like the package's other applications, the page is built each time the application starts, not when the package is installed.

Usage

portfolio_tool_UI(request)

Arguments

request

The request of the browser, passed by shiny; not used.

Value

The user interface of the application, a bslib navbar page.


Draw a chart of the tools

Description

Draws the chart on the current graphics device, with base graphics, to look at a chart of the tools in R (the pages and the reports draw it themselves, R/chart_output.R).

Usage

## S3 method for class 'netsimr_chart'
print(x, ...)

## S3 method for class 'netsimr_chart'
plot(x, ...)

Arguments

x

A chart, from netsimr_chart_model().

...

Not used.

Value

The chart, invisibly.


Print a simulated portfolio

Description

Print a simulated portfolio

Usage

## S3 method for class 'netsimr_portfolio'
print(x, ...)

Arguments

x

The result of simulate_portfolio.

...

Not used.

Value

x, invisibly.


Print a reserving result

Description

Print a reserving result

Usage

## S3 method for class 'netsimr_reserve'
print(x, ...)

Arguments

x

The result of chain_ladder, bornhuetter_ferguson, cape_cod, bootstrap_chain_ladder, merz_wuthrich, munich_chain_ladder, actual_vs_expected, clark_growth or inflation_adjusted_chain_ladder.

...

Not used.

Value

x, invisibly.


Exposure rating of property and casualty excess of loss layers

Description

Rates a layer of limit excess of deductible from a risk profile, without loss experience. Each band's (or policy's) expected loss, its premium times its loss ratio, is shared between the layer and the rest by an exposure curve. property_exposure_rating() uses an MBBEFD curve of the damage as a share of the sum insured (mbbefd_curve): the layer takes G((d + l) / M) - G(d / M) of a band with sum insured M. casualty_exposure_rating() uses the limited expected value of a claim size distribution: the layer takes (LEV(\min(P, d + l)) - LEV(\min(P, d))) / LEV(P) of a band with policy limit P.

Usage

property_exposure_rating(
  profile,
  deductible,
  limit,
  curve = "Y3",
  loss_ratio = NULL
)

casualty_exposure_rating(
  profile,
  deductible,
  limit,
  severity,
  severity_params,
  loss_ratio = NULL
)

Arguments

profile

A data frame with a row per band of the risk profile (or per policy): for property, the columns sum_insured (the band's sum insured or maximum possible loss per risk, often its average) and premium; for casualty, policy_limit and premium. An optional loss_ratio column gives each band's expected loss ratio; other columns, such as a band label, are kept.

deductible

The deductible of the layer, at least 0.

limit

The limit of the layer, above 0; Inf for an unlimited layer.

curve

The exposure curve: a Swiss Re curve by name ("Y1", "Y2", "Y3", "Y4" or "Lloyds") or by its parameter c, or an MBBEFD curve as c(b = , g = ).

loss_ratio

The expected ground-up loss ratio: one for all bands, or one per band. NULL (the default) takes the profile's loss_ratio column.

severity

The claim size distribution of the casualty business, as in simulate_claims: "LogNormal" (meanlog, sdlog), "Gamma" (shape, scale), "Exponential" (rate) or "Pareto" (alpha, x_m).

severity_params

Its parameters, in that order or named.

Value

An object of class netsimr_exposure_rating, a list with bands (the profile with each band's loss ratio, expected loss, the shares of the curve at the deductible and the exhaustion point, the layer's share and the expected layer loss), expected_loss (the layer's), rate (the expected layer loss as a share of the subject premium), subject_premium, ground_up_loss, the layer and the curve or severity.

See Also

burning_cost and pareto_rating, the experience rating of a layer, and technical_premium.

Other reinsurance pricing functions: burning_cost(), credibility_weight(), mbbefd_curve(), pareto_rating(), technical_premium()

Examples

rating <- property_exposure_rating(xl_property_profile, deductible = 2e6, limit = 8e6,
                                   curve = "Y3", loss_ratio = 0.55)
rating
rating$bands[, c("band", "sum_insured", "layer_share", "layer_loss")]

casualty_exposure_rating(xl_casualty_profile, deductible = 1e6, limit = 4e6,
                         severity = "LogNormal", severity_params = c(10, 2), loss_ratio = 0.65)

The inverse cumulative distribution function of a Sliced Gamma Pareto severity distribution

Description

Gives the claim amount that a claim from a sliced severity distribution, with Gamma attritional claims below the slice point and a Pareto tail above it, stays at or below with probability q; the inverse of pSlicedGammaPareto.

Usage

qSlicedGammaPareto(q, GShape, GRate, SlicePoint, PShape)

qsliced_gamma_pareto(q, GShape, GRate, SlicePoint, PShape)

Arguments

q

A real number between 0 and 1 - the probability where the inverse cumulative distribution function will be evaluated. Values outside [0, 1] give NaN with a warning, as in qgamma().

GShape

A positive real number - the shape parameter of the attritional Claim Severity's Gamma distribution.

GRate

A positive real number - the rate parameter of the attritional Claim Severity's Gamma distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the Gamma distribution.

PShape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

PShape is the Pareto shape parameter, usually written alpha; the sliced LogNormal-Pareto functions call the same parameter shape.

Value

The value of the inverse cumulative distribution function at q with an attritional claim Gamma distribution with parameters GShape and GRate and a large claim Pareto distribution with parameters SlicePoint and PShape. A non-numeric argument or a non-positive parameter is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedGammaParetoMean(), SlicedLNormParetoMean(), dSlicedGammaPareto(), dSlicedLNormPareto(), pSlicedGammaPareto(), pSlicedLNormPareto(), qSlicedLNormPareto()

Examples

qSlicedGammaPareto(0.5,1,0.0005,1000,1.2)
qSlicedGammaPareto(0.2,1.1,0.0006,2000,1.6)
qSlicedGammaPareto(0.8,1.2,0.0004,3000,1.4)

The inverse cumulative distribution function of a Sliced LogNormal Pareto severity distribution

Description

Gives the claim amount that a claim from a sliced severity distribution, with LogNormal attritional claims below the slice point and a Pareto tail above it, stays at or below with probability q; the inverse of pSlicedLNormPareto.

Usage

qSlicedLNormPareto(q, mu, sigma, SlicePoint, shape)

qsliced_lnorm_pareto(q, mu, sigma, SlicePoint, shape)

Arguments

q

A real number between 0 and 1 - the probability where the inverse cumulative distribution function will be evaluated. Values outside [0, 1] give NaN with a warning, as in qlnorm().

mu

A real number - the first parameter of the attritional Claim Severity's LogNormal distribution.

sigma

A positive real number - the second parameter of the attritional Claim Severity's LogNormal distribution.

SlicePoint

A positive real number - the slice point and the scale parameter of the tail Claim Severity's Pareto distribution. An infinite slice point gives the LogNormal distribution.

shape

A positive real number - the shape parameter of the tail Claim Severity's Pareto distribution.

Details

shape is the Pareto shape parameter, usually written alpha; the sliced Gamma-Pareto functions call the same parameter PShape.

Value

The value of the inverse cumulative distribution function at q with an attritional claim LogNormal distribution with parameters mu and sigma and a large claim Pareto distribution with parameters SlicePoint and shape. A non-numeric argument or a non-positive sigma, SlicePoint or shape is an error; NA values give NA.

See Also

Other sliced distribution functions: SlicedGammaParetoMean(), SlicedLNormParetoMean(), dSlicedGammaPareto(), dSlicedLNormPareto(), pSlicedGammaPareto(), pSlicedLNormPareto(), qSlicedGammaPareto()

Examples

qSlicedLNormPareto(0.5,6,1.5,1000,1.2)
qSlicedLNormPareto(0.7,7,1.6,3000,1.4)

Paid and incurred triangles of the Munich chain ladder paper

Description

The cumulative paid and incurred claims of seven accident years with which Quarg and Mack (2004) introduce the Munich chain ladder.

Usage

quarg_mack_paid

quarg_mack_incurred

Format

Numeric matrices with 7 rows (accident years) and 7 columns (development years), NA for the future, with values in the same cells.

An object of class matrix (inherits from array) with 7 rows and 7 columns.

Source

Quarg, G. and Mack, T. (2004). Munich chain ladder. Blatter DGVFM 26(4), 597-630.

See Also

munich_chain_ladder.

Examples

munich_chain_ladder(quarg_mack_paid, quarg_mack_incurred)$by_origin

RAA triangle of incurred claims

Description

The cumulative incurred claims of the Reinsurance Association of America for accident years 1981 to 1990, in thousands: the triangle of Mack (1994), much used to compare reserving methods.

Usage

raa_triangle

Format

A numeric matrix with 10 rows (accident years 1981 to 1990) and 10 columns (development years 1 to 10), NA for the future.

Source

Mack, T. (1994). Measuring the variability of chain ladder reserve estimates. Casualty Actuarial Society Forum, Spring 1994, 101-182.

See Also

chain_ladder.

Examples

raa_triangle
chain_ladder(raa_triangle)$total

Reinstatement premiums of an excess of loss layer

Description

The premium paid to reinstate the cover of an each-and-every-loss layer after claims have used it, for each simulated period: pro rata to the amount reinstated, as is usual in the market, and not to the time left in the period.

Usage

reinstatement_premium(reinstatements_used, premium, rates = 1)

Arguments

reinstatements_used

The number of reinstatements used in each period, non-negative and counted pro rata to the amount recovered; NA gives NA.

premium

The upfront (deposit) premium of the layer, a non-negative number.

rates

The premium rate of each reinstatement as a share of the upfront premium: one rate for every reinstatement, or one per reinstatement, the first reinstatement first. Defaults to 1 (100%).

Details

Reinstatement k restores the layer's limit once the recoveries pass k limits. With u reinstatements used (the period's recoveries divided by the limit, capped at the number of reinstatements, as number_of_reinstatements_used of simulate_function counts them), the share of reinstatement k used is \min(\max(u - (k - 1), 0), 1), and its premium is that share times its rate times the upfront premium. A rate of 1 charges the full upfront premium for a full reinstatement: two reinstatements at 100% are rates = 1, and one at 100% and one at 50% are rates = c(1, 0.5).

Value

A numeric vector with the reinstatement premium of each period.

See Also

simulate_claims and simulate_function, which add these premiums to their results when given an upfront premium.

Examples

# an upfront premium of 100,000 and reinstatements at 100%
reinstatement_premium(c(0, 0.25, 1, 1.5, 2), premium = 1e5)

# one reinstatement at 100% and one at 50%
reinstatement_premium(c(0.5, 1, 1.5, 2), premium = 1e5, rates = c(1, 0.5))

Server function of the reinsurance pricing tool

Description

Reads the layer and the rating year, rates the layer on the large losses (burning cost and Pareto) and on the risk profile (exposure curve or claim size distribution), blends the rates and prices the layer; paired with reinsurance_pricing_tool_UI by run_shiny_reinsurance_pricing_tool.

Usage

reinsurance_pricing_tool_Server(input, output, session)

Arguments

input

Input for the server function.

output

Output for the server function.

session

Session for the server function.

Value

Called by shiny for its side effects, the outputs and observers of a session; the value is not used.


User interface of the Shiny reinsurance pricing tool

Description

The page of the reinsurance pricing application: a welcome tab, the layer, the experience rating, the exposure rating and the pricing, with the settings beside the results; run_shiny_reinsurance_pricing_tool pairs it with reinsurance_pricing_tool_Server. Like the package's other applications, the page is built each time the application starts, not when the package is installed, so that its theme compiles from where bslib is installed on the machine running it.

Usage

reinsurance_pricing_tool_UI(request)

Arguments

request

The request of the browser, passed by shiny; not used.

Value

The user interface of the application, a bslib navbar page.


A vector with the reinsurance structure options

Description

The names of the reinsurance structures that apply_deductible_limit and simulate_function accept, used by the simulator app as the choices of its structure inputs and to validate saved settings.

Usage

reinsurance_structures_options

Value

The reinsurance structure options


Server function of the reserving tool

Description

Builds the triangle from the example or the uploaded file, fits the chain ladder with the user's development settings, computes the ultimates of each method with the premiums and loss ratios of each origin, and runs the bootstrap; paired with reserving_tool_UI by run_shiny_reserving_tool.

Usage

reserving_tool_Server(input, output, session)

Arguments

input

Input for the server function.

output

Output for the server function.

session

Session for the server function.

Value

Called by shiny for its side effects, the outputs and observers of a session; the value is not used.


User interface of the Shiny reserving tool

Description

The page of the reserving application: a welcome tab, the data, the development factors, the ultimates of each method and the uncertainty of the reserves, with the settings beside the results; run_shiny_reserving_tool pairs it with reserving_tool_Server. Like the package's other applications, the page is built each time the application starts, not when the package is installed, so that its theme compiles from where bslib is installed on the machine running it.

Usage

reserving_tool_UI(request)

Arguments

request

The request of the browser, passed by shiny; not used.

Value

The user interface of the application, a bslib navbar page.


Risk adjustment for non-financial risk

Description

The compensation for bearing the uncertainty of the claims, the risk adjustment of IFRS 17 or the risk margin of Solvency II, by one of two methods: a percentile of the distribution of the reserves, or the cost of the capital held until the claims are paid.

Usage

risk_adjustment(
  method = c("percentile", "cost of capital"),
  boot = NULL,
  level = 0.75,
  discounted = NULL,
  capital = NULL,
  coc_rate = 0.06
)

Arguments

method

"percentile" or "cost of capital".

boot

The bootstrap_chain_ladder of the reserves: needed for the percentile method, and for the confidence level of the cost of capital method.

level

The confidence level of the percentile method, such as 0.75.

discounted

The discount_reserves of the reserves: its payments give the run-off of the cost of capital method, its yield curve the discounting, and its ratio of discounted to undiscounted reserve scales the percentile method. Needed for the cost of capital method.

capital

The capital held now for the reserves, such as their Solvency II reserve risk (sii_premium_reserve_risk) or the bootstrap's 99.5% quantile less its mean. Needed for the cost of capital method.

coc_rate

The cost of capital rate a year: 6% under Solvency II before 2027.

Details

The percentile method takes the bootstrap's total reserves: the risk adjustment is their level quantile less their mean, and the confidence level is level.

The cost of capital method projects the capital capital held now over the run-off of the reserves, in proportion to the reserve still to be paid at the start of each period, and charges coc_rate of it for each period, discounted to now: RA = \code{coc\_rate} \sum_t C_t (1 + r_t)^{-t}, as the Solvency II risk margin is found. With the bootstrap given too, the confidence level that IFRS 17 asks to disclose is the share of the simulated reserves at or below the mean plus the risk adjustment.

The discounting of the reserves applies to the risk adjustment too: with a discounted best estimate (discount_reserves), the percentile risk adjustment is scaled by the ratio of the discounted to the undiscounted reserve.

Value

A list with the method, the risk adjustment, the confidence level (NA without the bootstrap for the cost of capital method), and for the cost of capital method the projected capital and its discounted cost by period.

See Also

discount_reserves, bootstrap_chain_ladder.

Examples

paid <- as_triangle(simulated_motor_claims, "accident_year", "development_year", "paid",
                    cumulative = FALSE)
boot <- bootstrap_chain_ladder(paid, n = 2000, seed = 1)
be <- discount_reserves(paid, yield_curve = 0.03)
risk_adjustment("percentile", boot = boot, level = 0.75, discounted = be)$risk_adjustment
# the cost of 6% a year of the capital at 99.5%, over the run-off
capital <- boot$total[["p99.5"]] - boot$total[["ibnr"]]
ra <- risk_adjustment("cost of capital", boot = boot, discounted = be, capital = capital)
c(ra$risk_adjustment, ra$confidence_level)

Run the distribution fitting application

Description

Opens NetDisFit, a shiny application that fits frequency and severity distributions to an uploaded claims file, compares them with the data, and splices Pareto tails onto a LogNormal body or fits a piecewise Pareto at chosen slicing points, ready for the NetSimR simulator.

Usage

run_shiny_distribution_fitting_tool()

Value

A shiny app object. Printing it, as happens when the function is called at the console, opens the application; it can also be passed to shiny::runApp().

See Also

run_shiny_simulator and run_shiny_glm_fitting_tool, two of the package's other applications; SlicedLNormParetoMean, SlicedLNormParetoCappedMean, SlicedGammaParetoMean and SlicedGammaParetoCappedMean for the moments of the sliced distributions the tool fits.

Examples

if (interactive()) {
  run_shiny_distribution_fitting_tool()
}

Run the generalised linear model fitting application

Description

Opens NetGLM, a Shiny application that imports data from a CSV file or a database query, fits generalised linear models to it, compares the AIC of stored models, suggests terms by stepwise AIC or BIC, charts actual against predicted values, validates the model on rows held out for testing (deviance per row, Gini coefficient, lift and double lift charts) and downloads the model and its predictions.

Usage

run_shiny_glm_fitting_tool()

Details

The formula typed in the application, or read from one of its settings files, is restricted to the columns of the imported data, numbers, the formula operators and a small set of formula functions: I(), log(), exp(), sqrt(), pmin(), pmax(), poly(), the splines ns() and bs(), cut() with c() for its breaks, factor(), as.factor(), interaction() and offset(). Any other call is refused, so a settings file shared between colleagues cannot run code.

Value

A shiny app object. Printing it, as happens when the function is called at the console, opens the application; it can also be passed to shiny::runApp().

See Also

run_shiny_distribution_fitting_tool and run_shiny_simulator, the package's other applications.

Examples

if (interactive()) {
  run_shiny_glm_fitting_tool()
}

Run the portfolio capital application

Description

Opens NetCapital, a shiny application for the capital of a portfolio of several lines of business: each line's annual losses are simulated from a frequency and a severity, or uploaded (simulated by the claims simulator or another model), and joined by a Gaussian or t copula with a correlation for every pair of lines or a matrix. It gives the value at risk and tail value at risk of each line and of the total, the diversification benefit, each line's share of the capital (co-TVaR), charts and a report.

Usage

run_shiny_portfolio_tool()

Value

A shiny app object. Printing it, as happens when the function is called at the console, opens the application; it can also be passed to shiny::runApp().

See Also

simulate_portfolio, the function behind the application; run_shiny_simulator, whose simulated losses it can take, and the package's other applications.

Examples

if (interactive()) {
  run_shiny_portfolio_tool()
}

Run the reinsurance pricing application

Description

Opens NetTreaty, a shiny application for pricing an excess of loss layer: it rates the layer on its loss experience, with the burning cost and a Pareto model of the large losses, and on its exposure, with a risk profile and an MBBEFD exposure curve (property) or a claim size distribution (casualty), blends the two with a credibility weight, and gives the technical premium, with reinstatements, rate on line and payback.

Usage

run_shiny_reinsurance_pricing_tool()

Value

A shiny app object. Printing it, as happens when the function is called at the console, opens the application; it can also be passed to shiny::runApp().

See Also

burning_cost, pareto_rating, property_exposure_rating, casualty_exposure_rating and technical_premium, the methods of the application; run_shiny_simulator, run_shiny_distribution_fitting_tool, run_shiny_glm_fitting_tool and run_shiny_reserving_tool, the package's other applications.

Examples

if (interactive()) {
  run_shiny_reinsurance_pricing_tool()
}

Run the claims reserving application

Description

Opens NetReserve, a shiny application for claims reserving: it loads a claims triangle (an example, or a file with a row per origin and development period or a row per origin), lets the user choose the development factors (their average, the calendar periods used, link ratios left out, a tail factor or curve), compares the chain ladder, Bornhuetter-Ferguson, Benktander and Cape Cod ultimates and loss ratios of each origin, and measures the uncertainty of the reserves with Mack's standard errors and a bootstrap.

Usage

run_shiny_reserving_tool()

Value

A shiny app object. Printing it, as happens when the function is called at the console, opens the application; it can also be passed to shiny::runApp().

See Also

chain_ladder, bornhuetter_ferguson, cape_cod and bootstrap_chain_ladder, the methods of the application; run_shiny_simulator, run_shiny_distribution_fitting_tool and run_shiny_glm_fitting_tool, the package's other applications.

Examples

if (interactive()) {
  run_shiny_reserving_tool()
}

Run the claims simulator application

Description

Opens NetSimulator, a Shiny app for running the frequency-severity model of simulate_function from a form, with charts, a report and saved settings, without writing any code.

Usage

run_shiny_simulator()

Value

A shiny app object (class shiny.appobj). Printing it, as happens when run_shiny_simulator() is called at the console, opens the app; pass it to shiny::runApp() to choose options such as the port.

See Also

simulate_claims and simulate_function, which run the same model from R code.

Examples

if (interactive()) {
  run_shiny_simulator()
}

A vector with the severity distribution objects

Description

A named list of distributionClass objects, one for each severity distribution of the simulator: Normal, LogNormal, Gamma, Exponential, Pareto, Weibull, Burr, Generalised_Pareto and Fixed_Severity. The names are the values accepted by the sevDistr argument of simulate_function(). The Normal distribution has its own parameter ids (normal_mean, normal_sd), so that switching between the Normal and the Log-Normal in the app does not carry values across, and so have the Weibull, the Burr and the Generalised Pareto.

Usage

sev_dist_options

Details

The Burr (type XII) has P(X > x) = (1 + (x / scale)^gamma)^(-alpha) for x > 0: a Pareto tail of index alpha * gamma over a body shaped by gamma (alpha = 1 is the log-logistic, gamma = 1 the Lomax). The Generalised Pareto has P(X > x) = (1 + shape * (x - location) / scale)^(-1 / shape) for x above its location: a Pareto tail of index 1 / shape for a positive shape, the Exponential for shape 0 and a tail that ends at location - scale / shape for a negative one.

Value

The severity distribution objects.


A data frame with the severity distribution parameter placeholders

Description

One row per parameter of the severity distribution with the most parameters, giving the number and output id of the placeholder in which the simulator app renders that parameter's input for the chosen distribution.

Usage

sev_dist_parameter_placeholders

Value

The severity distribution parameter placeholders.


Server function for the Shiny Simulator application

Description

Builds the dynamic inputs of the claims simulator, runs the simulations when asked and serves the results tabs, the downloads and the saving and loading of settings; it is the server that run_shiny_simulator pairs with shiny_simulator_ui.

Usage

shiny_simulator_server(input, output, session)

Arguments

input

Input for the server function.

output

Output for the server function.

session

Session for the server function.

Value

Called by shiny for its side effects, the outputs and observers of a session; the value is not used.


User interface of the Shiny NetSimR simulator

Description

The page the simulator opens in: a welcome panel and the simulator itself, where the claim, reinsurance and run settings are entered and the results, charts and report are shown. The page is built each time the application starts, not when the package is installed: its theme compiles Bootstrap's SCSS files from where bslib is installed on the machine running it, and a page built at installation kept the paths of the machine that built the package (for a CRAN binary, CRAN's build machine), where nobody else's bslib is.

Usage

shiny_simulator_ui(request)

Arguments

request

The request of the browser, passed by shiny; not used.

Value

The user interface of the application, a bslib navbar page, which run_shiny_simulator pairs with shiny_simulator_server.


The Solvency II standard formula's non-life segments

Description

The twelve segments of the Solvency II standard formula for non-life premium and reserve risk, with the standard deviations of their premium (gross) and reserve risk, as Annex II of Commission Delegated Regulation (EU) 2015/35 sets them after its amendment by Delegated Regulation (EU) 2019/981; and the correlations between the segments, Annex IV.

Usage

sii_nonlife_segments

sii_nonlife_correlation

Format

sii_nonlife_segments: a data frame with 12 rows and 4 columns: the segment's number, its name, and the standard deviations of premium risk and of reserve risk, as shares. sii_nonlife_correlation: the 12 by 12 matrix of correlations between the segments.

Source

Commission Delegated Regulation (EU) 2015/35, Annexes II and IV, as amended by Commission Delegated Regulation (EU) 2019/981.

See Also

sii_premium_reserve_risk.


Solvency II standard formula: non-life premium and reserve risk

Description

The capital requirement for non-life premium and reserve risk of the Solvency II standard formula (Articles 115 to 117 of Commission Delegated Regulation (EU) 2015/35), from the volume measures of each segment.

Usage

sii_premium_reserve_risk(
  volumes,
  np_adjustment = NULL,
  premium_sd = NULL,
  reserve_sd = NULL
)

Arguments

volumes

A data frame with a row per segment the undertaking writes: its segment (the number, 1 to 12, of sii_nonlife_segments), its premium and reserve volume measures, and optionally its geographical diversification (1 when not given).

np_adjustment

The segments whose premium standard deviation takes the 80% adjustment for non-proportional reinsurance: NULL (the default) for none, or some of 1, 4 and 5.

premium_sd, reserve_sd

Undertaking-specific standard deviations replacing the standard ones, named by segment number (such as c("4" = 0.06)), or NULL.

Details

The standard deviation of a segment combines those of its premium and reserve risk with a correlation of 50%:

\sigma_s = \frac{\sqrt{(\sigma_{p,s} V_{p,s})^2 + \sigma_{p,s} \sigma_{r,s} V_{p,s} V_{r,s} + (\sigma_{r,s} V_{r,s})^2}}{V_{p,s} + V_{r,s}},

and its volume is V_s = (V_{p,s} + V_{r,s}) (0.75 + 0.25 DIV_s), with DIV_s its geographical diversification (1 for business in a single region). The segments are joined with the correlations CorrS of Annex IV: \sigma = \sqrt{\sum_{s,t} CorrS_{s,t} \sigma_s V_s \sigma_t V_t} / V, with V = \sum_s V_s, and the capital requirement is 3 \sigma V.

The premium volume of a segment is, under Article 116, the larger of the earned premium of the next year and of the last year, plus the expected premiums of existing and future contracts beyond the next year; the reserve volume is its best estimate of the claims provision, net of reinsurance. They are given here; the function does not derive them. The adjustment for non-proportional reinsurance (80% of the premium standard deviation of segments 1, 4 and 5, Article 117(3)) is applied to the segments asked for, where the undertaking's reinsurance qualifies.

Value

A list with by_segment, a data frame with each segment's volumes, its standard deviations, its volume measure and its capital on its own (3 \sigma_s V_s); total, the volume measure, the standard deviation, the capital requirement, the sum of the segments' capital and the diversification between them; and reserve_risk and premium_risk, the capital of each risk alone (the same formula with the other volume set to zero).

References

Commission Delegated Regulation (EU) 2015/35, Articles 115 to 117 and Annexes II and IV, as amended by Commission Delegated Regulation (EU) 2019/981.

See Also

sii_nonlife_segments, risk_adjustment.

Examples

volumes <- data.frame(segment = c(1, 2, 4), premium = c(40e6, 25e6, 30e6),
                      reserve = c(60e6, 10e6, 20e6))
sii <- sii_premium_reserve_risk(volumes)
sii$total
sii$by_segment[, c("name", "sd", "volume", "capital")]

Simulate claims with a frequency-severity model

Description

A simpler interface to simulate_function, with short argument names and defaults for everything optional. Leaving an option out (NULL) switches the feature off: no seed, no Pareto slices, no cap, no reinstatement limit.

Usage

simulate_claims(
  n_sims,
  frequency,
  frequency_params,
  severity,
  severity_params,
  seed = NULL,
  truncate_at_zero = FALSE,
  pareto_thresholds = NULL,
  pareto_alphas = NULL,
  severity_cap = NULL,
  eel_layer = "none",
  eel_deductible = NULL,
  eel_limit = NULL,
  eel_reinstatements = NULL,
  eel_premium = NULL,
  eel_reinstatement_rates = 1,
  agg_layer = "none",
  agg_deductible = NULL,
  agg_limit = NULL,
  parallel = FALSE,
  workers = NULL,
  chunk_size = NULL,
  gross = TRUE,
  shortcuts = TRUE,
  progress = NULL,
  largest_claims = FALSE
)

Arguments

n_sims

Number of simulations (e.g. years).

frequency

Name of the claim count distribution; see Details.

frequency_params

Parameters of the claim count distribution, either all unnamed in the order of Details or all named.

severity

Name of the claim size distribution; see Details.

severity_params

Parameters of the claim size distribution, either all unnamed in the order of Details or all named.

seed

A whole number for a reproducible run. NULL (the default) uses the current random number stream, so set.seed() before the call also makes the run reproducible.

truncate_at_zero

TRUE to draw Normal claim sizes from the Normal distribution truncated at zero, so no claim is negative. Only used with the Normal severity.

pareto_thresholds

Increasing claim sizes above which the severity tail is replaced by Pareto slices, one per slice (at most six). NULL (the default) for no slices.

pareto_alphas

The Pareto alpha of each slice, one per threshold.

severity_cap

The largest amount a single claim can reach, or NULL (the default) for no cap.

eel_layer

The each-and-every-loss layer: "none" (the default), "unlimited", "limited" or "exclude".

eel_deductible

The deductible of the each-and-every-loss layer.

eel_limit

The limit of a "limited" or "exclude" each-and-every-loss layer.

eel_reinstatements

The number of reinstatements of a "limited" each-and-every-loss layer, so it pays at most (eel_reinstatements + 1) * eel_limit per simulation. NULL (the default) for unlimited reinstatements.

eel_premium

The upfront premium of the each-and-every-loss layer, which prices the reinstatements used: given, the results gain the column reinstatement_premium. Needs eel_reinstatements. NULL (the default) for none.

eel_reinstatement_rates

The premium rate of each reinstatement as a share of eel_premium: one rate for all of them, or one per reinstatement. Defaults to 1 (100%). See reinstatement_premium.

agg_layer

The aggregate layer: "none" (the default), "unlimited", "limited" or "exclude".

agg_deductible

The deductible of the aggregate layer.

agg_limit

The limit of a "limited" or "exclude" aggregate layer.

parallel

TRUE to run the chunks of simulations on parallel workers, FALSE (the default) to run them in this session, or "auto" to use workers only when that is expected to be at least a quarter faster, which for workers started by the call means a run of a few seconds or more. Results are the same either way. See simulate_function.

workers

The workers of a parallel run: NULL (the default) for one per available core, a number of workers (both started for the call and shut down after it), or a cluster from parallel::makeCluster(), which is used and left running so that several calls share it. See simulate_function.

chunk_size

The number of simulations per vectorised batch; NULL (the default) chooses it from the expected number of claims, aiming at about a million claims per batch but never fewer than 100 simulations, so batches are larger when the mean frequency exceeds 10,000. Results with a fixed seed depend on it.

gross

TRUE (the default) to return the gross totals before the layers. FALSE allows a much faster run with an "unlimited" or "limited" each-and-every-loss layer, by drawing only the claims that reach it.

shortcuts

TRUE (the default) to use exact shortcuts where the settings allow; see simulate_function.

progress

An optional function called after each chunk of a sequential run with the fraction done and a short description.

largest_claims

TRUE to add the column largest_claim: each simulation's largest single claim after the each-and-every-loss layer (the gross claim without one), for occurrence exceedance (OEP). Defaults to FALSE; every claim is then drawn, so it can be slower for very high frequencies.

Details

Distributions are chosen by name; case, spaces and underscores are ignored, so "Negative Binomial", "negative_binomial" and "Negative_Binomial" are the same. Their parameters are given in the order below, or named with these names:

Distribution Type Parameters
Poisson frequency lambda
Negative_Binomial frequency r, beta (Gamma shape and scale of the Poisson mean)
Binomial frequency n, p
Zero_Inflated_Poisson frequency lambda, zero_prob (probability of an extra zero)
Zero_Inflated_Negative_Binomial frequency r, beta, zero_prob
Fixed_number_of_Counts frequency count
Normal severity mean, sd
LogNormal severity meanlog, sdlog
Gamma severity shape, scale
Exponential severity rate
Pareto severity alpha, x_m (minimum)
Weibull severity shape, scale
Burr severity alpha, gamma, scale
Generalised_Pareto severity location, scale, shape
Fixed_Severity severity amount

The Burr (type XII) has P(X > x) = (1 + (x / scale)^gamma)^(-alpha), a Pareto tail of index alpha * gamma over a body shaped by gamma. The Generalised Pareto has P(X > x) = (1 + shape * (x - location) / scale)^(-1 / shape) above its location: a Pareto tail of index 1 / shape for a positive shape, and the Exponential for shape 0.

Layers are "none", "unlimited" (everything above the deductible), "limited" (the limit excess of the deductible) or "exclude" (the claims with that layer removed). The each-and-every-loss layer applies to every claim; the aggregate layer applies to each simulation's total after the each-and-every-loss layer. The order is: severity cap -> each-and-every-loss layer per claim -> sum over the simulation -> aggregate deductible -> aggregate limit and reinstatement capacity. So with a "limited" each-and-every-loss layer and an "unlimited" or "limited" aggregate layer, the ceded total is min(max(S - agg_deductible, 0), agg_limit, (eel_reinstatements + 1) * eel_limit), where S is the sum of the layer's recoveries; three claims of 100 through a layer of 100 excess of 0 with no reinstatements and an aggregate deductible of 50 cede 100. An "exclude" aggregate layer is taken out of the recoveries after the reinstatement capacity has capped them. See simulate_function for the details.

Value

A data frame with one row per simulation, at full precision: claim_counts, total_claims (after the layers), gross_claims (before them, unless gross = FALSE) and, with limited reinstatements, number_of_reinstatements_used: the layer's recoveries in the simulation divided by eel_limit, capped at eel_reinstatements. The recoveries are taken after the aggregate deductible and limit of an "unlimited" or "limited" aggregate layer, but before an "exclude" aggregate layer is taken out: with an exclusion, the reinstatements are counted on the each-and-every-loss recoveries (after the reinstatement capacity). So three claims of 100 through a layer of 60 excess of 30 with two reinstatements and an "exclude" aggregate layer of 150 excess of 50 give a total of 50 but 2 reinstatements used. With eel_premium, reinstatement_premium: the premium for the reinstatements used, pro rata to the amount reinstated.

See Also

simulate_function, which this calls, and run_shiny_simulator for the same model in an app.

Examples

# 10,000 years of Poisson claim counts with Log-Normal claim sizes
claims <- simulate_claims(
  10000, frequency = "Poisson", frequency_params = 3,
  severity = "LogNormal", severity_params = c(meanlog = 8, sdlog = 1.5), seed = 1
)
summary(claims$total_claims)

# a Pareto tail above 100,000, and a layer of 50,000 excess of 20,000 on each
# claim with two reinstatements
ceded <- simulate_claims(
  10000, "Poisson", 3, "LogNormal", c(8, 1.5), seed = 1,
  pareto_thresholds = 100000, pareto_alphas = 1.5,
  eel_layer = "limited", eel_deductible = 20000, eel_limit = 50000,
  eel_reinstatements = 2, eel_premium = 10000
)
mean(ceded$total_claims)
# the expected reinstatement premium, at 100% of the upfront premium of 10,000
mean(ceded$reinstatement_premium)

Simulate insurance claims with reinsurance structures

Description

A function to simulate frequency - severity of insurance claims using chunked vectorisation. The function applies severity cap, reinsurance structure for each and every loss claim, reinsurance structure for aggregate claims, and allows for piecewise Pareto slices

Usage

simulate_function(
  numOfSimulations,
  freq_params,
  sev_params,
  seedSetBinary = !is.null(seedValue),
  seedValue = NULL,
  freqDistr,
  sevDistr,
  paretoSlice = FALSE,
  pareto_slice_times = NULL,
  slice_pareto_alphas = NULL,
  slice_pareto_x_ms = NULL,
  sevCapBinary = FALSE,
  sev_cap_amount = NULL,
  reinsuranceStructureEEL = "No Reinsurance Structure",
  reinsurance_structure_eel_deductible_amount = NULL,
  reinsurance_structure_eel_limit_amount = NULL,
  reinsuranceStructureAL = "No Reinsurance Structure",
  reinsurance_structure_al_deductible_amount = NULL,
  reinsurance_structure_al_limit_amount = NULL,
  reinsuranceStructureLimitedReinstatements = FALSE,
  reinsuranceStructureReinstatementLimit = NULL,
  reinsurance_structure_eel_premium = NULL,
  reinsurance_structure_eel_reinstatement_rates = 1,
  multiprocessing = FALSE,
  workers = NULL,
  sevTruncateAtZero = FALSE,
  chunk_size = NULL,
  gross = TRUE,
  shortcuts = TRUE,
  progress = NULL,
  largest_claims = FALSE,
  reinsurance_structure_eel_dedctible_amount = NULL,
  reinsurance_structure_al_dedctible_amount = NULL
)

Arguments

numOfSimulations

The number of simulations to run.

freq_params

A vector of the frequency distribution parameters.

sev_params

A vector of the severity distribution parameters.

seedSetBinary

True if there is a fixed seed (seedValue), otherwise false. Defaults to TRUE when a seedValue is given and FALSE otherwise, so a seedValue on its own makes the run reproducible; an explicit FALSE ignores seedValue.

seedValue

The seed value, a whole number between -.Machine$integer.max and .Machine$integer.max, or NULL (the default) for no fixed seed.

freqDistr

The frequency distribution: "Poisson", "Negative_Binomial", "Binomial", "Zero_Inflated_Poisson", "Zero_Inflated_Negative_Binomial" or "Fixed_number_of_Counts". The parameters of each are listed in simulate_claims.

sevDistr

The severity distribution: "Normal", "LogNormal", "Gamma", "Exponential", "Pareto" or "Fixed_Severity". The parameters of each are listed in simulate_claims.

paretoSlice

True if there is Pareto slicing.

pareto_slice_times

The number of Pareto slices.

slice_pareto_alphas

A vector of Pareto slices' alpha parameters.

slice_pareto_x_ms

A vector of Pareto slices' x_m parameters.

sevCapBinary

True if there is a severity cap.

sev_cap_amount

The severity cap amount.

reinsuranceStructureEEL

The chosen reinsurance structure for each and every loss claim.

reinsurance_structure_eel_deductible_amount

The deductible for each and every loss reinsurance structure.

reinsurance_structure_eel_limit_amount

The limit for each and every loss reinsurance structure.

reinsuranceStructureAL

The chosen reinsurance structure for aggregate claims.

reinsurance_structure_al_deductible_amount

The deductible for aggregate reinsurance structure.

reinsurance_structure_al_limit_amount

The limit for aggregate reinsurance structure.

reinsuranceStructureLimitedReinstatements

True if there is a limit in reinstatements, otherwise false.

reinsuranceStructureReinstatementLimit

The reinstatement limit.

reinsurance_structure_eel_premium

The upfront premium of the EEL layer, or NULL (the default) for none. Given with a limited number of reinstatements, the results gain the column reinstatement_premium; ignored otherwise.

reinsurance_structure_eel_reinstatement_rates

The premium rate of each reinstatement as a share of the upfront premium: one rate for all of them, or one per reinstatement. Defaults to 1 (100%). See reinstatement_premium.

multiprocessing

TRUE to run the chunks in parallel on worker R processes (base R's parallel package), FALSE (the default) to run them in this session, or "auto" to run them on workers only when that is expected to be at least a quarter faster. Results are the same either way. "auto" estimates both times from the expected number of claims drawn, the number of simulations and chunks, the cores, and whether the workers are already running: starting them takes about a second, so a single run goes to them from a few seconds of work, while a cluster given as workers is used from a fraction of a second; with workers = NULL it also chooses how many to start. A run of a single chunk runs in this session, unless TRUE is given with a cluster.

workers

The workers of a parallel run: NULL (the default) for one per available core (getOption("mc.cores") if set, otherwise parallel::detectCores(), at most 2 under R CMD check), or a number of workers; these are started for the call and shut down when it finishes, so each call pays the start-up cost. To reuse workers across calls, pass a cluster made with parallel::makeCluster(): it is used as it is and left running, to be stopped with parallel::stopCluster(). A function with no arguments that returns such a cluster is called only when the run goes to the workers (as "auto" decides), which lets a caller start them when they are first needed. Ignored unless multiprocessing is TRUE or "auto".

sevTruncateAtZero

True to draw Normal severities from the Normal distribution truncated at zero, so that no claim is negative. Ignored for other severity distributions. Defaults to FALSE.

chunk_size

The number of simulations processed per vectorised batch. By default (NULL) it is chosen from the expected number of claims per simulation, so that a batch holds about a million claims (between 100 and 10,000 simulations). Because of the floor of 100 simulations, a batch holds more than a million claims when the mean frequency exceeds 10,000 claims per simulation (about 100 million at a mean of a million), and memory use grows with it; give a smaller chunk_size to keep batches small. Results with a fixed seed depend on the chunk size.

gross

True (the default) to return the gross total claims before reinsurance. Set it to FALSE when only the totals after the structures are needed: with an each-and-every-loss layer this allows drawing only the claims that reach the layer, which is much faster.

shortcuts

True (the default) to use exact shortcuts where the settings allow: when no layer, cap, Pareto slice or truncation acts on individual claims, each simulation's total is drawn in one step for the Normal, Gamma, Exponential and fixed severities; with gross = FALSE and a layer, only the claims above the deductible are drawn. The results follow the same distribution as without shortcuts. Set it to FALSE to simulate every claim.

progress

An optional function called after each chunk of a sequential run with the fraction done and a short description, e.g. to update a progress bar.

largest_claims

True to add the column largest_claim: each simulation's largest single claim, for occurrence exceedance (OEP) as total_claims gives aggregate exceedance (AEP). Defaults to FALSE. Every claim is then drawn, so the one-step shortcut for totals (see shortcuts) is not used.

reinsurance_structure_eel_dedctible_amount, reinsurance_structure_al_dedctible_amount

Deprecated misspellings of reinsurance_structure_eel_deductible_amount and reinsurance_structure_al_deductible_amount, the names before version 0.4.0; they still work, with a warning.

Details

Order of the calculations, for each simulation (a period, e.g. a year): claims are drawn from the severity distribution (with its Pareto slices) and capped at the severity cap; the each-and-every-loss (EEL) structure applies to each claim; the results are summed over the period; then the aggregate deductible comes off that sum, and finally the aggregate limit and the reinstatement capacity cap what is left. In short: cap -> EEL layer per claim -> annual sum -> aggregate deductible -> aggregate limit and reinstatement capacity.

The reinstatement capacity applies to a 'Limited Layer' EEL structure with limited reinstatements, which pays at most (reinstatements + 1) * limit in a period. With an aggregate 'Unlimited Layer' or 'Limited Layer', the ceded total is min(max(S - aggregate deductible, 0), aggregate limit, (reinstatements + 1) * limit), where S is the sum of the period's EEL recoveries before any capacity (the market convention for an annual aggregate deductible). For example, three claims of 100 through a layer of 100 excess of 0 with no reinstatements and an aggregate deductible of 50 cede min(300 - 50, 100) = 100. Without an aggregate structure, the capacity caps S. With an aggregate 'Exclude Layer', the capacity caps S first and the aggregate layer is then taken out of the capped amount. An unlimited EEL layer, or limited reinstatements switched off, has no capacity cap. (Before version 0.2.0 the capacity was applied before the aggregate deductible, which gave smaller ceded totals when the two were combined.)

Totals are returned at full precision; round them only for display.

Random numbers: each chunk of simulations uses its own L'Ecuyer-CMRG random stream, derived from one seed, so a run gives the same results whether or not it runs in parallel. With seedSetBinary = TRUE (the default when a seedValue is given) the run is reproducible from seedValue and the caller's random number stream is left unchanged; otherwise the seed is drawn from the caller's stream, so set.seed() before the call also makes it reproducible. The streams always use Inversion for normal draws and Rejection sampling, so a seed gives the same results whatever the caller's RNGkind(), which is restored afterwards. Results depend on the chunk size, which by default adapts to the expected number of claims per simulation.

Value

A data frame with one row per simulation, at full precision: claim_counts, the claim count; total_claims, the total claims after the reinsurance structures; gross_claims, the gross total claims before them (after Pareto slices and the severity cap; unless gross = FALSE); and, when reinstatements are limited, number_of_reinstatements_used: the EEL layer's recoveries in the period divided by the EEL limit, capped at the number of reinstatements, so reinstatements are counted pro rata to the amount recovered. The recoveries are taken after the aggregate deductible and limit of an aggregate 'Unlimited Layer' or 'Limited Layer', but before an aggregate 'Exclude Layer' is taken out: with an exclusion they are the EEL recoveries after the reinstatement capacity. For example, three claims of 100 through a layer of 60 excess of 30 with two reinstatements and an aggregate exclusion of 150 excess of 50 give a total of 50 but 2 reinstatements used (180 / 60, capped at 2). With an upfront premium, reinstatement_premium: the premium for the reinstatements used, pro rata to the amount reinstated (see reinstatement_premium). With largest_claims = TRUE, largest_claim: the simulation's largest single claim after the each-and-every-loss structure (the layer's loss on that claim; the gross claim when there is no structure), before the reinstatement limit and the aggregate layer, which act on the period's total; 0 for a simulation without claims. Stops with an error that names any required setting that is missing or invalid.

See Also

simulate_claims, a simpler interface with short argument names, and run_shiny_simulator for the same model in an app.

Examples

# 1,000 simulated years of Poisson claim counts with Normal claim sizes, no reinsurance
results <- simulate_function(
  numOfSimulations = 1000, freq_params = 3, sev_params = c(1000, 200),
  seedSetBinary = TRUE, seedValue = 1, freqDistr = "Poisson", sevDistr = "Normal"
)
summary(results$total_claims)

# the same claims ceded to a layer of 1,500 excess of 800 on each claim
layer <- simulate_function(
  numOfSimulations = 1000, freq_params = 3, sev_params = c(1000, 200),
  seedSetBinary = TRUE, seedValue = 1, freqDistr = "Poisson", sevDistr = "Normal",
  reinsuranceStructureEEL = "Limited Layer",
  reinsurance_structure_eel_deductible_amount = 800,
  reinsurance_structure_eel_limit_amount = 1500
)
mean(layer$total_claims)

Simulate a portfolio of dependent lines

Description

Simulates the annual losses of several lines of business, each with its own frequency and severity, and joins them with a Gaussian or t copula, for the capital of the portfolio: its value at risk and tail value at risk, the diversification between the lines, and each line's share of the capital.

Usage

simulate_portfolio(
  lines,
  correlation = 0,
  copula = c("gaussian", "t"),
  df = 4,
  n = 10000,
  level = 0.995,
  seed = NULL
)

Arguments

lines

A named list with one element per line: a list of arguments of simulate_claims (without n_sims and seed), whose total_claims are the line's losses, or a numeric vector of n simulated losses.

correlation

The correlation between the lines' copula draws: a matrix with a row and a column per line, symmetric and positive definite with ones on the diagonal, or one number for every pair of lines.

copula

"gaussian" (the default) or "t".

df

The degrees of freedom of the t copula: the lower, the stronger the dependence in the tail.

n

The number of simulations.

level

The level of the value at risk and the tail value at risk, such as 0.995 (the default) for 1 in 200 years.

seed

A whole number for a reproducible run, or NULL (the default) to use the current random number stream. The stream of the R session is restored after a run with a seed.

Details

Each line is simulated on its own, by simulate_claims (or given as a vector of simulated losses). The lines are then joined by reordering: n draws from the copula give, for each line, the rank its losses take in each simulation, and the line's simulated losses are put in that order. Each line keeps exactly the distribution it was simulated with, and the ranks of the lines follow the copula: with the Gaussian copula, normal draws with the given correlation matrix; with the t copula, the same divided by a shared \sqrt{W / \nu}, W chi-squared with \nu degrees of freedom, which makes large losses in several lines at once more likely (tail dependence). This is the reordering used in capital models (the method of Iman and Conover with the copula's ranks).

The value at risk of the total at level p is its p quantile, and the tail value at risk the mean of the totals at or above it. The diversification benefit is the sum of the lines' VaR less the total's VaR. Each line's capital is its mean loss in the simulations whose total is at or above the total's VaR (co-TVaR, the Euler allocation of the TVaR), so the lines' capitals add up to the total's TVaR.

Value

An object of class netsimr_portfolio, a list with losses, a data frame with a column per line and the total, one row per simulation; summary, a data frame with the mean, standard deviation, VaR and TVaR of each line and of the total, each line's capital (co-TVaR) and its share; diversification, the benefit in amount and as a share of the lines' VaR; and the copula settings.

References

Iman, R. L. and Conover, W. J. (1982). A distribution-free approach to inducing rank correlation among input variables. Communications in Statistics - Simulation and Computation 11(3), 311-334.

See Also

simulate_claims.

Examples

lines <- list(
  motor = list(frequency = "Poisson", frequency_params = 50,
               severity = "LogNormal", severity_params = c(8, 1)),
  property = list(frequency = "Poisson", frequency_params = 5,
                  severity = "Pareto", severity_params = c(1.8, 20000))
)
portfolio <- simulate_portfolio(lines, correlation = 0.3, n = 20000, seed = 1)
portfolio

# stronger dependence in the tail with a t copula
tail <- simulate_portfolio(lines, correlation = 0.3, copula = "t", df = 3, n = 20000, seed = 1)
tail$diversification

Simulated motor claims with premiums

Description

The paid and incurred claims of a simulated motor portfolio, by accident year 2014 to 2025 and development year, with each accident year's earned premium: a table in the long form that as_triangle turns into triangles. Each year's loss ratio is around 68%, and its payments follow a development pattern with over-dispersed (gamma) noise; the incurred claims add case reserves that each year sets a little high or low. The script that made it is in the package's source, under data-raw.

Usage

simulated_motor_claims

Format

A data frame with 78 rows, one per accident and development year of the past, and 5 columns:

accident_year

the accident year, 2014 to 2025;

development_year

the development year, 1 for the accident year itself;

paid

the claims paid in the development year (incremental);

incurred

the change in the incurred claims (paid claims and case reserves) over the development year (incremental);

earned_premium

the accident year's earned premium, on each of its rows.

See Also

as_triangle, bornhuetter_ferguson, cape_cod and munich_chain_ladder.

Examples

triangle <- as_triangle(simulated_motor_claims, "accident_year", "development_year", "paid",
                        cumulative = FALSE)
premium <- unique(simulated_motor_claims[c("accident_year", "earned_premium")])$earned_premium
cape_cod(triangle, premium)$total

Taylor and Ashe triangle of paid claims

Description

The cumulative paid claims of Taylor and Ashe (1983) for ten accident years: the triangle of Mack's (1993) paper on the standard error of the chain ladder.

Usage

taylor_ashe_triangle

Format

A numeric matrix with 10 rows (accident years) and 10 columns (development years), NA for the future.

Source

Taylor, G. C. and Ashe, F. R. (1983). Second moments of estimates of outstanding claims. Journal of Econometrics 23(1), 37-61.

See Also

chain_ladder.

Examples

chain_ladder(taylor_ashe_triangle, sigma = "Mack")$total

Technical premium of an excess of loss layer

Description

The premium of a layer from its expected loss: the total premium covers the expected loss and a loading for expenses, brokerage and profit, and with paid reinstatements part of it comes as reinstatement premium, so the upfront premium is lower.

Usage

technical_premium(
  expected_loss,
  limit,
  loading = 0,
  reinstatements = 0,
  reinstatement_rate = 1,
  used = NULL
)

Arguments

expected_loss

The expected loss of the layer.

limit

The limit of the layer.

loading

The share of the total premium for expenses, brokerage and profit, from 0 to below 1. Defaults to 0.

reinstatements

The number of paid reinstatements; 0 (the default) for none, Inf for unlimited.

reinstatement_rate

The rate of each reinstatement, as a share of the upfront premium. Defaults to 1 (100%).

used

The expected reinstated cover as a share of the limit; NULL (the default) for \min(EL / l, n).

Details

The total premium is EL / (1 - loading). With n reinstatements paid at the rate r of the upfront premium P, pro rata as to amount, the expected reinstatement premium is P r u, where u is the expected reinstated cover as a share of the limit, E[\min(S, n l)] / l for the annual layer loss S; so P = EL / ((1 - loading)(1 + r u)). Without used, u is taken as \min(EL / l, n), which is exact when the annual losses never exceed the reinstated cover; the burning cost's layer losses at the rating premium give a better one (see the examples). For the reinstatement premiums of each simulated year, see reinstatement_premium.

Value

A list with expected_loss, total_premium, upfront_premium, reinstatement_premium (expected), rate_on_line (the upfront premium over the limit), payback (the limit over the upfront premium, in years) and used.

See Also

Other reinsurance pricing functions: burning_cost(), credibility_weight(), mbbefd_curve(), pareto_rating(), property_exposure_rating()

Examples

technical_premium(expected_loss = 1.2e6, limit = 4e6, loading = 0.25,
                  reinstatements = 1, reinstatement_rate = 1)

# the reinstated cover used in each past year, at the rating year's premium
bc <- burning_cost(xl_large_losses, xl_premium[, c("year", "premium")], 1e6, 4e6,
                   inflation = 0.04, rating_premium = 60e6)
used <- mean(pmin(bc$by_year$at_rating_premium, 1 * 4e6)) / 4e6
technical_premium(bc$expected_loss, 4e6, loading = 0.25, reinstatements = 1, used = used)

Tweedie family for generalised linear models

Description

A Tweedie family for stats::glm(), for responses with a mass at zero and a continuous positive part, such as the loss cost (claims amount per unit of exposure) of insurance policies, where most policies have no claim. Its variance is \phi \mu^p for a power 1 < p < 2: a compound Poisson distribution of Gamma claim sizes, the Poisson frequency and Gamma severity of a pure premium in one model.

Usage

tweedie_family(power = 1.5, link = "log")

Arguments

power

The variance power p, between 1 and 2 (exclusive); 1.5 by default. Values near 1 behave like a Poisson model of the claim count, values near 2 like a Gamma model of the amount.

link

The link: "log" (the default, giving multiplicative relativities), "identity", "sqrt" or "inverse".

Details

The family is quasi-likelihood: the coefficients and their standard errors are those of the Tweedie distribution, with the dispersion \phi estimated from the Pearson residuals, but its density has no closed form, so AIC() is NA. Compare Tweedie models by their deviance, ideally on rows they were not fitted to. The unit deviance is

2 \left( \frac{y^{2-p}}{(1-p)(2-p)} - \frac{y \mu^{1-p}}{1-p} + \frac{\mu^{2-p}}{2-p} \right).

Value

A family object, as stats::poisson() returns, with the family name "Tweedie" and the power as variance_power.

See Also

run_shiny_glm_fitting_tool, which fits it from a form.

Examples

set.seed(1)
n <- 2000
age <- sample(18:80, n, replace = TRUE)
claims <- rpois(n, exp(-2 + 0.02 * age))
loss <- vapply(claims, function(k) sum(rgamma(k, shape = 2, scale = 500)), numeric(1))
fit <- glm(loss ~ age, family = tweedie_family(1.5))
exp(coef(fit))
summary(fit)$dispersion

Risk profile of a casualty portfolio

Description

The premium written at each policy limit by a simulated liability portfolio: the example of casualty_exposure_rating.

Usage

xl_casualty_profile

Format

A data frame with 6 rows and 2 columns:

policy_limit

The policy limit.

premium

The premium of the policies with that limit.

Source

Simulated.

See Also

casualty_exposure_rating.

Examples

xl_casualty_profile

Simulated large losses of an excess of loss treaty

Description

The large losses of a simulated portfolio for the years 2015 to 2024, those of at least 500,000 in the money of their year: the experience of the examples of burning_cost and pareto_rating, with the premiums of xl_premium. In the money of 2025, at 4% claims inflation a year, they are Pareto with alpha 1.7 above 500,000, about 0.16 per million of on-level premium, with fewer in the recent years, whose losses are not all reported yet. The script that made it is in the package's source, under data-raw.

Usage

xl_large_losses

Format

A data frame with a row per loss and 3 columns:

claim

The claim's reference.

year

The year of the loss.

amount

The loss, in the money of its year.

Source

Simulated.

See Also

xl_premium, burning_cost and pareto_rating.

Examples

table(xl_large_losses$year)

Subject premiums of an excess of loss treaty

Description

The subject premium of each year 2015 to 2024 of the portfolio of xl_large_losses, with the rate index that brings it to the rates of 2025 and the development factor of its layer losses.

Usage

xl_premium

Format

A data frame with 10 rows and 4 columns:

year

The year.

premium

The subject premium of the year.

rate_index

The factor bringing the year's premium to the rates of 2025.

development

The development factor of the year's layer losses, for the losses not reported yet and the development of those reported.

Source

Simulated.

See Also

burning_cost.

Examples

xl_premium

Risk profile of a property portfolio

Description

The bands of sum insured of a simulated property portfolio, with the number of risks, average sum insured and premium of each: the example of property_exposure_rating.

Usage

xl_property_profile

Format

A data frame with 9 rows and 6 columns:

band

The band, as a label.

lower, upper

The band's lowest and highest sum insured.

risks

The number of risks in the band.

sum_insured

The average sum insured of the band's risks.

premium

The premium of the band.

Source

Simulated.

See Also

property_exposure_rating.

Examples

xl_property_profile

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.