View source: R/tweedieReserve.R
tweedieReserve | R Documentation |
This function implements loss reserving models within the generalized linear model framework in order to generate the full predictive distribution for loss reserves. Besides, it generates also the one year risk view useful to derive the reserve risk capital in a Solvency II framework. Finally, it allows the user to validate the model error while changing different model parameters, as the regression structure and diagnostics on the Tweedie p parameter.
tweedieReserve(triangle, var.power = 1,
link.power = 0, design.type = c(1, 1, 0),
rereserving = FALSE, cum = TRUE, exposure = FALSE,
bootstrap = 1, boot.adj = 0, nsim = 1000,
proc.err = TRUE, p.optim = FALSE,
p.check = c(0, seq(1.1, 2.1, by = 0.1), 3),
progressBar = TRUE, ...)
triangle |
An object of class |
var.power |
The index (p) of the power variance function |
link.power |
The index of power link function. The default |
design.type |
It's a 3 dimension array that specifies the design matrix underlying
the GLM. The dimensions represent respectively: origin period,
development and calendar period. Accepted values are: |
rereserving |
Boolean, if |
cum |
Boolean, indicating whether the input triangle is
cumulative or incremental along the development period.
If |
exposure |
Boolean, if |
bootstrap |
Integer, it specifies the type of bootstrap for parameter error.
Accepted values are: |
boot.adj |
Integer, it specified the methodology when using semi-parametric
bootstrapping. Accepted values are: |
nsim |
Integer, number of simulations to derive the loss reserve distribution.
Default to |
proc.err |
Boolean, if |
p.optim |
Boolean, if |
p.check |
If |
progressBar |
Boolean, if |
... |
Arguments to be passed onto the function |
The output is an object of class "glm"
that has the following components:
call |
the matched call. |
summary |
A data frame containing the predicted loss reserve statistics. The following items are displayed:
The following items are available if
The following items are availbale if
|
Triangle |
The input triangle. |
FullTriangle |
The completed triangle, where empty cells in the original triangle are filled with model predictions. |
model |
The fitted GLM, a class of |
scale |
The dispersion parameter phi |
bias |
The model bias, defined as |
GLMReserve |
Deterministic reserve, i.e. the MLE GLM estimate of the Reserve |
gamma_y |
When the calendar year is used, it displays the observed and fitted calendar year (usually called "gamma"") factors. |
res.diag |
It's a data frame for residual diagnostics. It contains:
|
[If boostrap>1
]
distr.res_ult |
The full distribution "Ultimate View" |
[If rereserve=TRUE
]
distr.res_1yr |
The full distribution "1yr View" |
Note that the runtime can materially increase for certain parameter setting. See above for more details.
This function was born initially as a fork of the glmReserve
by
Wayne Zhang. I would like to thank him for his work that permitted me to
speed up my coding.
Alessandro Carrato MSc FIA OA alessandro.carrato@gmail.com
Gigante, Sigalotti. Model risk in claims reserving with generalized linear models. Giornale dell'Istituto Italiano degli Attuari, Volume LXVIII. 55-87. 2005
England, Verrall. Stochastic claims reserving in general insurance. B.A.J. 8, III. 443-544. 2002
England, Verrall. Predictive distributions of outstanding liabilities in general insurance. A.A.S. 1, II. 221-270. 2006
Peters, Shevchenko, Wüthrich, Model uncertainty in claims reserving within Tweedie's compound poisson models. Astin Bulletin 39(1). 1-33. 2009
Renshaw, Verrall. A stochastic model underlying the chain-ladder technique. B.A.J. 4, IV. 903-923. 1998
See also summary.tweedieReserve
.
## Not run:
## Verrall's ODP Model is a Tweedie with p=1, log link and
## origin/development periods as factors, thus c(1,1,0)
res1 <- tweedieReserve(MW2008, var.power=1, link.power=0,
design.type=c(1,1,0), rereserving=TRUE,
progressBar=TRUE)
## To get directly ultimate view and respective one year view
## at selected percentiles
summary(res1)
#To get other interesting statistics
res1$summary
## In order to validate the Tweedie parameter 'p', it is interesting to
## review its loglikelihood profile. Please note that, given the nature
## of our data, it is expected that we may have some fitting issues for
## given 'p' parameters, thus any results/errors should be considered
## only indicatively. Considering different regression structures is anyway
## recommended. Different 'p' values can be defined via the p.check array
## as input of the function.
## See help(tweedie.profile), p.vec parameter, for further information.
## Note: The parameters rereserving and bootstrap can be set to 0 to speed up
## the process, as they aren't needed.
## Runs a 'p' loglikelihood profile on the parameters
## p=c(0,1.1,1.2,1.3,1.4,1.5,2,3)
res2 <- tweedieReserve(MW2008, p.optim=TRUE,
p.check=c(0,1.1,1.2,1.3,1.4,1.5,2,3),
design.type=c(1,1,0),
rereserving=FALSE, bootstrap=0,
progressBar=FALSE)
## As it is possible to see in this example, the MLE of p (or xi) results
## between 0 and 1, which is not possible as Tweedie models aren't
## defined for 0 < p < 1, thus the Error message.
## But, despite this, we can conclude that overall the value p=1 could be
## reasonable for this dataset, as anyway it seems to be near the MLE.
## In order to consider an inflation parameter across the origin period,
## it may be interesting to change the regression structure to c(0,1,1)
## to get the same estimates of the Arithmetic Separation Method, as
## referred in Gigante/Sigalotti.
res3 <- tweedieReserve(MW2008, var.power=1, link.power=0,
design.type=c(0,1,1), rereserving=TRUE,
progressBar=TRUE)
res3
## An assessment on future fitted calendar year values (usually defined
## as "gamma") is recommended
plot(res3$gamma_y)
## Model residuals can be plotted using the res.diag output
plot(scaled.biasadj ~ dev, data=res3$res.diag) # Development year
plot(scaled.biasadj ~ cy, data=res3$res.diag) # Calendar year
plot(scaled.biasadj ~ origin, data=res3$res.diag) # Origin year
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.