I want to determine the optimal allocation of two assets (here "x") such that shortfall probability is minimized.
Shofrtfall probability is derived by applying condition that (if B<b) then sum all incidences and divide by total trials for each "t" and then finally sum the probability of all "t". The value of shortfall probability is 50.55.
When I run fmincon, I get fval=50.55 and the same initial guess of the two weights of two assets.
Following is my code.
x1 = 0.5;
T = 35;
x = [eq_share, bd_share];
Returnx1= exp(m_e + v_e*(RNx1));
Returnx2 = exp(m_b+(rho*v_b*RNx1+((1-rho^2)^0.5)*v_b*RNx2));
Returnportfolio = x1*Returnx1+(x2)*Returnx2;
W = max(L*Returnportfolio,0);
B = min(b,L*Returnportfolio);
S=(cumsum(B<b, 2) == 1) .* (B<b)
options = optimoptions('fmincon','Display','iter','Algorithm','sqp');
opts.Algorithm = 'sqp';
f = @(x) shortfallprobability
[n,fval] = fmincon(f,[0.5 0.5],,,,,,,,options)
When I run the program, I get
function_handle with value:
Iter Func-count Fval Feasibility Step Length Norm of First-order
0 3 5.055392e-01 0.000e+00 1.000e+00 0.000e+00 0.000e+00
Initial point is a local minimum that satisfies the constraints.
Optimization completed because at the initial point, the objective function is non-decreasing
in feasible directions to within the value of the optimality tolerance, and
constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
Can you please check the code and my mistake. I am sorry to bother as I have already spent much time on it but could not figure out.
Is my fmincon setup ok?
can I use fmincon for this problem?
Am I definining objective function wrongly?