<< duration Financial module esvarlin >>

Financial module >> Financial module > esvarevt

esvarevt

Compute both Expected Shortfall and Value at Risk by using the Extreme Value Theory. Furthermore, also the parameter of the Generalized Pareto Distribution are estimated with the Maximum Likelihood method

SYNOPSIS

[es,var,xoptim,v,inf]=esvarevt(x0,data,u,alpha);

Description

The Extreme Value Theory assumes that a phenomenon has a uniform distribution before a given threshold "u", while after this threshold it follows a Generalized Pareto Distribution having the form

f(x) = (1+xi*(x-u)/beta)^(-1/xi-1)/beta

This function estimates both "xi" and "beta" on the data (by Maximum Likelihood) and computes both the Expected Shortfall and the Value at Risk by using this density function.

Parameters

x0
guess values used by the fsolve function for estimating the parameters "xi" and "beta" of the Generalized Pareto Distribution (Maximum Likelihood estimation)
data
vector containing the historical data; these can be, for instance, prices or returns
u
threshold above which the data are assumed to follow the Generalized Pareto Distribution
alpha
confidence level at which all the risk measures must be computed; this value must strictly stay between 0 and 1 (and cannot be neither 0 nor 1)

Output

ES
expected shortfall, i.e. the mean of the data exceeding the alpha-quantile of the Generalized Pareto Distribution (on the right tail). The unit of measure is the same as that used for "data" (i.e. if data are returns, then this ES is expressed as a return)
VaR
value at risk, i.e. the loss coinciding with the alpha-quantile of the Generalized Pareto Distribution (on the right tail). The unit of measure is the same as that used for "data"
xoptim
estimated values (with maximum likelihood) of parameters "xi" and "beta" of the Generalized Pareto Distribution
v
value of the gradient of the likelihood function (it should be as close as possible to zero)
inf
same meaning as "inf" in the "fsolve" function

Example

First we generate 1000 random numbers taken from a Generalized Pareto Distribution. First step is the creation of a vector of 1000 uniformly distributed random variables:

-->U=grand(1000,1,'def');

then we create the random variables from the GPD with parameters u=0.0001; xi=0.5; beta=0.00015:

-->x=0.0001-0.00015/0.5+0.00015/0.5*(1-U)^(-0.5);

These data could be daily return on an asset. Now we can use the function on vector x for computing ES and VaR at, for instance, 0.01 confidence level

-->[es,var,xoptim,v,inf]=esvarevt([0.2 0.0002],x,0.0001,0.01)

inf = 1.

v = 1.0D-12 *

- 1.8189894 - 0.0017764

xoptim = 0.5020924 0.0001470

var = 0.0027625

es = 0.0057426

We can see that the convergence is good (please note that the algorithm is very sensitive to the initial condition x0). The estimated values of "xi" and "beta" are close to the true ones.

Authors

Francesco Menoncin - Brescia University - 2010

See Also


<< duration Financial module esvarlin >>