View source: R/features_01_claim_occurrence.R
claim_frequency | R Documentation |
Returns the number of insurance claims occurring in each of the periods.
claim_frequency(
I = 40,
E = 12000,
freq = 0.03,
simfun,
type = c("r", "p"),
...
)
I |
number of claims development periods considered. |
E |
effective annual exposure associated with each period (vector). |
freq |
expected frequency per unit exposure for each period (vector). |
simfun |
optional alternative sampling distribution; see Details. |
type |
the type of |
... |
other arguments/parameters to be passed onto |
Unless otherwise specified, claim_frequency()
assumes the
claim frequency follows a Poisson distribution with mean equal to the
product of exposure E
associated with period i
and expected
claim frequency freq
per unit exposure for that period.
If no arguments are provided, by default claim_frequency()
assumes
a total of 40 development periods, constant exposure rate at 12000 per year
and constant frequency at 0.03 per unit of exposure.
If one wishes to use an alternative sampling distribution for claim
frequency, they could declare such specification through the simfun
argument. The simfun
argument takes both random generation functions
(type = "r"
, the default) and cumulative distribution functions
(type = "p"
). For the latter, claim_frequency()
will first search for the
existence of the corresponding r
-function. If it notes the existence of
such an r
-function (e.g. rpois
for simfun = ppois
), it will directly
apply the r
-function to optimise simulation efficiency. Otherwise, the
function uses a numerical inverse transform method for simulation (see
simulate_cdf
), which may not be the most efficient and can
potentially result in errors if an appropriate range
is not specified in
the optional arguments.
Pre-defined distribution functions such as ppois
are supported.
no_period <- 40
exposure <- c(rep(12000, no_period))
exp_freq <- c(rep(0.03, no_period))
# returns the same result as claim_frequency()
claim_frequency(I = no_period, E = exposure, freq = exp_freq)
# use a pre-defined random generation function
claim_frequency(I = 10, simfun = rpois, lambda = 80)
# or equivalently, through a distribution function
claim_frequency(I = 10, simfun = ppois, type = "p", lambda = 80)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.