Fmincon - Value-at-Risk Minimization - Incorrect values returned

3 visualizaciones (últimos 30 días)
Edouard
Edouard el 22 de En. de 2014
Respondida: Moad el 18 de Feb. de 2014
Hi all,
I'm having troubles using fmincon. A little help would be reaally appreciated.
So i'm trying to minimize the following function (Semi-Parametric Conditional Value-at-Risk) over w, the weight between two assets return series :
function adjcvar=adjcvar(rets,alpha,w)
%Portfolio return
rp=w*rets(:,1)+(1-w)*rets(:,2);
%Mean return and StDev
mu=mean(rp);
sig=std(rp);
%Skewness and Kurtosis
S=skewness(rp);
K=kurtosis(rp);
%Standard Normal inverse cumulative distribution function
z=norminv(alpha,0,1);
%Estimated Quantile adjusted for Skewness and Kurtosis
Q=z+(z^2 - 1)*S/6+(z^3 -3*z)*(K-3)/24 - (2*z^3 - 5*z)*(S*diag(S))/36;
%Adjusted Value-at-Risk
adjvar=min(mu+sig*diag(Q),0);
%Adjusted Conditional VaR
adjcvar=mean(rp(rp<=adjvar));
Fmincon is used as follows:
[w]=fmincon(@(w)adjcvar([ret.mscimin,static.vsfret],alpha,w),w0w,[],[],[],[],lbw,ubw,[],options);
with
options = optimset('Display','notify','Algorithm','active-set');
lbw=0; %Upper-bound
ubw=1; %Lower-bound
w0w=0.5; %Starting Value
What happens is that if I set w0w, the starting value, between 0 and 0.61, fmincon returns w=0. If i set w0w at 0.62 or above, fmincon returns w=1.
I know empirically that the right weight is around 0.61-0.62.
Fmincon returns the following message:
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
I'm quite new to fmincon and don't really understand why itjust goes to the upper or lower boundary and stops.
Thanks for reading and any advice you could give.
Have a nice day.
Edouard

Respuesta aceptada

Amit
Amit el 22 de En. de 2014
This is a single variable minimization. You should try fminbnd instead of fmincon.
Also, try plotting adjcvar([ret.mscimin,static.vsfret],alpha,w) for w values between 0 and 1 and see is the difference in sizes.
  4 comentarios
Edouard
Edouard el 22 de En. de 2014
Thank you so much, fminbnd works way better!
Actually, in the sample I work on mu+sig*diag(Q) is never greater than zero, such that the min(x,0) is always at x within the boudaries set for w.
The function is a nice, smooth bell.
Finally, and you might find this ridiculous, I'm mnimizing CVaR whereas CVaR is a negative value.
Hence I changed adjcvar to abs (mean(rp(rp<=adjvar))) and it works fine.
Note that fmincon returns a close but different value than fminbnd (0.6144 against 0.6183).
Anyway, thanks to you both.
Matt J
Matt J el 22 de En. de 2014
Editada: Matt J el 22 de En. de 2014
Actually, in the sample I work on mu+sig*diag(Q) is never greater than zero, such that the min(x,0) is always at x within the boudaries set for w.
That doesn't eliminate the hazards of non-smoothness. FMINCON doesn't confine itself to the bounds during its search. Not by default anyway. Moreover, min(x,0) is only smooth where x is strictly less than zero, and it's not clear whether your bounds would guarantee that, even if obeyed.
Note that fmincon returns a close but different value than fminbnd (0.6144 against 0.6183).
That could be a matter of the stopping tolerances you've chosen in each.

Iniciar sesión para comentar.

Más respuestas (1)

Moad
Moad el 18 de Feb. de 2014
Hello Sir can u provide a code of minimazing Value at Risk with the fmincon
i actualy want to minimize portfolio Parametric VaR for many assest returns
thank you very much

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by