This function takes an insurance loss triangle, converts it to incremental losses internally if necessary, transforms it to the long format (see as.data.frame
) and fits the resulting loss data with a generalized linear model where the mean structure includes both the accident year and the development lag effects.
The distributions allowed are the exponential family that admits a power variance function, that is, \(V(\mu)=\mu^p\).
This subclass of distributions is usually called the Tweedie distribution and includes many commonly used distributions as special cases.
This function does not allow the user to specify the GLM options through the usual family
argument, but instead, it uses the tweedie
family internally and takes two arguments, var.power
and link.power
, through which the user still has full control of the distribution forms and link functions.
The argument var.power
determines which specific distribution is to be used, and link.power
determines the form of the link function.
When the Tweedie compound Poisson distribution 1 < p < 2
is to be used, the user has the option to specify var.power = NULL
, where the variance power p
will be estimated from the data using the cplm
package. The bcplm
function in the cplm
package also has an example for the Bayesian compound Poisson loss reserving model.
See details in tweedie
, cpglm
and bcplm
.
glmReserve
allows certain measures of exposures to be used in an offset term in the underlying GLM.
To do this, the user should not use the usual offset
argument in glm
.
Instead, one specifies the exposure measure for each accident year through the exposure
attribute of triangle
.
Make sure that these exposures are in the original scale (no log transformations for example).
If the vector is named, make sure the names coincide with the rownames/origin of the triangle.
If the vector is unnamed, make sure the exposures are in the order consistent with the accident years, and the character rownames of the Triangle must be convertible to numeric.
If the exposure
attribute is not NULL
, the glmReserve
function will use these exposures, link-function-transformed, in the offset term of the GLM.
For example, if the link function is log
, then the log of the exposure is used as the offset, not the original exposure.
See the examples below.
Moreover, the user MUST NOT supply the typical offset
or weight
as arguments in the list of additional arguments ...
. offset
should be specified as above, while weight
is not implemented (due to prediction reasons).
Two methods are available to assess the prediction error of the estimated loss reserves.
One is using the analytical formula (mse.method = "formula"
) derived from the first-order Taylor approximation.
The other is using bootstrapping (mse.method = "bootstrap"
) that reconstructs the triangle nsim
times by sampling with replacement from the GLM (Pearson) residuals.
Each time a new triangle is formed, GLM is fitted and corresponding loss reserves are generated.
Based on these predicted mean loss reserves, and the model assumption about the distribution forms, realizations of the predicted values are generated via the rtweedie
function.
Prediction errors as well as other uncertainty measures such as quantiles and predictive intervals can be calculated based on these samples.