Você está na página 1de 14

1

Escuela Internacional de Ciencias Econmicas y Administrativas


RESEARCH SEMINAR: FINANCIAL ECONOMETRICS
Lecture Notes

Teacher: Javier Bonza
VaR Estimation
1. Some useful definitions
Value-at-Risk (VaR) uses two parameters, the time horizon and the confidence level, which
are denoted by T and 1 , respectively. Given these, the VaR is a bound such that the loss
over the horizon is less than this bound with probability equal to the confidence coefficient.
For example, if the horizon is one week, the confidence coefficient is 99% (so = 0.01), and
the VaR is $5 million, then there is only a 1% chance of a loss exceeding $5 million over the
next week. We sometimes use the notation VaR() or VaR(, T) to indicate the dependence
of VaR on or on both and the horizon T. Usually, VaR() is used with T being understood.

If L is the loss over the holding period T, then VaR() is the th upper quantile of L.
Equivalently, if R = -L is the revenue, then VaR() is minus the th quantile of R. For
continuous loss distributions, VaR() solves

(1)

2. Non parametric estimation of VaR

Suppose that we want a confidence coefficient of 1 for the risk measures. Therefore, we
estimate the -quantile of the return distribution, which is the -upper quantile of the loss
distribution. In the nonparametric method, this quantile is estimated as the -quantile of a
sample of historic returns, which we will call (). If S is the size of the current position, then
the nonparametric estimate of VaR is
2


(2)
with the minus sign converting revenue (return times initial investment) to a loss. Here, the
superscript np" means nonparametrically estimated."

3. Parametric estimation of VaR

Parametric estimation of VaR has a number of advantages. For example, parametric
estimation allows the use of GARCH models to adapt the risk measures to the current
estimate of volatility. Also, risk measures can be easily computed for a portfolio of stocks if
we assume that their returns have a joint parametric distribution such as a multivariate t-
distribution. Nonparametric estimation using sample quantiles works best when the sample
size and are reasonably large. With smaller sample sizes or smaller values of , it is
preferable to use parametric estimation.

VaR for normally distributed returns:

(3)

4. Semi parametric estimation of VaR

There is an interesting compromise between using a totally nonparametric estimator of VaR
and a parametric estimator. The nonparametric estimator is feasible for large , but not for
small . For example, if the sample had 1000 returns, then reasonably accurate estimation
of the 0.05-quantile is feasible, but not estimation of the 0.0005-quantile. Parametric
estimation can estimate VaR for any value of but is sensitive to misspecification of the tail
when is small. Therefore, a methodology intermediary between totally nonparametric
and parametric estimation is attractive. The approach used in this section assumes that
the return density has a polynomial left tail, or equivalently that the loss density has a
polynomial right tail.
3


Because the return distribution is assumed to have a Pareto left tail, for y >0,

Pr (R - y) = L(y)y
-
, (4)

Where L(y) is slowly varying at infinity and is the tail index. Therefore, if y1 > 0 and y2 >
0, as y then
(5)

Now suppose that y1 = VaR(1) and y2 = VaR(0), where 0 < 1 < 0. Then we have:

(6)


or
(7)

so, now dropping the subscript 1" of 1 and writing the approximate equality as exact, we
have
(8)

Equation (8) becomes an estimate of VaR() when VaR(0) is replaced by a nonparametric
estimate and the tail index a is replaced by one of the estimates discussed soon in the
following section. Notice another advantage of (8), that it provides an estimate of VaR() not
just for a single value of but for all values. This is useful if one wants to compute and
compare VaR() for a variety of values of . The value of 0 must be large enough that
VaR(0) can be accurately estimated, but can be any value less than 0.
4


A model combining parametric and nonparametric components is called semiparametric, so
estimator (8) is semiparametric because the tail index is specified by a parameter, but
otherwise the distribution is unspecified.

Regression Estimator of the Tail Index

It follows from (4) that

(9)
where

