<< esvarevt Financial module esvaroptim >>

Financial module >> Financial module > esvarlin

esvarlin

Compute three risk measures on historical prices of a set of assets, and at a given confidence level. The three risk measures are: Expected Shortfall (ES), Value at Risk (VaR) and a Linear Spectral risk measure (lin).

SYNOPSIS

[ES,VaR,L]=esvarlin(prices,alpha);

Description

On historical prices of some assets compute three risk measures at a given confidence level. The three measures are: Expected Shortfall (the mean of the losses exceeding a given quantile), Value at Risk (coinciding with a quantile), and a Linear Spectral risk measure whose spectrum linearly decreases for losses exceeding a given quantile (the same used for the previous risk measures)

Parameters

prices
any column of this matrix contains the historical prices of an asset
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 (as a percentage of the last price), i.e. the mean of the losses exceeding the alpha-quantile
VaR
value at risk (as percentage of the last price), i.e. the loss coinciding with the alpha-quantile
L
the wighted mean of the losses exceeding the alpha-quantile (the weights linearly decrease); as a percentage of last price

Example

First we generate 1000 log-normally distributed prices for three different assets whose initial values are 25 euros, 50 euros, and 110 euros. First step is the creation of a 1000x3 matrix of normal random variables (with mean 0.1/250 and standard deviation 0.2/sqrt(250))

-->M=grand(1000,3,'nor',0.1/250,0.2/sqrt(250));

Then we create the prices

-->prices=exp(cumsum(M,1))*diag([25 50 110]);

Now the three risk measures are computed

-->[ES,VaR,L]=esvarlin(prices,0.01)

L = 0.0365767 0.0327525 0.0351212

VaR = 0.0274819 0.0281535 0.0281464

ES = 0.0331532 0.0309606 0.0323584

Authors

Francesco Menoncin - Brescia University - 2010

See Also


<< esvarevt Financial module esvaroptim >>