calcvar.m - terminal interface for VaR calculation
%VaR estimation.
deltavar - delta-normal VaR.
simulvar - hystorical simulation VaR.
montevar - Monte Carlo VaR.
%in matlab command window
>>calcvar
% Load data ------------------------------------------------------------------------
file=input('Which data? (1, 2, 3) '); 1
if file==1 load('dati1');
elseif file==2 load('dati2');
else load('dati3');
end
% Type of return --------------------------------------------------------------------
rendimento=input('Which return? (0 normal, 1 log) '); 0
% Decay factor ----------------------------------------------------------------------
lambda=input('Decay factor? (x<=1) '); 0.9
% Parameters ------------------------------------------------------------------------
t=input('Holding period? '); 1
p=input('Probability? '); 0.5
%VaR method ------------------------------------------------------------------------
a=input('VaR methods? (1 delta-normal, 2 historical simulation, 3 Monte Carlo, 4 average) ');2
tipo=input('Mapping? (0 from risk factors, 1 from prices) '); 0
[svar] = simulvar(DR,RC,X,delta,valuta,legame,vm,t,p,tipo,rendimento)
svar =
0 from risk factors : -0.0293
1 from prices : -0.0148


雷达卡
京公网安备 11010802022788号







