View source: R/features_02_claim_size.R
claim_size | R Documentation |
Simulates and returns the size of each of the claims occurring in each of
the periods, given its cumulative distribution function.
Note that claim_size()
aims to model the claim sizes
without inflation.
claim_size(frequency_vector, simfun, type = c("r", "p"), ...)
frequency_vector |
a vector of claim frequencies for all the periods. |
simfun |
optional alternative sampling distribution; see Details. |
type |
the type of |
... |
other arguments/parameters to be passed onto |
By default claim_size()
assumes a left truncated power
normal distribution: S^0.2 ~ Normal (9.5, sd = 3)
, left truncated
at 30. The truncation is done via resampling for rejected values.
Users can opt to use alternative distributions if desired. As discussed in
claim_frequency
, users can declare such specification through
the simfun
argument, which takes both random generation functions
(type = "r"
, the default) and cumulative distribution functions
(type = "p"
). See Examples.
For the latter, claim_size()
will first search for the existence of the
corresponding r
-function. If it notes the existence of such an r
-function
(e.g. rweibull
for simfun = pweibull
), 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.
A list of claim sizes such that the i
th component of the
list gives the sizes for all claims that occurred in period i
.
n_vector <- c(90, 79, 102, 78, 86, 88, 116, 84, 93, 104)
claim_size(n_vector)[[1]] # gives the sizes for all
# all claims incurred in period 1
# use some custom pre-defined distribution function
claim_size(n_vector, stats::rweibull, shape = 4, scale = 100000)[[1]]
# equivalently
claim_size(n_vector, stats::pweibull, "p", shape = 4, scale = 100000)[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.