var parametirco y no parametrico

14
1 Escuela Internacional de Ciencias Económicas 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

Upload: david-martin

Post on 22-Apr-2017

233 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: VAR Parametirco y No Parametrico

1

Escuela Internacional de Ciencias Económicas 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

Page 2: VAR Parametirco y No Parametrico

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.

Page 3: VAR Parametirco y No Parametrico

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.

Page 4: VAR Parametirco y No Parametrico

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(R≤R(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.

Page 5: VAR Parametirco y No Parametrico

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 Jan150

2000

4000

6000

8000

10000

12000

14000

16000

18000IGBC

Page 6: VAR Parametirco y No Parametrico

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.15Daily IGBC Returns

Page 7: VAR Parametirco y No Parametrico

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

%

Page 8: VAR Parametirco y No Parametrico

8

Exposure =

100000

VaR_nonparametric =

1.315 (mil trescientos quince millones de pesos por cada cien mil millones de exposición 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 exposición 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 distribución 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);

Page 9: VAR Parametirco y No Parametrico

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 términos de la regresión 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

Page 10: VAR Parametirco y No Parametrico

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

Page 11: VAR Parametirco y No Parametrico

11

%El parámetro 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.

% Gráfica de los retornos en la cola de la distribución y el ajuste del

%índice de colas (La pendiente de la línea de ajuste es el valor que toma

%el parámetro del índice de colas)

figure(1) clf fsize=14 ;% tamaño 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 estimación del índice de colas.

0.03 0.05 0.1

10-2

10-1

100

-x

P(r

etu

rn <

-x)

Estimation of the tail index using 273 worst returns

Page 12: VAR Parametirco y No Parametrico

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%)

% Nótese que el valor base de comparación para el cálculo del VaR es el

%VaR obtenido a partir del cuantil no paramétrico dado en la distribución

%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 distribución. El reciproco del índice de %colas toma el

valor de .3981. Para obtener este parámetro es necesario

% borrar los resultados anteriores y correr el código 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 ])

Page 13: VAR Parametirco y No Parametrico

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 límite 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 función es

%monotona creciente. set(gca,'ytick',[fliplr(round(varest2)) 10000 20000] )

0.01 0.025 0.05 0.10

0.5

1

1.5

2x 10

4

VaR

()

Page 14: VAR Parametirco y No Parametrico

14

0.01 0.025 0.05 0.1

0.18010.2466

0.3736

0.5116

1

2x 10

4

VaR

()

Normal

Parametric

Pareto Tail