Question: R-based question. Modify the R code in Appendix A so that it is able to deal with (a) a negative binomial distribution for the frequency;
R-based question. Modify the R code in Appendix A so that it is able to deal with
(a) a negative binomial distribution for the frequency;
(b) a spliced lognormal/
GPD severity distribution;
(c) a generic severity distribution, entered as a vector of N N N N
N percentiles , 1 1
2
+ + 1 1 +
.
Hints: The following function can be used to generate an N_sim claim counts from an negative binomial distribution with the correct mean and variance-to-mean ratio by a suitable choice of
a, b:
claim_count = rpois(N_sim,rgamma(N_sim,shape =
a,scale = b))
The following function creates a spliced lognormal/GPD distribution from two loss vectors analogous to indiv.losses in the code (one based on a lognormal and the other based on a GPD), the splicing point being GPD_mu:
Indiv.losses = ifelse(logn_vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
