Title: | Simulate General Insurance Policies and Losses |
---|---|
Description: | Simulate general insurance policies, losses and loss emergence. The package contemplates deterministic and stochastic policy retention and growth scenarios. Retention and growth rates are percentages relative to the expiring portfolio. Claims are simulated for each policy. This is accomplished either be assuming a frequency distribution per development lag or by generating random wait times until claim emergence and settlement. Loss simulation uses standard loss distributions for claim amounts. |
Authors: | Brian Fannin [aut, cre] |
Maintainer: | Brian Fannin <[email protected]> |
License: | MPL-2.0 | file LICENSE |
Version: | 1.0.0 |
Built: | 2024-11-12 04:26:17 UTC |
Source: | https://github.com/casact/imaginator |
Given a data frame of policies, this will simulate the number of claims- and their initial payment- per policy by the development lag at which they are first reported.
claims_by_first_report(tbl_policy, frequency, payment_severity, lags)
claims_by_first_report(tbl_policy, frequency, payment_severity, lags)
tbl_policy |
A policy data frame. |
frequency |
A list of the same length as 'lags' of number of claims per policy or their distributions. |
payment_severity |
A list of the same length as 'lags' of payment amount for each claim or their distributions. |
lags |
A vector of lags as integers. |
Creates a data frame with randomly generated claim values.
A claims data frame
# This will generate a claim data frame which has 1,000 records # each of which has a severity of 100 tbl_policy <- policy_year_new(100, 2001) tbl_claims <- claims_by_first_report( tbl_policy, frequency = 10, payment_severity = 100, lags = 1)
# This will generate a claim data frame which has 1,000 records # each of which has a severity of 100 tbl_policy <- policy_year_new(100, 2001) tbl_claims <- claims_by_first_report( tbl_policy, frequency = 10, payment_severity = 100, lags = 1)
Given a data frame of claims, this will simulate claim development by applying a (possibly) random link ratio.
claims_by_link_ratio(tbl_claims, links, lags)
claims_by_link_ratio(tbl_claims, links, lags)
tbl_claims |
A claims data frame |
links |
A vector of the same length as 'lags' of factors, or their distributions, determining how severities change from one evaluation date to the next. |
lags |
A vector of lags |
This function will apply the link ratio algorithm at an individual claim level.
A claims data frame
tbl_policy <- policy_year_new(10, 2001) tbl_claims <- claims_by_first_report( tbl_policy, frequency = 10, payment_severity = 100, lags = 1) tbl_claims <- claims_by_link_ratio( tbl_claims, links = c(1.25, 1.1, 1.05), lags = 1:4)
tbl_policy <- policy_year_new(10, 2001) tbl_claims <- claims_by_first_report( tbl_policy, frequency = 10, payment_severity = 100, lags = 1) tbl_claims <- claims_by_link_ratio( tbl_claims, links = c(1.25, 1.1, 1.05), lags = 1:4)
Construct a data frame of claims simulated by time between events.
claims_by_wait_time( tbl_policy, claim_frequency, payment_frequency, occurrence_wait, report_wait, pay_wait, pay_severity, pay_only_positive = TRUE )
claims_by_wait_time( tbl_policy, claim_frequency, payment_frequency, occurrence_wait, report_wait, pay_wait, pay_severity, pay_only_positive = TRUE )
tbl_policy |
A data frame of policy records |
claim_frequency |
Number of claims per policy; can be a distribution. |
payment_frequency |
Number of payments per claim; can be a distribution. |
occurrence_wait |
Time until occurrence for each claim; can be a distribution |
report_wait |
Time until report; can be a distribution. |
pay_wait |
Lag time between payments; can be a distribution. |
pay_severity |
Severity of each claim payment; can be a distribution. |
pay_only_positive |
Boolean indicating whether to discard negative payments. |
This function will generate claim transactions.
Wait times and frequencies will be converted to integers with no message. If wait times or claim frequencies are less than zero, or payment frequencies are less than one, they will be converted with a message.
Simulate general insurance policies, losses and loss emergence. The package contemplates deterministic and stochastic policy retention and growth scenarios. Retention and growth rates are percentages relative to the expiring portfolio. Claims are simulated for each policy. This is accomplished either be assuming a frequency distribution per development lag or by generating random wait times until claim emergence and settlement. Loss simulation uses standard loss distributions for claim amounts.
Given a policy data frame, this will generate new policies in subsequent policy years.
policies_grow(tbl_policy, growth)
policies_grow(tbl_policy, growth)
tbl_policy |
Data frame of policy data |
growth |
Scalar value greater than or equal to zero |
Given a policy data frame, this will construct renewal data frames. The number of policies which
renew is governed by the the Retention
parameter.
policies_renew(tbl_policy, retention)
policies_renew(tbl_policy, retention)
tbl_policy |
Data frame of policy data |
retention |
Scalar value greater than or equal to zero |
Given a starting number of policies, this function will generate additional years of policy data.
Growth is given as a the positive rate of growth of new policies. This may be set to zero.
Retention is given as the portion of expiring policies which will renew.
policies_simulate( n, policy_years, num_years, exposure = 1, retention = 1, growth = 0, start_id = 1, additional_columns )
policies_simulate( n, policy_years, num_years, exposure = 1, retention = 1, growth = 0, start_id = 1, additional_columns )
n |
An integer giving the number of policies in the first year |
policy_years |
A vector of integers in sequence |
num_years |
The number of years to simulate. If 'policy_years' is given, this is ignored. |
exposure |
Exposure per policy |
retention |
A vector indicating loss of policies |
growth |
A vector indicating the rate of growth of policies |
start_id |
Integer of the first number in the policy ID sequence |
additional_columns |
A list of addtional column names and values |
A data frame of policy data
Given a policy data frame, this will combine the policies_grow
and policies_renew
functions
to produce a subsequent policy year.
policy_year_increment(tbl_policy, retention, growth)
policy_year_increment(tbl_policy, retention, growth)
tbl_policy |
A policy data frame |
retention |
Scalar renewal rate |
growth |
Scalar growth rate |
Policy data frame
This will generate a data frame of policy data. This may be used to construct renewal and growth data frames for subsequent policy years.
policy_year_new(n, policy_year, exposure = 1, start_id = 1, additional_columns)
policy_year_new(n, policy_year, exposure = 1, start_id = 1, additional_columns)
n |
The number of policies to generate |
policy_year |
Scalar integer indicating the policy year to generate |
exposure |
Vector of exposures |
start_id |
Integer of the first number in the policy ID sequence |
additional_columns |
A list of addtional column names and values |
Effective dates are uniformly distributed throughout the year.
When providing additional columns, each element of the list must be a scalar and be named.
Data frame of policy data