simpf                 package:actuar                 R Documentation

_S_i_m_u_l_a_t_i_o_n _o_f _a _p_o_r_t_f_o_l_i_o _o_f _d_a_t_a

_D_e_s_c_r_i_p_t_i_o_n:

     '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.

_U_s_a_g_e:

     simpf(contracts, years, model.freq, model.sev, weights)

_A_r_g_u_m_e_n_t_s:

contracts: the number of contracts in the porfolio

   years: the number of years of experience for each contract

model.freq: named list containing the frequency model (see details
          below); if 'NULL', only claim amounts are simulated

model.sev: named list containing the severity model (see details
          below); if 'NULL', only claim numbers are simulated

 weights: a matrix of weights (one per contract and per year) to be
          used in the simulation of frequencies

_D_e_t_a_i_l_s:

     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:

     '_d_i_s_t_1' base name of the distribution for a simple model, or of
          the conditional distribution for a mixed model.

     '_p_a_r_1' 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'.

     '_d_i_s_t_2' base name of the mixing distribution, if any.

     '_p_a_r_2' named list of the parameters of 'dist2' as they are defined
          in 'rdist2'.

_V_a_l_u_e:

     A list with two components: 

    data: 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

 weights: the matrix of weights given in argument, or a matrix of 1
          otherwise.

_A_u_t_h_o_r(_s):

     Vincent Goulet vincent.goulet@act.ulaval.ca and Sbastien Auclair

_R_e_f_e_r_e_n_c_e_s:

     Goulet, V. (2006), _Credibility for severity revisited_, North
     American Actuarial Journal, to appear.

_S_e_e _A_l_s_o:

     'rearrangepf'

_E_x_a_m_p_l_e_s:

     ## 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)

