<< Financial module Financial module bollinger >>

Financial module >> Financial module > backtest

backtest

Apply the backtest to three different risk measures (as percentage of lost): Expected Shortfall, Value at Risk, and a Spectral Measure with linear spectrum. Show the graph of historical returns and the risk measures. The thresholds of the backtest are also computed.

SYNOPSIS

backtest (prices, alpha [, N])

Description

Thia function checks the ability of three different risk measures (VaR, ES, and linear spectral) to suitably measure the shortfalls in asset returns.

Parameters

prices

matrix whose columns contain the historical prices of each asset

alpha

confidence level of risk measures; it goes from 0 to 1 (both 0 and 1 excluded)

N
the number of observations which the backtest is computed on (default value 250 if there are more than 500 historical prices, else N is half the number of rows of the matrix "prices")

Example

First we generate 10000 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 10000x3 matrix of normal random variables (with mean 0.1/250 and standard deviation 0.2/sqrt(250))

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

Then we create the prices

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

and apply the function with an alpha, for instance, equal to 0.01:

-->backtest(prices,0.01);

The result is:

!Green zone: 0-5 !

!Yellow zone: 5-10 !

!Red zone: 10- !

!ES: 1 exeptions !

!VaR: 4 exeptions !

!Linear Spectrum: 1 exeptions !

Which shows that the ES and the Linear Spectral measure are very reliable (since they present only 1 exeption), while the VaR is the less reliable. The figure which is created shows the same result is graphical form.

Authors

Francesco Menoncin - Brescia University - 2010

See Also


<< Financial module Financial module bollinger >>