IDEAS home Printed from https://ideas.repec.org/c/wuu/hscode/m12003.html
 

VAR_AND_ES: SHAZAM code for computing VaR and Expected Shortfall

Author

Listed:
  • Ibrahim A. Onour

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.

Suggested Citation

  • Ibrahim A. Onour, 2012. "VAR_AND_ES: SHAZAM code for computing VaR and Expected Shortfall," HSC Software M12003, Hugo Steinhaus Center, Wroclaw University of Technology.
  • Handle: RePEc:wuu:hscode:m12003
    as

    Download full text from publisher

    File URL: http://www.im.pwr.wroc.pl/~hugo/RePEc/wuu/hscode/var_and_es.txt
    File Function: Program file
    Download Restriction: no

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:wuu:hscode:m12003. See general information about how to correct material in RePEc.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: (Rafal Weron). General contact details of provider: http://edirc.repec.org/data/hspwrpl.html .

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service hosted by the Research Division of the Federal Reserve Bank of St. Louis . RePEc uses bibliographic data supplied by the respective publishers.