Econometrics Toolbox 1.2
Market Risk Using Bootstrapping and Filtered Historical Simulation
The market risk of a hypothetical global equity index portfolio is modeled with a filtered historical simulation (FHS) technique. FHS, which has recently received much attention in the risk management literature, is an alternative to traditional historical simulation and Monte Carlo simulation approaches. FHS combines a relatively sophisticated model-based treatment of volatility (GARCH) with a nonparametric specification of the probability distribution of assets returns.
This demonstration first extracts the filtered model residuals and conditional volatilities from the portfolio return series with an asymmetric GARCH model from which the series of independent and identically distributed (i.i.d.) standardized residuals is formed. FHS retains the nonparametric nature of historical simulation by bootstrapping (sampling with replacement) from the standardized residuals. These bootstrapped standardized residuals are then used to generate time paths of future asset returns. Finally, the simulation assesses the Value-at-Risk (VaR) of the hypothetical global equity portfolio over a one month horizon.
One of the appealing features of FHS is its ability to generate relatively large deviations (losses and gains) not found in the original portfolio return series.
This demonstration illustrates just one of many alternatives and is not meant to espouse any particular risk management philosophy. For another alternative, see the demonstration entitled Market Risk Using GARCH, Extreme Value Theory, and Copulas.
Contents
Examine the Daily Closings of the Global Equity Index Data
The raw data consists of 2665 observations of daily closing values of the following representative equity indices spanning the trading dates 27-April-1993 to 14-July-2003:
Canada: TSX Composite (Ticker ^GSPTSE)
France: CAC 40 (Ticker ^FCHI)
Germany: DAX (Ticker ^GDAXI)
Japan: Nikkei 225 (Ticker ^N225)
UK: FTSE 100 (Ticker ^FTSE)
US: S&P 500 (Ticker ^GSPC)The following plot illustrates the relative price movements of each index. The initial level of each index has been normalized to unity to facilitate the comparison of relative performance, and no dividend adjustments are explicitly taken into account.
load indexdata % Import daily index closings countries = {'Canada' 'France' 'Germany' 'Japan' 'UK' 'US'}; prices = [IndexData.Canada IndexData.France IndexData.Germany ... IndexData.Japan IndexData.UK IndexData.US]; figure plot(IndexData.Dates, ret2price(price2ret(prices))) datetick('x') xlabel('Date') ylabel('Index Value') title ('Relative Daily Index Closings') legend(countries, 'Location', 'NorthWest')
In preparation for subsequent modeling, specify the portfolio weight vector. Although an equally weighted portfolio is assumed, you can change the weight vector to examine any other portfolio composition or even a single country. Note that the portfolio weights are fixed throughout the risk horizon, and that the simulation ignores any transaction costs required to rebalance the portfolio (the daily rebalancing process is assumed to be self-financing).
nIndices = size(prices,2); % # of indices weights = repmat(1/nIndices, nIndices, 1); % Equally weighted portfol io
Given the weights, form the portfolio logarithmic return series (sometimes called geometric, or continuously compounded returns) from the daily returns of the individual indices. Although the index returns are logarithmic, the portfolio return series is constructed by first converting the individual logarithmic returns to arithmetic returns (price change divided by initial price), then weighting the individual arithmetic returns to obtain the arithmetic return of the portfolio, and finally converting back to portfolio logarithmic return. With daily data and a short VaR horizon, the repeated conversions make little difference, but for longer time periods the disparity may be significant.
returns = price2ret(prices,[],'Periodic') * weights; % Arithmetic returns returns = log(1 + returns); % Logarithmic returns T = size(returns, 1); % Historical sample siz e
Plot the daily closing value of the hypothetical portfolio along with the corresponding return series for comparison.
figure, subplot(2,1,1) plot(IndexData.Dates, ret2price(returns)), datetick('x') xlabel('Date'), ylabel('Closing Level'), title('Daily Portfolio Closings') subplot(2,1,2) plot(IndexData.Dates(2:end), returns), datetick('x') xlabel('Date'), ylabel('Return'), title('Daily Portfolio Logarithmic Returns ')
Filter the Portfolio Returns
The bootstrapped FHS method requires the observations to be approximately independent and identically distributed. However, most financial return series exhibit some degree of autocorrelation and, more importantly, heteroskedasticity.
For example, the sample autocorrelation function (ACF) of the portfolio returns reveal some mild serial correlation.
figure
autocorr(returns)
title('Sample ACF of Returns')
However, the sample ACF of the squared returns illustrates the degree of persistence in variance and implies that GARCH modeling may significantly condition the data used in the subsequent bootstrapping method.
figure
autocorr(returns.^2)
title('Sample ACF of Squared Returns')
To produce a series of i.i.d. observations, fit a first order autoregressive model to the conditional mean of the portfolio returns

