| model_loss_process(premium, losspick, B, Q, P, S, T)
|
function [loss, averageSeverity, numofclaims] = model_loss_process(premium, losspick, B, Q, P, S, T)
%This m- file models the loss process based on the input arguments.
maxClaim = 500000;
%%find the average number of claims based on losspick and LAS amount.
averageSeverity = las(maxClaim, B, Q, P, S, T);
disp(['Average size of claim = ',num2str(averageSeverity)]);
lambda = losspick/averageSeverity;
%%Pick a random n from poisson distribution
numofclaims = poissrnd(lambda);
disp(['Average Number of claims = ',num2str(numofclaims)]);
%%Figure out the losses using tparetornd funcion
loss = tparetornd(numofclaims,B(1), Q(1), P(1), S(1), T(1));
%disp('Bigger than $500,000')
% loss(find(loss > 500000)) = 500000;
% k = find(loss > 500000)
%Each column represents a simulation
figure;
subplot(2,1,1); hist(sum(loss));
title('Distribution of losses before adjustments');
xlabel('Dollars ($)');
ylabel('#of observations');
subplot(2,1,2); plot(sum(loss));
xlabel('Multiple Simulations');
ylabel('Dollars ($)');
% loss = sort(loss(:));
%
% hist(loss(:));
%Calculate probabilities
prob= (1/numofclaims^2); %prob. of each event
%Arrange prob and loss in suc a way that we get a cdf.
|
|