If R(1),,R(n) are the order statistics of the returns, then the number of observed returns
less than or equal to R(k) is k, so we estimate log{P(RR(k)} to be log(k/n). Then, from (9),
we have

(10)

or, rearranging (10)

(11)

The approximation (11) is expected to be accurate only if -R(k) is large, which means k is
small, perhaps only 5%, 10%, or 20% of the sample size n.

5

If we plot the points for m equal to a small percentage of n, say
10%, then we should see these points fall on roughly a straight line. Moreover, if we fit the
straight-line model (11) to these points by least squares, then the estimated slope, call it
, estimates 1/. Therefore, we will call -1/ the regression estimator of the tail index.



Example VaR estimation for Colombian Stock Exchange ret urns
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This code computes a non-parametric VaR for a given alpha quantile
%% Load the data
IGBC=xlsread('IGBC');
StockPrices=IGBC(:,2);
Date=IGBC(:,1)+datenum('30-Dec-1899');
% Colombian Stock Index Chart
plot(Date,StockPrices),title('IGBC')
datetick('x',12)
grid on

%% Returns
Jan00 Jul02 Jan05 Jul07 Jan10 Jul12 Jan15
0
2000
4000
6000
8000
10000
12000
14000
16000
18000
IGBC
6

n=length(StockPrices);
logIGBC=log(StockPrices);
returns=logIGBC(2:n)-logIGBC(1:n-1);
plot(Date(2:n),returns),title('Daily IGBC Returns')
datetick('x',12)
grid on



%% Kth order statistic of the sample return, R(k)
cutoff=0.1;% alpha quantile
% Cuttoff is the percentage of data sample included in the tail of the
% distribution, meaning a 90% interval confidence.
K=round((n-1)* cutoff); % K observations rounded to the nearest integer
order_returns=sort(returns);
plot(order_returns)
grid on
worst_return=min(order_returns);
maximum_return=max(order_returns);
quant_nonparametric=order_returns(K);


Jan00 Jul02 Jan05 Jul07 Jan10 Jul12 Jan15
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
Daily IGBC Returns
7


% Output answers highlighted in blue (obtained directly from %
the command window by running the parameters)

K =

273

worst_return =

-0.1105


maximum_return =

0.1469

quant_nonparametric =

-0.0132

%% Non parametric Value at Risk (VaR)
% figures in COP millions
Exposure=100000
VaR_nonparametric=-Exposure*quant_nonparametric

0 500 1000 1500 2000 2500 3000
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
# of observations
Sort returns
%
8

Exposure =

100000

VaR_nonparametric =

1.315 (mil trescientos quince millones de pesos por cada cien mil millones de exposicin al IGBC
pueden perderse en el mejor del 10% de los peores eventos del ndice accionario de Colombia)

%% Parametric VaR. Estimation under the assumption that returns are
% normally distributed
ecdf%
%% Parameters calculations
cutoff=0.1;
avg_returns=mean(returns);
volatility=std(returns);
inversecdf=norminv(cutoff);
normal_quantile=avg_returns+inversecdf*volatility
%% Parametric VaR
VaR_norm=-normal_quantile*Exposure

normal_quantile =

-0.0170

VaR_norm =

1.703 (mil setecientos tres millones de pesos por cada cien mil millones de exposicin al (IGBC
pueden perderse en el mejor del 10% de los peores eventos del ndice accionario de Colombia,
bajo el supuesto que los retornos siguen una distribucin gaussiana)

%% Tail Index estimation
% For k= 273 returns (10% of the overall observations, since the whole
% sample comprises 2734 returns)
R_k = order_returns(1:273);
k=length(R_k);
Y=log((1:k)./k)';
logR_k=log(-R_k);
plot(Y)
plot(logR_k)
whichstats={'beta','yhat','rsquare'};
stats=regstats(Y,logR_k,'linear',whichstats);
beta=stats.beta;
tail_index=beta(2);
9

r_square=stats.rsquare;
y_hat=stats.yhat;
est_a=-1/tail_index;

% R_k ordena de manera descendente el 10% de los peores retornos
%observados en la muestra

% Reorganizando trminos de la regresin obtenemos:
%

plot(R_k)






plot(logR_k)
0 50 100 150 200 250 300
-0.12
-0.1
-0.08
-0.06
-0.04
-0.02
0
# of observations
%
Returns on the tail of the distribution
10


tail_index=beta(2)

tail_index =

-2.2055

r_square

>> r_square =

0.9818

est_a

>> est_a=

0.4534
0 50 100 150 200 250 300
-4.5
-4
-3.5
-3
-2.5
-2
11


%El parmetro anterior (0.4534) es el reciproco del ndice %de
colas. Es el factor por el cual se escala el VaR dado un
%coeficiente de confianza. Por ejemplo, el VaR al 99% de
%confianza ser igual al VaR al 90% de confianza %multiplicado
por: (0.1/0.01)^0.4534=2,84. El VaR al 99% de %confianza es
2,84 veces mayor que el VaR al 90% de %confianza.

% Grfica de los retornos en la cola de la distribucin y el ajuste del
%ndice de colas (La pendiente de la lnea de ajuste es el valor que toma
%el parmetro del ndice de colas)

figure(1)
clf
fsize=14 ;% tamao de la fuente
p = loglog(-R_k,(1:k)./k ,'.' ,-R_k,exp(y_hat)) ;
set(gca,'ylim',[10^(-2.2) 1.5])
set(gca,'xlim',[min(-R_k)-.001 max(-R_k)+.005])
set(p(2),'linewidth',3)
xlabel('-x','fontsize',fsize)
ylabel('P(return < -x)','fontsize',fsize)
set(gca,'xtick',[.03 .05 .1 .15])
set(gca,'fontsize',fsize)



% Grafica que genera el VaR para diferentes niveles de confianza bajo
%la estimacin del ndice de colas.

0.03 0.05 0.1
10
-2
10
-1
10
0
-x
P
(
r
e
t
u
r
n

<

-
x
)
Estimation of the tail index using 273 worst returns
12

figure(2)
clf
alpha = linspace(.00025,.1,301) ;%alpha es un vector que interpola
%linealmente entre 0.25% y 10% (v.gr., genera 301 coeficientes de %confianza
para niveles de confianza definidos en un rango entre el %90% y el 99.975%)

% Ntese que el valor base de comparacin para el clculo del VaR es el
%VaR obtenido a partir del cuantil no paramtrico dado en la distribucin
%observada de los datos con un nivel de confianza del 90%:

varest = 0.0131500330115895*Exposure.*(.1./alpha).^(est_a);

% VaR estimated for K = 137 (varestB)
% Este es el VaR tomando el 5% de las observaciones del total de la %muestra
para la cola de la distribucin. El reciproco del ndice de %colas toma el
valor de .3981. Para obtener este parmetro es necesario
% borrar los resultados anteriores y correr el cdigo desde el inicio
varestB = 0.0131500330115895*Exposure.*(.1./alpha).^(.3981) ;

mu = mean(order_returns) ;
sig = std(order_returns) ;
VaRParam = -Exposure*(mu + sig*norminv(alpha)) ;
VaRParam2 = -Exposure*(mu + sig*norminv([.005 .01 .025 .05 ]))


plot(alpha,varest,alpha,VaRParam,'--' ) ;
xlabel('\alpha','fontsize',18)
ylabel('VaR(\alpha)','fontsize',18)
set(gca,'fontsize',fsize)
set(gca,'xtick',[ .01 .025 .05 .1])

varest2 = interp1(alpha,varest,[.005 .01 .025 .05 ])
varest2B = interp1(alpha,varestB,[.005 .01 .025 .05 ])

13



% En el eje de las ordenadas, vamos a ilustrar el VaR. Los limites se
%fijan de acuerdo al rango obtenido en las estimaciones del ndice de
%colas. En este caso el VaR va estar espaciado cada $1.000 millones con
%un lmite superior de $20 mil millones.

set(gca,'ylim',[1000 20000])

line([.01 .01],[1000 varest2(2)])
line([.025 .025],[1000 varest2(3)])
line([.05 .05],[1000 varest2(4)])
line([.005 .005],[1000 varest2(1)])

line([0 .005],[varest2(1) varest2(1)])
line([0 .01],[varest2(2) varest2(2)])
line([0 .025],[varest2(3) varest2(3)])
line([0 .05],[varest2(4) varest2(4)])

% la funcion flipr invierte el orden de los datos, en este caso el VaR
%calculado bajo el ndice de colas y niveles de confianza del 99.5% al
% 95%. Los siguientes dos valores deben ser mayores. La funcin es
%monotona creciente.
set(gca,'ytick',[fliplr(round(varest2)) 10000 20000] )


0.01 0.025 0.05 0.1
0
0.5
1
1.5
2
x 10
4

V
a
R
(

)
14


0.01 0.025 0.05 0.1
0.1801
0.2466
0.3736
0.5116
1
2
x 10
4

V
a
R
(

)
Normal
Parametric
Pareto Tail

Você também pode gostar