You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Name of QuantLet : STFruin13Published in : Statistical Tools for Finance and InsuranceDescription : 'Produces the ruin probability in infinite time for mixture of 2 exponentialsdistribution claims given by light traffic approximation. Needs the "moments.m" function.'Keywords : 'heavy-tailed, pdf, probability, poisson process, approximation, simulation,exponential, empirical'See also : 'STFruin02, STFruin03, STFruin04, STFruin05, STFruin06, STFruin07, STFruin08, STFruin09,STFruin10, STFruin11, STFruin12, STFruin14, STFruin17, moments'Author : Zografia AnastasiadouSubmitted : Fri, May 04 2012 by Dedy Dwi Prastyo
R Code:
rm(list= ls(all=TRUE))
# setwd('C:/...')# returns the k-th moment (up to fourth) of the mixture of 2 exponentials distribution claimsmoments<-function(k, dparameters) {
# k: order of moment to calculate dparameters: list, composed of 2 vectors containing the parameters of loss distribution,# weights (first vector) and exponential parameters (second vector)p1<-dparameters[[1]]
p2<-dparameters[[2]]
if (k==1) {
mk<- sum(p1/p2)
} else {
if (k==2) {
mk<-2* sum(p1/p2^2)
} else {
if (k==3) {
mk<-6* sum(p1/p2^3)
} else {
if (k==4) {
mk<-24* sum(p1/p2^4)
}
}
}
}
return(mk) # k-th raw moment of the mixture of 2 exponentials distribution claims
}
u<- c(0, 10^9, 5*10^9, 10^10, 2*10^10, 5*10^10) # initial capital of insurance company (in USD)theta<-0.3# relative safety loadingdparameters1<-list(c(0.0584, 0.9416), c(3.59e-10, 7.5088e-09)) # weights (first vector) and exponential parameters (second vector)m<- moments(1, dparameters1) # 1st raw momentpa<-matrix(dparameters1[[1]]) # 2 x 1 matrix of weightspb<-matrix(dparameters1[[2]]) # 2 x 1 matrix of exponential parameterspaa<-matrix(pa, nrow=2, ncol= length(u))
pbb<-matrix(pb, nrow=2, ncol= length(u))
d<- rowSums(t(paa/pbb* exp(-pb%*%u)))
c<-matrix(m, nrow= length(d)) -d# the light traffic approximation for mixture of 2 exponentials claims with \fbeta1=3.5900e-10, beta2=7.5088e-09,# alpha=0.0584 and theta=0.3 (u in USD)psi<- (m-c)/(1+theta)/m
MATLAB Code:
closeallclearallclcformatlong;
u = [0,10.^9,5.*10.^9,10.^10,2.*10.^10,5.*10.^10]'; %initial capital of insurance company (in USD)
theta =0.3; % relative safety loading
dparameters1 = [[0.0584,0.9416]',[3.5900e-10,7.5088e-09]']; % weights (first vector) and exponential parameters (second vector) %relative safety loading
m = moments(1,dparameters1); % 1st raw moment
pa = dparameters1(:,1); % 2 x 1 matrix of weights
pb = dparameters1(:,2); %2 x 1 matrix of exponential parameters
paa = repmat(pa,1,6);
pbb = repmat(pb,1,6);
n =paa./pbb.*exp(-pb*u');
d = sum(n);
c = meshgrid(m,d)-d';
% the light traffic approximation for mixture of 2 exponentials claims with% beta1=3.5900e-10, beta2=7.5088e-09, alpha=0.0584 and theta=0.3 (u in USD)
psi=(m-c)/(1+theta)/m