and an asymmetric exponential GARCH (EGARCH) model to the conditional variance
![$$log[\sigma^2(\tau)] = \kappa + \alpha log[\sigma^2(\tau-1)] + \phi (|z(\tau-1)| - E[|z(\tau-1)|]) + \psi z(\tau-1)$$](/products/demos/shipping/econ/garchfhsdemo_eq47979.png)
The first order autoregressive model compensates for autocorrelation, while the EGARCH model compensates for heteroskedasticity. In particular, the EGARCH model also incorporates asymmetry (leverage) into the variance equation (see Nelson [6]).
Additionally, the standardized residuals of each index are modeled as a standardized Student's t distribution to compensate for the fat tails often associated with equity returns. That is

The following code segment estimates the AR(1)/EGARCH(1,1) model and extracts the filtered residuals and volatilities from the portfolio returns.
spec = garchset('Distribution' , 'T' , 'P', 1, 'Q', 1, 'R', 1, ... 'VarianceModel', 'EGARCH', 'Display','off'); [spec, errors, LLF, residuals, sigmas] = garchfit(spec, returns); garchdisp(spec, errors) % Display the estimation results
Mean: ARMAX(1,0,0); Variance: EGARCH(1,1)
Conditional Probability Distribution: T
Number of Model Parameters Estimated: 7
Standard T
Parameter Value Error Statistic
----------- ----------- ------------ -----------
C 0.00021368 0.0001247 1.7135
AR(1) 0.18549 0.019902 9.3199
K -0.13367 0.030074 -4.4447
GARCH(1) 0.98639 0.0030911 319.1056
ARCH(1) 0.13383 0.019007 7.0412
Leverage(1) -0.091888 0.012151 -7.5625
DoF 12.649 2.7035 4.6787
Compare the model residuals and the corresponding conditional standard deviations filtered from the raw returns. The lower graph clearly illustrates the variation in volatility (heteroskedasticity) present in the filtered residuals.
figure, subplot(2,1,1) plot(IndexData.Dates(2:end), residuals) datetick('x') xlabel('Date'), ylabel('Residual'), title ('Filtered Residuals') subplot(2,1,2) plot(IndexData.Dates(2:end), sigmas) datetick('x') xlabel('Date'), ylabel('Volatility') title ('Filtered Conditional Standard Deviations')
Having filtered the model residuals from the portfolio return series, standardize each residual by the corresponding conditional standard deviation. These standardized residuals represent the underlying zero-mean, unit-variance, i.i.d. series. The i.i.d. property is important for bootstrapping, and allows the sampling procedure to safely avoid the pitfalls of sampling from a population in which successive observations are serially dependent.
standardizedResiduals = residuals ./ sigmas;
To conclude this section, examine the ACFs of the standardized residuals and squared standardized residuals.
Comparing the ACFs of the standardized residuals to the corresponding ACFs of the raw returns reveals that the standardized residuals are now approximately i.i.d., thereby far more amenable to subsequent bootstrapping.
figure autocorr(standardizedResiduals) title('Sample ACF of Standardized Residuals') figure autocorr(standardizedResiduals.^2) title('Sample ACF of Squared Standardized Residuals')
Simulate Global Index Portfolio Returns with FHS
As already mentioned, FHS bootstraps standardized residuals to generate paths of future asset returns and, therefore, makes no parametric assumptions about the probability distribution of those returns. The bootstrapping procedure produces i.i.d. standardized residuals consistent with those obtained from the AR(1)/EGARCH(1,1) filtering process above.
The following code segment simulates 20,000 independent random trials of standardized residuals over a one month horizon of 22 trading days.
s = RandStream.getDefaultStream(); reset(s) nTrials = 20000; % # of independent random trials horizon = 22; % VaR forecast horizon bootstrappedResiduals = standardizedResiduals(unidrnd(T, horizon, nTrials));
Using the bootstrapped standardized residuals as the i.i.d. input noise process, reintroduce the autocorrelation and heteroskedasticity observed in the original portfolio return series via the GARCH Toolbox™ simulation engine (GARCHSIM). Note that since only the simulated return series (the last output of GARCHSIM) is needed, the first two outputs are assigned to a dummy variable placeholder and ignored.
To make the most of current information, specify the necessary presample model residuals, volatilities, and returns so that each simulated path evolves from a common initial state.
preResidual = residuals(end); % Presample model residuals preSigma = sigmas(end); % Presample volatilities preReturn = returns(end); % Presample returns [dummy, dummy, ... portfolioReturns] = garchsim(spec, horizon, nTrials, ... bootstrappedResiduals , [], [], ... preResidual, preSigma, preReturn);
Summarize the Results
Having simulated the returns of the global index portfolio, report the maximum gain and loss, as well the VaR at various confidence levels, over the one month risk horizon. Also, plot the empirical cumulative distribution function (CDF) and the probability density function (PDF) of the portfolio cumulative returns.
Since you are working with daily logarithmic returns, the cumulative returns over the risk horizon are simply the sum of the returns over each intervening period.
cumulativeReturns = sum(portfolioReturns); VaR = 100 * quantile(cumulativeReturns, [0.10 0.05 0.01]'); disp(' ') fprintf('Maximum Simulated Loss: %8.4f%s\n' , -100*min(cumulativeReturns), '%') fprintf('Maximum Simulated Gain: %8.4f%s\n\n' , 100*max(cumulativeReturns), '%') fprintf(' Simulated 90%% VaR: %8.4f%s\n' , VaR(1), '%') fprintf(' Simulated 95%% VaR: %8.4f%s\n' , VaR(2), '%') fprintf(' Simulated 99%% VaR: %8.4f%s\n\n', VaR(3), '%') figure h = cdfplot(cumulativeReturns); set(h, 'Color', 'Red'); xlabel('Logarithmic Return'), ylabel('Probability') title ('Simulated One-Month Global Portfolio Returns CDF') figure delta = 0.02; bins = [-0.3:delta:0.2]; h = bar(bins, histc(cumulativeReturns,bins)/(nTrials * delta), 'histc'); xlabel('Logarithmic Return'), ylabel('Probability Density') title ('Simulated One-Month Global Portfolio Returns PDF') xlim([-0.3 0.2]), grid('on')
Maximum Simulated Loss: 39.7584%
Maximum Simulated Gain: 15.2452%
Simulated 90% VaR: -5.0143%
Simulated 95% VaR: -7.2182%
Simulated 99% VaR: -12.4876%
Bibliography
The following papers and journal articles present useful background information related to FHS; many of these may be found at http://www.gloriamundi.org.
[1] Barone-Adesi, G., Giannopoulos, K., Vosper, L. (1999), "VaR without Correlations for Non-Linear Portfolios", Journal of Futures Markets, vol. 19, pp. 583-602.
[2] Brandolini, D., Pallotta, M., Zenti, R. (2000), "Risk Management in an Asset Management Company: A Practical Case".
[3] Christoffersen, P.F., (2002), "Elements of Financial Risk Management" (see Chapter 5, Simulation-Based Methods).
[4] Dowd, K. (2002), "Measuring Market Risk", John Wiley & Sons, pp. 69-71.
[5] McNeil, A. and Frey, R. (2000), "Estimation of Tail Related Risk Measure for Heteroscedastic Financial Time Series: An Extreme Value Approach". Journal of Empirical Finance 7, pp. 271-300.
[6] Nelson, D.B., "Conditional Heteroskedasticity in Asset Returns: A New Approach", Econometrica, vol. 59, pp. 347-370.
Store