Assignments for Financial Risk Forecasting

Exercises

  1. Home
  2. Exercises

Exercises. July 2021

The assignments are to be solved using MATLAB or R software, were all solutions involve some practical financial problem. The presentations are executed and presented in groups. Each group consists of one, two, or three students. Each group selects a class problem from the list below. Each presentation should take no more than 25 minutes, and normally be done using PowerPoint or pdf. The presentation should highlight the MATLAB or R code, and care must be taken to assign equal weight in the presentation to each member of the group. The first problems are generally easier. All presentations should start with a statistical and graphical description of the data, including identifying outliers.


Practice Problems

  • Select 3 exchange rates, and load into MATLAB/R. Plot the exchange rates. Calculate returns, and plot the returns. Calculate relevant summary statistics.

  • Select three daily different price series, from 2 different data categories (e.g. equity, FX). For the same time horizon, compare the statistical properties of the three series, including a test for normality considering both prices and returns. Plot the histogram and a QQ diagram of each series.

  • Select 2 data series, load them into MATLAB, and convert to returns. Briefly describe the data statistically. Calculate the covariance between the two series, using both the returns and returns squared.

  • For the same 2 data series, calculate the autocorrelation of each series, using both the returns and returns squared.

  • For the same data, plot the ACF for prices, returns, returns squared, and absolute returns.

  • For the same data, calculate a moving window volatility and correlations (using 10 and 20 week window) and plot the result. A moving window value of the variance [\(\bar{\sigma}^2_t\)]{.math .inline} is created as follows. Suppose [\(N\)]{.math .inline} is the window length and [\(T\)]{.math .inline} the data length, then [\[\bar{\sigma}^2_t=Var(r_{t-N}, \ldots ,r_{t}), \,\, t=N,\ldots,T\]]{.math .display} where [\(Var\)]{.math .inline} indicates the variance.

  • For a return series, calculate the mean and variance. Calculate VaR and ES

  • For 2 return series, calculate the mean, variance, and covariance. Calculate VaR and ES for each asset and a portfolio of those assets.

  • Select 2 daily data series. Aggregate the prices into weekly and monthly prices. To do this simply pick every 5th and every 20th prices. An easy way is to do this is, for prices in vector P, to create a vector of the same length as the data with elements like [\(X=[1, 6, 11, 16, etc]\)]{.math .inline}, (try statement 1:5:T and then P(X)) and compare and contrast the statistical properties as the data is aggregated.
    Zero returns on some day may indicate that markets were closed that day, and it may be a good idea to remove them. Remove zeros from your returns. Hint use the MATLAB find statement. Do the zeros happen on the same days for both returns?


Assignments

  1. Simulate portfolio option VaR Take a return series and calculate its mean and variance. Price an option on the asset with Black--Scholes. Price the same option with Monte Carlo. Use Monte Carlo to obtain one day VaR for the option. Take a stock price and stock index series and calculate the return covariance matrix. Estimate one day VaR for portfolio consisting of an long position in the stock and an option on the index.

  2. GARCH models Select a return series. Use all available univariate GARCH type models which nest ARCH (e.g. ARCH, GARCH, PGARCH, etc) to forecast the volatility. Explain the difference between the models. Test for the differences between the models (e.g. parameter significance and LR tests), and look at how their volatility forecasts and residuals differ.

  3. Program likelihood (challenging, emphasizes programming) Choose a return series. Create a MATLAB function that accepts a parameter set and a return vector, and returns the negative log likelihood for the ARCH(1) model. Then use a MATLAB function optimizer to minimize the negative log likelihood. Compare your results to the built--in ARCH function.

  4. Use 3 returns series. Calculate a moving window volatility and correlations for various window lengths. Discuss the sensitivity of window length for volatility/correlation estimation.

  5. Factor models (challenging, only attempt if you know PCA) Select 3 assets from the same market (e.g. stocks on the same exchange). Estimate a factor volatility model using PCA and GARCH.

  6. EVT (challenging, only attempt if you have a strong statistics background) Select 3 daily returns from different asset classes. Estimate the lower and upper tails by using extreme value theory (EVT), where you use the Hill estimator for the tail index and an arbitrary threshold. Investigate graphically the impact of changing the threshold. Plot the actual and estimated lower tail, and forecast VaR.

  7. Backtesting HS and EWMA Select 3 assets and backtest EWMA and HS VaR for a portfolio of the assets. Focus e.g. on violation rations and VaR volatility. Demonstrate the results statistically, graphically, and provide analysis.

  8. Backtesting HS and GARCH Select 3 assets and backtest normal GARCH, Student-t GARCH, and HS for each asset individually. Focus e.g. on violation rations, VaR volatility. Demonstrate the results statistically, graphically, and provide analysis.

  9. ES (challenging) Select 3 assets and backtest ES.

  10. Backtesting of EWMA Select 3 assets and backtest EWMA with all the methods discussed in the lecture notes, violation rations, VaR volatility, coverage test and independence test.

  11. Robustness of backtests. Advanced, focuses both on programming and statistics. Select 1 asset and backtest EWMA, testing for significance of violation ratios, and clustering. Access the robustness of the tests with Monte Carlo methods.

  12. Advanced backtests. Focuses both on programming and statistics. Select 1 asset and backtest EWMA, testing for significance of violation ratios, and clustering. Look at the general literature on backtests and apply some of the most common backtest methods to the model.

  13. Non--linear dependence. Pick 3 datasets, and explore non--linear dependence, both with exceedance plots and copulas. Note the datasets need to be long for this.


Financial Risk Forecasting
Market risk forecasting with R, Julia, Python and Matlab. Code, lecture slides, implementation notes, seminar assignments and questions.
© All rights reserved, Jon Danielsson,

Financial Risk Forecasting
Market risk forecasting with R, Julia, Python and Matlab. Code, lecture slides, implementation notes, seminar assignments and questions.
© All rights reserved, Jon Danielsson,