# How can I treat a aleatory variable in Matlab?

2 views (last 30 days)
I have the following basic optimal reinsurance model
min(x+ P(min(max(L-x,0),VaR-x))
subject to 0<=x<=VaR
where P(.) is a function that calculates the premium (a so called premium principle), L is a random number (a vector of values), VaR is a scalar and x is the priority of a limited stop-loss reinsurance (the variable I am looking for, a scalar). Now, I wish to apply the expected value premium principle, which is defined as:
P(X)=(1+omega)*mean(X)
where omega is the safety loading ( a scalar) and X is a random variable.
So, if I apply this premium principle to the optimization problem I come up with:
min(x+(1+omega)*mean(min(max(L-x,0),VaR-x))
subject to 0<=x<=VaR
How can I implement the random variable in Matlab?
My idea was the following:
e = random('gamma',45,8,1,1000); % random distribution
L=sort(e); % sort the distribution to find VaR, a quantile
VaR=quantile(L,0.995);
omega=0.3;
D=zeros(1,20000);
for j=1:20000
ob=@(x)(x+(1+omega)*(mean(min(max(datasample(e,1)-x,0),VaR-x))));
d_star=fminbnd(ob,0,VaR);
D(j)=d_star;
end
Priority=mean(D);
Is this simulation reasonable? Or are there other possibilities?
Thank you.

Niraj Gadakari on 28 Sep 2017
I believe you can use the random function to implement a random variable in MATLAB.