EconPapers    
Economics at your fingertips  
 

VAR_AND_ES: SHAZAM code for computing VaR and Expected Shortfall

Ibrahim Onour

HSC Software from Hugo Steinhaus Center, Wroclaw University of Science and Technology

Abstract: Since the primary goal of this program to estimate the likelihood of extreme losses (or big, unusual losses) for investors in stock markets, in Shazam program we set first the sample size (the range of the time series data) available for estimation process. In our case, the sample size extends from 1 to 1000 observations of stock prices. Immediate to the sample size command, the READ statement follows to define the variable name under investigation, which in our case is defined as x. Following the read statement, the data set should be pasted or entered. Now, compute log transformed stock returns, by successive differencing of stock prices so that (x2=x1-lag(x1)), and then determine the negative return values (x3=x2.LT.0). Estimation of likelihood of extreme risk (or extreme negative returns) justifies the use of the Generalized Pareto Distribution (GPD), which depends on extreme values and two parameters, beta1 (the tail index) and beta2 (the scale parameter). Because GPD density function requires absolute values of of the loss values, we transform the loss values into absolute values, xa=abs(x3). To determine the extreme losses we set the mean of the loss values as a threshold value (u). Set the extreme values as those values of negative returns (in absolute terms) exceeding the threshold value. Use the extreme values to estimate the GPD density parameters. Compute VaR value using the equation, v=u+(beta2/beta1)[{(N/n)(1-q)}**(-beta1)-1], where n is the number of observations of extreme losses, N is the total number of observations. Use VaR value to compute Expected Shortfall value using the relationship, ES=(VaR/1-beta1)+(beta2-ubeta1)/(1-beta1). Finally, back testing is performed by computing the percentage of number of observations of actual negative returns exceeding estimated VaR value.

Language: SHAZAM
Requires: SHAZAM VERSION 10.
Keywords: VaR; Expected Shortfall; Extreme losses; Threshold value; Pareto distribution. (search for similar items in EconPapers)
Date: 2012-04-04
References: Add references at CitEc
Citations:

Downloads: (external link)
http://www.im.pwr.wroc.pl/~hugo/RePEc/wuu/hscode/var_and_es.txt Program file (text/plain)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:wuu:hscode:m12003

Access Statistics for this software item

More software in HSC Software from Hugo Steinhaus Center, Wroclaw University of Science and Technology Contact information at EDIRC.
Bibliographic data for series maintained by Rafal Weron ().

 
Page updated 2025-04-02
Handle: RePEc:wuu:hscode:m12003