The actuar Package March 24, 2006 Type Package Title Actuarial functions Version 0.1-3 Date 2006-02-16 Author Vincent Goulet, Sébastien Auclair Maintainer Vincent Goulet <vincent.goulet@act.ulaval.ca> Collection of functions related to actuarial science applications, namely credibility theory and risk theory, for the moment. The package also includes the famous Hachemeister (1975) data set. Depends R (>= 2.1.0) License GPL version 2 or newer R topics documented: bstraub............................................ 1 hachemeister........................................ 3 panjer............................................ 4 rearrangepf......................................... 5 simpf............................................ 6 Index 8 bstraub Buhlmann-Straub Credibility Model bstraub calculates credibility premiums in the Bühlmann-Straub credibility model. bstraub(ratios, weights, heterogeneity = c("iterative", "unbiased"), TOL = 1e-06, echo = FALSE) 1
2 bstraub Arguments ratios matrix of ratios (contracts in lines, years in columns) weights matrix of weights corresponding to ratios heterogeneity estimator of the between contract heterogeneity parameter used in premium calculation; "iterative" for the Bischel-Straub estimator; "unbiased" for the usual Bühlmann-Straub estimator (see below) TOL Details Value echo maximum relative error in the iterative procedure boolean, whether to echo iterative procedure or not The credibility premium of contract i is given by z i X iw + (1 z i )X zw, where z i = w i â w i â + ŝ 2, X iw is the weighted average of the ratios of contract i, X zw is the weighted average of the matrix of ratios using credibility factors and w i is the total weight of a contract. ŝ 2 is the estimator of the within contract heterogeneity and â is the estimator of the between contract heterogeneity. Missing data are represent by NA in both the matrix of ratios and the matrix of weights. The function can cope with complete lines of NA in case a contract has no experience. A list with the following components: premiums individual collective weights s2 unbiased iterative vector of credibility premiums vector of contract weighted averages collective premium estimator vector of contracts total weights, as used in credibility factors estimator of the within contract heterogeneity parameter unbiased estimator of the between contract heterogeneity parameter iterative estimator of the between contract heterogeneity parameter Estimation of a The Bühlmann-Straub unbiaised estimator (heterogeneity = "unbiased") of the between contracts heterogeneity parameter is ( I ) â = c w i (X iw X ww ) 2 (I 1)ŝ 2, i=1 where c = w /(w 2 I i=1 w2 i ) and I is the number of contracts. The Bishel-Straub pseudo-estimator (heterogeneity = "iterative") is obtained recursively as the solution of â = 1 I 1 I z i (X iw X zw ) 2. The fixed point algorithm is used up, with a relative error of TOL stopping criteria. i=1
hachemeister 3 Author(s) Vincent Goulet vincent.goulet@act.ulaval.ca and Sébastien Auclair References Goulet, V. (1998), Principles and Application of Credibility Theory, Journal of Actuarial Practice, Volume 6, ISSN 1064-6647. Goovaerts, M. J. and Kaas, R. and van Heerwaarden, A. E. and Bauwelinckx, T. (1990), Effective actuarial methods, North-Holland. Examples data(hachemeister) ## Credibility premiums calculated with the iterative estimator bstraub(hachemeister$claims, hachemeister$weights) ## Credibility premiums calculated with the unbiased estimator bstraub(hachemeister$claims, hachemeister$weights, heterogeneity = "unbiased") hachemeister Hachemeister data set Hachemeister (1975) data set giving average claim amounts in automobile liability insurance in five U.S. states between July 1970 and June 1973 and the corresponding number of claims. data(hachemeister) Format A list with two components: claims a 5 12 matrix of average claim amounts weights a 5 12 matrix of corresponding weights Source Hachemeister, C. A. (1975), Credibility for regression models with application to trend, Proceedings of the Berkeley Actuarial Research Conference on Credibility, Academic Press.
4 panjer panjer Panjer s recurison formula Panjer recursion formula to compute the total amount of claims probability function of a portfolio. panjer(fx, freq.dist = c("poisson", "negative binomial", "binomial", "geometric", "logarithmic"),par, p0, TOL = 1e-08, echo= FALSE) Arguments fx freq.dist par p0 TOL echo a vector of the (discretized) claim amount distribution; first element *must* be f X (0) name of the counting distribution named list of the parameter(s) of the counting distribution as they are defined in "rdist". arbitrary amount of probability at zero given to the frequency distribution. It creates zero-modified or zero-truncated distributions stop recursion when cumulative probability function is less than TOL away from 1 print the cumulative distribution of the total amount of claims as it is computed. Details The formula of the (a, b, 1) class is: f S (x) = [p 1 (a + b)p 0 ]f X (x) + min(x,m) y=1 (a + by x )f X(y)f S (x y) 1 af X (0) For the (a, b, 0) class, the result reduces to f S (x) = min(x,m) y=1 (a + by x )f X(y)f S (x y) 1 af X (0) The counting variable is a member of the (a, b, 0) family of discrete distributions if p0 is not specified and a member of the (a,b,1) family if p0 is specified. The logarithmic distribution is a limiting case of the negative binomial distribution where the size parameter is equal to 0. Value A vector representing the probability density function of the total amount of claims. Author(s) Vincent Goulet vincent.goulet@act.ulaval.ca and Sébastien Auclair
rearrangepf 5 References Klugman, S.A and Panjer,H.H and Willmot, G.E (2004), Loss Models: from data to decision, Second Edition, Wiley, Sections 4.6.5-4.6.7, 6.6 and Appendix B Examples ### (a,b,0) class with the binomial distribution (a <- panjer(fx=rep(0.5,2), freq.dist="bin",par=list(size=3, prob=0.5),echo=true)) sum(a) ### Example 6.18 of "Loss Models" (Second Edition). ### (a,b,1) class with the Extended Truncated Negative Binomial distribution. (a <- panjer(fx=c(0.3, 0.5, 0.2), "negative bin", par=list(size=0.2, prob=0.25), p0=0, TOL=1E-5 plot(a) rearrangepf Reorganization of a portfolio rearrangepf reorganizes a portfolio of claim amounts stored in a two dimension list. rearrangepf(pf) Arguments pf a two dimension list containing individual claim amounts Details This function takes individual claim amounts of a portfolio of contracts stored in a two dimension list (where each element of the list is a vector of claim amounts) and returns matrices of total claim amounts, number of claims and individual claim amounts. Value A list made of: aggregate frequencies severities matrix of aggregate losses for each contract and each year matrix of the number of claims per contract and per year a list of two elements: claims matrix of the individual claim amounts for the first n - 1 years of observations claims.last matrix of the individual claim amounts for the last year of observations
6 simpf Author(s) See Also Vincent Goulet vincent.goulet@act.ulaval.ca and Sébastien Auclair simpf to create a portfolio of data Examples modelfreq <- list(dist1 = "pois", par1 = list(lambda = quote(lambda * weights)), dist2 = "gamma", par2 = c(shape = 2, rate = 1)) modelsev<-list(dist1 = "lnorm", par1 = list(meanlog = quote(theta), sdlog = 1), dist2 = "norm", par2 = c(mean = 5, sd = 1)) ( x <- simpf(25, 4, modelfreq, modelsev) ) rearrangepf(x$data) simpf Simulation of a portfolio of data simpf simulates a portfolio of data for insurance applications. Both frequency and severity distributions can have an unknown risk parameter that is, they can each be mixtures of models. simpf(contracts, years, model.freq, model.sev, weights) Arguments contracts years model.freq model.sev weights the number of contracts in the porfolio the number of years of experience for each contract named list containing the frequency model (see details below); if NULL, only claim amounts are simulated named list containing the severity model (see details below); if NULL, only claim numbers are simulated a matrix of weights (one per contract and per year) to be used in the simulation of frequencies Details The function allows for continuous mixtures of models for both frequency and severity of losses. The mixing (or risk) parameter is called Lambda in the frequency model and Theta in the severity model. Distribution assumptions are specified using the base name of random number generation functions, e.g. "pois" for the Poisson distribution or "lnorm" for the lognormal. model.freq and model.sev are NULL or named lists composed of:
simpf 7 Value dist1 base name of the distribution for a simple model, or of the conditional distribution for a mixed model. par1 named list of the parameters of dist1 as they are defined in rdist1. If needed, the mixing parameter is identified by an unevaluated expression in Lambda and weights for model.freq, or Theta for model.sev. dist2 base name of the mixing distribution, if any. par2 named list of the parameters of dist2 as they are defined in rdist2. A list with two components: data weights a two dimension (contracts rows and years columns) list where each element is a vector of losses, or a matrix if each element has length 1 the matrix of weights given in argument, or a matrix of 1 otherwise. Author(s) Vincent Goulet vincent.goulet@act.ulaval.ca and Sébastien Auclair References See Also Goulet, V. (2006), Credibility for severity revisited, North American Actuarial Journal, to appear. rearrangepf Examples ## Portfolio where both frequency and severity models are mixed. modelfreq <- list(dist1 = "pois", par1 = list(lambda = quote(lambda * weights)), dist2 = "gamma", par2 = c(shape = 2, rate = 1)) modelsev<-list(dist1 = "lnorm", par1 = list(meanlog = quote(theta), sdlog = 1), dist2 = "norm", par2 = c(mean = 5, sd = 1)) data(hachemeister) weights <- hachemeister$weights/mean(hachemeister$weights) simpf(5, 12, modelfreq, modelsev, weights) ## Portfolio where the frequency model is mixed, but not the ## severity model. modelsev <- list(dist1 = "lnorm", par1 = list(meanlog = 7, sd = 1)) simpf(5, 12, modelfreq, modelsev) ## Portofolio with a severity model only and a user function for the ## simulation of claim amounts. rpareto <- function(n, alpha, lambda) lambda * (runif(n)^(-1/alpha) - 1) modelsev <- list(dist1 = "pareto", par1 = list(alpha = 3, lambda = 8000)) simpf(5, 12, model.freq = NULL, modelsev)
Index Topic datasets hachemeister, 3 Topic file bstraub, 1 panjer, 4 rearrangepf, 5 simpf, 6 bstraub, 1 hachemeister, 3 panjer, 4 rearrangepf, 5, 7 simpf, 6, 6 8