Document Sample

Looking for independence: reducing the risk of groups of long-short strategies during market swings through correlation forecasts MSc Finance and Economics 2003-2004 AC402, Financial Risk Analysis, Dissertation London School of Economics Department of Accounting and Finance Candidate Number: 67446 Word Count: 5968 (as specified, although lengthy, appendices are not part of the word count) June 24, 2004 “The copyright of this dissertation rest with the author and no quotation from it or information derived from it may be published without prior written consent of the author.” Contents Abstract 2 1 Data 3 1.1 Original versus in US 4 1.2 Trading costs 5 2 Long-short models 6 2.1 ARMA (lags) 7 2.2 GARCH 8 2.2.1 Zero mean 8 2.2.2 Lags 9 2.3 Results 10 2.3.1 Trading theory 11 2.3.2 Comparison 12 3 Correlation 15 3.1 Theoretical models 16 3.2 Refinements 17 3.3 Evaluating predictions 18 3.4 Results 21 3.4.1 Trading theory 21 3.4.2 Evaluation 22 4 Conclusion 24 4.1 Potential problems 26 4.2 Beyond correlation 27 References 28 Appendices 31 1 Abstract In this dissertation I will look at daily trading strategies for trading index futures (ARMA forecasts scaled by GARCH forecasts to produce a long-short strategy, in DJIA, Nasdaq Composite, S&P 500, FTSE 100, [DAX 30], [CAC 40], Nikkei 225, and [Hang Seng] – both locally, and adjusted for exchange rates). In this initial analysis, issues relating to the cost of trading and the number of lags to use within the models will be discussed. This will serve as the benchmark and the basis to generate the covariance forecasts. In the second, main, part of the dissertation I will look at forecasting correlation between the five (not in []) indices mentioned above. Subsequently implementing these forecasts to reduce the risk of the overall ‘portfolio’ of strategies, and evaluating the result using Value at Risk methodology. Issues relating to the optimum (minimum variance) portfolio and non-synchronous trading of foreign markets will be discussed. While the optimum portfolio’s results will be compared against an equally weighted benchmark. In conclusion the results will be discussed and possible explanations for the observations will be presented. As well as a brief discussion of potential problems with a practical implementation, and a mention of alternative ways of looking at interdependence between asset returns. 2 1 Data The data used was acquired from DataStream (Thomson Financial) and spans from January 1st 1990 to December 31st 2003, consisting of daily data. The following time series were obtained: Price Indices: Dow Jones Industrials Nasdaq Composite S&P 500 Composite FTSE 100 DAX 30 Performance France CAC 40 Nikkei 225 Stock Average Hang Seng Interest rates: US Interbank UK Interbank Germany Interbank France Interbank Japan Interbank Hong Kong Interbank Foreign exchange rates: US $ to UK £ (GTIS) Euro to US $ (ECU History) US $ to Japanese Yen (GTIS) US $ to Hong Kong $ (GTIS) From this a dataset of FTSE, DAX, CAC, NIKK, and HSENG in US Dollars was Pt derived and simple returns ( rt 1) calculated for both the original and the in US Pt1 Dollars indices. This leads to the results of any trading strategies being linear, since the scale of all trades is constant (to convert to ‘true’ results the y axis can be though of as being logarithmic). It should be noted that while all other exchange rates are the GTIS rates, the Euro rate is the ECU History rate, since it was the only rate that already had the values calculated for the time period prior to the launch of the Euro. This allowed a direct conversion of the DAX and CAC index prices from Euro to US Dollars. 3 1.1 Original versus in US Since the ultimate goal is to look at a portfolio of long-short strategies it is important to decide how the exchange rates will be handled. There are a number of possibilities; the two relevant here (since modeling exchange rates is beyond the scope of this [1] dissertation) are the use of original returns (assuming the use of quanto futures contracts, therefore eliminating all exchange rate uncertainty). The other is to instead make the foreign exchange forward an explicit part of the trading cost, this however would add additional complexity without bringing any clear benefits, and so the original returns along with the implicit quanto assumption will be used. To support this decision graphs of the results of a simple long (buying a single future every day) strategy are presented in Figure 1.1.1 (in original currency) and Figure 1.1.2 (in US Dollars). Both are calculated assuming zero costs. Appendix 1 also contains comparisons between the individual ARMA GARCH long-short trading strategies in original currencies as well as in US Dollars. 100 80 60 DJIA NASD 40 SP500 FTSE DAX 20 CAC NIKK HSENG 0 19910102 19910614 19911126 19920507 19921019 19930331 19930910 19940222 19940804 19950116 19950628 19951208 19960521 19961031 19970414 19970924 19980306 19980818 19990128 19990712 19991222 20000602 20001114 20010426 20011008 20020320 20020830 20030211 20030724 -20 -40 Figure 1.1.1 (long returns, in original currency) 4 100 80 60 DJIA NASD 40 SP500 FTSE_US DAX_US 20 CAC_US NIKK_US HSENG_US 0 19910102 19910621 19911210 19920528 19921116 19930505 19931022 19940412 19940929 19950320 19950906 19960223 19960813 19970130 19970721 19980107 19980626 19981215 19990603 19991122 20000510 20001027 20010417 20011004 20020325 20020911 20030228 20030819 -20 -40 Figure 1.1.2 (long returns, in US Dollars) 1.2 Trading costs Since a decision has been made to use the original currency returns, and implicitly assume the use of a quanto futures contract, the cost consists of the two futures (difference between the closing an the futures price) that make up the quanto, and is therefore influenced by both the foreign and the domestic interest rates. However approximating this cost for daily trades, and also considering that there will be short trades as well (which are affected in the opposite direction), this theoretical cost is overshadowed by the practical costs of trading. More relevant is an approximation of trading costs based on the absolute value of the trade size (which accounts for commission and potential market impact) and domestic interest rates (which account for the cost of capital which would have to be held, domestically, to cover potential margin calls). So only the US interest rate will be used in calculating the costs after all. [2] Margin requirements seem to vary widely between exchanges (20% in Chicago to 50% on some others), so the top limit of 50% seems reasonable if it is also considered to incorporate the potential market impact and other transaction costs. This leads to the cost equation being Ct abs(tradet ) 0.5 rf ,t . To illustrate the impact of trading costs the cumulative returns of a NASD long-short ARMA GARCH trading strategy 5 (to be discussed later in more detail) are plotted together with the results adjusted for trading costs in Figure 1.2.1. 140 120 100 80 NASD 60 NASD - cost 40 20 0 19910102 19910813 19920323 19921030 19930610 19940119 19940830 19950410 19951117 19960627 19970205 19970916 19980427 19981204 19990715 20000223 20001003 20010514 20011221 20020801 20030312 20031021 -20 Figure 1.2.1 (NASD long-short ARMA GARCH results with costs) 2 Long-Short Models The basis of the analysis is the setup of individual daily long-short trading strategies [3] for each market. For this the simplest possible category of models will be used so as not to overshadow the main goal of looking at reducing risk through correlation forecasts. Two models will be used for each security, an ARMA model to forecast the conditional mean, and a GARCH model to forecast the conditional variance. The models will only rely on past returns, and will be estimated yearly, on the previous year’s returns, i.e. a one year sliding window. No attempt will be made to optimize model settings beyond the ‘reasonable’ inputs so as to prevent data snooping. Such a [4] setup brings up the obvious question of market efficiency . It should be noted however that outperforming the market does not necessarily violate market efficiency since the trading cost assumptions made above are in no way exhaustive. And there is still a possibility of data snooping, even if care is taken to estimate the models out of sample, since the data and the models being evaluated are being looked at after the 6 fact rather than committing to a setup in 1990 and running it through to the end of 2003. 2.1 ARMA (lags) Auto Regressive Moving Average models (general form: rt 0 1rt1 2rt2 ... 1t1 2t2 ... t where t ~ WN(0) ) will be used to forecast the conditional mean of returns. At this point it should be noted that returns are not strongly autocorrelated (as can be seen from the correlogram of DJIA in Figure 2.1.1, correlograms for the remaining indices are presented in Appendix 2), and so the selection of models based on autocorrelation Q statistics is likely to fail. Considering this, and that any such selections based on in-sample autocorrelation Q statistics, or model evaluation criteria such as R2, AIC, and BIC are likely to significantly contribute to the possibility of data snooping, an intuitive selection verified by the consistency (rather than profitability or goodness of fit) of empirical results will be used. Figure 2.1.1 (correlogram of DJIA returns, produced by EViews) 7 Insignificant autocorrelations in returns also suggest that the MA (Moving Average) part of the model may not be particularly relevant as the error term will vary quite significantly. This is supported by empirical results where the ARMA predictions of any model with a non-zero number of MA terms tend to ‘explode’ following the model encountering a few unexpected returns (and so generating large error terms). This leaves only AR (Auto Regressive) models to consider, but still poses the problem that due to insignificant autocorrelations and the possibility of data snooping the number of lags can not be chosen using Q statistics. This leaves an intuitive choice of the number of lags to use, and so one, two, and three weeks (5, 10, and 15 trading days) are considered. All of which generate reasonable forecasts and so a final selection will be made once this is combined with the GARCH model, since it will also potentially (if returns can not be assumed to have a zero mean) rely on the ARMA models’ forecasts. 2.2 GARCH Generalized Autoregressive Conditional Heteroskedasticity models (general form: t2 1t1 2t2 ... 1 t1 2 t2 ...) will be used to model the conditional 2 2 2 2 volatility of returns, individually for each index. 2.2.1 Zero mean Since the GARCH class of models requires an input of zero mean residuals (otherwise we will get erroneous predictability), it is necessary to either verify that returns are in fact mean zero, or if they are not, to de-mean them. In order to test whether returns are in fact already mean zero a test is carried out on each series of returns with a null hypothesis that returns are mean zero, and an alternative that they are not. The results are presented in Figure 2.2.1.1. Looking at the low p-values it is easy to reject the null hypothesis for all three of the US indices and for HSENG. The evidence for other markets is not as straightforward, however it should be noted that the p-values are still reasonably low which suggests that this can not be taken as strong evidence in favor of zero mean returns. Considering this and the desire to keep the modeling procedure 8 consistent for all markets it is reasonable to say that returns can not be assumed to be mean zero, and so will have to be de-meaned using the ARMA models discussed above. Mean T-Stat P-Value DJIA 0.041766 2.469618 0.0136 NASD 0.053031 2.03162 0.0423 SP500 0.036753 2.144705 0.032 FTSE 0.022399 1.28082 0.2003 FTSE_US 0.025974 1.387994 0.1652 DAX 0.032717 1.337272 0.1812 DAX_US 0.034372 1.401565 0.1611 CAC 0.025178 1.108506 0.2677 CAC_US 0.02653 1.184123 0.2364 NIKK -0.024144 -0.970766 0.3317 NIKK_US -0.01293 -0.458652 0.6465 HSENG 0.054244 1.995999 0.046 HSENG_US 0.054436 1.999734 0.0456 Figure 2.2.1.1 (zero mean tests) 2.2.2 Lags What remains is to test that in fact volatility is significant and to determine the number of lags to use in the final model. As it has been noted above, since it is not reasonable to assume that we have zero mean returns, the choice of the ARMA model will impact on how returns are de-meaned, which will in turn impact on the choice of the GARCH model. The ‘ideal’ solution would be to iteratively run the models until the best combination of settings is found, however, since evaluating in-sample data, this will significantly increase the chance of data snooping. Instead the faulty assumption that returns are mean zero is made for the moment and the autocorrelations of squared returns are evaluated (due to returns not actually being mean zero it should be noted that this will lead to stronger autocorrelations than is in fact the case). It is well known that squared returns are strongly correlated, even when de-meaned, so this is mainly a side note to confirm this for the chosen dataset. And, as can be seen from Figure 2.2.2.1, the correlogram of squared DJIA returns (correlograms for the 9 remaining indices are presented in Appendix 3), this is definitely confirmed for the dataset being used. It is also safe to say, considering the significance of the observed Q statistics, that de-meaning the returns using any reasonable model will still lead to strong autocorrelation in squared de-meaned returns. Figure 2.2.2.1 (correlogram of squared DJIA returns, produced by EViews) Given these results it can be concluded that a GARCH model using pretty much any combination of lags will be useful in forecasting volatility. As with the choice of lags for the ARMA models, consistency rather than performance of models will be evaluated at this stage to prevent data snooping in the choice of settings. 2.3 Results From here on in the modeling is done in MatLab using the “Econometrics Toolbox” [5] by James LeSage and the “UCSD GARCH Toolbox” by Kevin Sheppard . While the code written for the ARMA GARCH models can be found in Appendix 4. Considering that the code for the multivariate GARCH models, used later on, uses normal errors the GARCH models were set to use normal errors as well (the 10 multivariate GARCH code could potentially be modified to use student’s t or GED errors in a ‘production environment’ however doing so here and comparing the results would add little while once again introducing the possibility of data snooping). With long-short strategies there is the obvious problem of how to compare the results, particularly how to make the y-axis scales compatible. The simplest solution is to scale the results by the sum of the absolute values of the trades, which will be done here. Since the alternative of scaling by average variance poses the problem that the trades themselves have already been scaled by the conditional variances, and scaling by any entirely ex-post statistic (such as VaR, which is in fact used later on to evaluate the results) would not be particularly valid. Scaling the results by the sum of the absolute values of the trades gives a consistent and easily comparable scale for results throughout the dissertation (the long ‘strategies’ presented earlier were also scaled in this way). 2.3.1 Trading theory Logic suggests that one would want to take a position proportional to the expected move (conditional mean prediction from the ARMA models) and inversely proportional to how volatile this prediction is (conditional variance prediction from the GRACH models). However this does not give us a definite equation to calculate the long-short positions, and so, given certain assumptions, a specific market model needs to be used. Considering that the ARMA and GARCH model predictions can be treated as price signals a version of the Grossman model of fully revealing prices (Appendix 5 contains the relevant derivation and references) seems like a reasonable way to determine the optimum position. From this, considering that the price (future price less the closing price) is close to zero for daily trading, and letting the risk aversion coefficient equal to one (since it just scales the trades anyway), we have that E(rt | It1) the optimum position to take is t i.e. the conditional mean prediction Var(rt | It1) over the conditional variance prediction. This is what one would expect based on the logical requirements outlined above, while the assumptions made, although not entirely correct, are not likely to be far from the truth, and so should not impact the accuracy of the suggested trading strategy. 11 2.3.2 Comparison The goal is to find settings, the number of lags, which produce consistent models and therefore consistent results. In order to do this the simplest possible volatility model, GARCH(1,1), was combined with the three earlier proposed ARMA models (ARMA(5,0), ARMA(10,0), and ARMA(15,0)). An ARMA(5,0) model can be seen in Figure 2.3.2.1, an ARMA(10,0) in Figure 2.3.2.2, and an ARMA(15,0) in Figure 2.3.2.3. From these results, and from looking at the predicted conditional means directly, the ARMA(10,0) produces the most consistent and least volatile results, with the ARMA(5,0) seeming to follow trends too easily and the ARMA(15,0) failing to adapt sufficiently quickly during drops in the market (most notably the NASD reaction to the 1998 crisis). An interesting feature is that the results for the NASD long-short trading strategy are by far the best of the lot, and although discussion of possible causes for this is beyond the scope of this dissertation, it could likely be attributed to the index consisting of stocks which seem to exhibit strong momentum effects which are picked up by the ARMA models. 200 150 100 DJIA NASD SP500 FTSE 50 DAX CAC NIKK 0 HSENG 19910102 19910726 19920218 19920910 19930405 19931027 19940520 19941213 19950706 19960129 19960821 19970314 19971007 19980430 19981123 19990616 20000107 20000801 20010222 20010917 20020410 20021101 20030527 20031218 -50 -100 Figure 2.3.2.1 (results of an ARMA(5,0) with a GARCH(1,1)) 12 150 100 DJIA NASD 50 SP500 FTSE DAX CAC 0 NIKK 19910102 19910726 19920218 19920910 19930405 19931027 19940520 19941213 19950706 19960129 19960821 19970314 19971007 19980430 19981123 19990616 20000107 20000801 20010222 20010917 20020410 20021101 20030527 20031218 HSENG -50 -100 Figure 2.3.2.2 (results of an ARMA(10,0) with a GARCH(1,1)) 150 100 DJIA NASD 50 SP500 FTSE DAX CAC 0 NIKK 19910102 19910726 19920218 19920910 19930405 19931027 19940520 19941213 19950706 19960129 19960821 19970314 19971007 19980430 19981123 19990616 20000107 20000801 20010222 20010917 20020410 20021101 20030527 20031218 HSENG -50 -100 Figure 2.3.2.3 (results of an ARMA(15,0) with a GARCH(1,1)) After determining that using an ARMA(10,0) gives the most consistent results an attempt to vary the lags in the GARCH model was made to see if the GARCH(1,1) could be improved on. At this point it should be noted that using a high (anything 13 where p q 4) number of lags in the GARCH model resulted in errors (singular matrices during estimation) while running the GARCH model. Which seems to happen due to the fact the additional lags, while significant, do not carry any new information that is not already contained in the earlier lags. A GARCH(1,3) and a GARCH(2,2) models are ultimately compared (GARCH(3,1) encountered the singular matrix problem, and in-between models did not show any interesting results). A GARCH(1,1) model can be seen in Figure 2.3.2.2, a GARCH(1,3) in Figure 2.3.2.4, and a GARCH(2,2) in Figure 2.3.2.5. The GARCH(1,3) gives quite similar results to GARCH(1,1), as would be expected since it is reasonable to assume that a lot of information is already carried by the first lag, and so the additional lags using error data, are unlikely to carry significant additional information. Compared to these the GARCH(2,2) clearly gives significantly more volatile results, and also seems to perform poorly past the market peak, likely failing to adapt quickly enough in a volatile market due to its higher persistence. 150 100 DJIA NASD 50 SP500 FTSE DAX CAC 0 NIKK 19910102 19910726 19920218 19920910 19930405 19931027 19940520 19941213 19950706 19960129 19960821 19970314 19971007 19980430 19981123 19990616 20000107 20000801 20010222 20010917 20020410 20021101 20030527 20031218 HSENG -50 -100 Figure 2.3.2.4 (results of an ARMA(10,0) with a GARCH(1,3)) 14 140 120 100 80 DJIA 60 NASD SP500 40 FTSE DAX 20 CAC 0 NIKK HSENG 19910102 19910724 19920212 19920902 19930324 19931013 19940504 19941123 19950614 19960103 19960724 19970212 19970903 19980325 19981014 19990505 19991124 20000614 20010103 20010725 20020213 20020904 20030326 20031015 -20 -40 -60 -80 Figure 2.3.2.5 (results of an ARMA(10,0) with a GARCH(2,2)) Based on this, the combination of an ARMA(10,0) and a GARCH(1,1) is chosen, the results produced by which can be seen in Figure 3.2.2.2. These settings will also be carried over to, and used for consistency, in the correlation models. 3 Correlation First of all, since any correlation (multivariate GARCH) model will have more parameters to be estimated than the univariate version, one would expect that a longer window for the estimation of models would be required. This is in fact confirmed empirically, with a one-year estimation window leading to inconsistent results and estimation problems. In light of this the estimation window is expanded to two years, but the model is still re-estimated every year (on the previous two years’ data, except for 1991, since only one year is available then). The expanded estimation window changes the setup somewhat from the ARMA GARCH models described previously, however the fact that models are estimated out of sample and yearly re-estimation remains, making comparisons between results just as valid. And any direct comparisons in this section are made against models with the expanded two-year estimation window. 15 3.1 Theoretical models There are two main desirable properties, in addition to fitting the data well, of correlation models: positive definiteness and parsimony. Positive definiteness basically means that the generated conditional covariance matrix is valid, and does not imply an inconsistency in the relationships between the variances and covariances. Parsimony is the growth in the number of parameters being estimated as the number of assets increases, it is important for a number of reasons, mainly that estimation times increase significantly as the number of parameters to be estimated grows. The other reason being that as the number of parameters is increased, while keeping the sample size constant, this generally leads to worse estimates of the parameters, and so the fixed sample size performance of the model will deteriorate (since the number of parameters grows faster than linearly in the number of assets in most models). [6] The first multivariate volatility model to be proposed was the vech model, and so potentially should be used as the benchmark. However the vech model has significant drawbacks in that it does not guarantee positive definiteness and the number of parameters quickly becomes unmanageable as the number of assets increases. Due to this, and the fact that an economic benchmark is a portfolio where covariance is not managed (an equally weighted portfolio), the vech model will not be considered empirically. In addition to the models that will be considered here, due to their benefits that are discussed below, there are a number of other multivariate volatility models [7] that could potentially be useful in more specific cases. A model that satisfies the desired requirements most closely is the DCC (Dynamic Conditional Correlation multivariate GARCH) [8]. This model is formally represented by Ht Dt Rt Dt where H t is the conditional covariance matrix. The advantage of this over the CCC model is that the correlation is allowed to vary through time, and is represented by Rt Qt*1Qt Qt*1 where Qt* is the square root of the diagonal of Qt , which follows a form of a GARCH process ( Qt W Qt1 t1't1 ). In this setup the model can be estimated in stages, first the individual GARCH models and then the 16 correlation matrix, as well as having a very reasonable number of parameters k 2 5k 4 (P where k is the number of securities), making it very desirable in 2 terms of computational complexity, while also ensuring positive definiteness. Another model that also comes close to satisfying the desired requirements is the BEKK [9]. However the number of parameters grows faster than for the DCC, making it less suited to a scenario with more than a few securities being considered. On the other hand the extra parameters enable the model to be more flexible than the DCC. The model is formally represented by Ht C'C B' Ht1B A'et1e't1A , where C is restricted to being lower triangular while A and B are unrestricted. The BEKK also guarantees positive definiteness, so the only remaining issue is the number of 5k 2 k parameters ( P ), which grows significantly faster in the number of 2 securities, than with the DCC. 3.2 Refinements Considering that the BEKK model is the most flexible multivariate GARCH model that can be practically applied while the DCC makes some flexibility tradeoffs in order to reduce the number of parameters and therefore computational time, it is interesting to consider whether the added flexibility is a benefit when the models are applied practically. Noting that the added flexibility, due to a larger number of parameters, inevitably leads to more noisy correlation forecasts, as can be seen from Section 3.3. Two ways of looking at this would be to either consider a third model, with fewer parameters than the DCC, or to smooth the predictions already available. Considering a third model seem problematic since it would be the CCC, which does not allow varying correlations and so it is of little use, while other models are not similar enough for this to be a relevant comparison. This leaves the option of smoothing the predictions of the two models being considered. Smoothing predictions of the BEKK poses the problem that it is not possible to rank the flexibility of the smoothed BEKK above or below that of the DCC, which leaves only the smoothed DCC to be considered. There are many various running average formulae and settings that can be used to smooth the predictions, and once again choosing the one that leads 17 to the best results is likely to lead to data snooping. So it is proposed to use a five-day (including the actual prediction) window and smooth the covariance matrix elements individually according to an exponential formula (using weights of 1 1 exp( ) i.e. exp(1) for today, exp( ) for yesterday, etc., which are days_ ago 1 2 subsequently normalized for the five day window). Another issue that needs to be addressed is the non-synchronous nature of the markets, which causes a number of problems, the main one being that when forecasting correlation between securities traded on exchanges around the world all of ‘yesterdays’ returns will not be available before the start of the day, due to time differences. And so the model becomes unimplementable unless this is addressed. A potentially interesting approach is to borrow an idea applied to volatility forecasts where intraday data is used to calculate the true daily sample volatility, and use the intraday data during the hours when the opening of the exchanges overlaps to calculate actual daily sample correlations and base the correlation model off that. An easier way to handle this, and the one that will be used here, is to offset the covariance predictions by a day when dealing with non-synchronous markets by using the ˆ forecast for yesterday instead of the forecast for today (essentially setting H t H t1 , which, it should be noted, leads to the first day of results being a day later than initially). 3.3 Evaluating predictions The predictions are ultimately evaluated by assessing the results of the trading strategies based on them, which is similar to using an economic loss function. To evaluate the predictions directly, numerically, a proxy of ri,t rj,t could be used for Cov(ri,t ,rj,t ) (where ri,t and r j,t are de-meaned returns), however since the goal is not to chose the best combination of a model and it’s settings, but to evaluate their usefulness when applied to trading strategies, these tests will not be conducted here. Instead a graphical representation of predicted correlation versus actual sample correlations (quarterly samples, since anything shorter gives results which are too noisy and half yearly does not pick up on the changes enough) is presented. 18 Due to the excessive estimation time of the BEKK with five securities, the evaluations were done with the subset of the three US indices, to preserve the comparability of the results. Out of these, the combination of the DJIA and the NASD provided the best visible pattern, and so will be used here. Figure 3.3.1 shows the results for the BEKK model, with the sample correlations represented by the dashed line, Figure 3.3.2 shows the DCC, and Figure 3.3.3 the smoothed DCC, as discussed above. By visually evaluating these figures it is clear that predictions from both base models are far too noisy to represent true correlations, with oscillations that often exceed, especially for the BEKK, long run changes in sample correlations. The smoothed DCC seems to remove some of the daily volatility, however spikes can still be observed. Figure 3.3.1 19 Figure 3.3.2 Figure 3.3.3 20 3.4 Results For the reasons mentioned previously (namely data snooping), and following the logic used in the selection of the ARMA and GARCH model settings, the same settings will be used for the correlation models as have been used in the individual volatility models. This leads to a DCC(1,1,1,1) and a BEKK(1,1) being considered. The only difference being that, due to excessive estimation time, the BEKK model will only have a one-year estimation window (except for forecasts for 1999 through to the end of 2002, where the two year window is used, due to excess volatility causing estimation to fail otherwise). The BEKK will also only be estimated for the group of the three US indices, hence part of the comparisons being done with this subgroup. And, as noted previously, a smoothed DCC and an equally weighted benchmark are also evaluated. 3.4.1 Trading theory Given a variance forecast and a goal of reducing risk, the trading strategy is to [10] construct a minimum variance portfolio . Derivation of this is covered in the Bt referenced sources, so only the result is presented here, which is that E t1(rt* ) At 1 and E t1 ( t2 ) (where At 1' E t1 (V t)11 and Bt 1' E t1 (Vt )1 E t1(rt ) ). This allows At us to use the same trading strategy as with the individual ARMA and GARCH models (Section 2.3.1) to determine the size trade to make. In order to calculate the of outcome of the trade and obtain the results of the trading strategy, the weighting of the global minimum variance portfolio is required, derivation of which is also covered in the referenced sources. The resulting expression for the weights of the global minimum variance portfolio is w* t E t1 (Vt )11 t E t1(Vt )1 E t1 (rt ) t (where Ct Bt E t1 (rt* ) At E t1 (rt* ) Bt t , t , t At Ct Bt2 , t t Ct E t1(rt )' E t1(Vt )1 E t1(rt ) , and At , Bt , and E t1(rt* ) are as defined above). 21 3.4.2 Evaluation The MatLab code for the three different setups (DCC, smoothed DCC, and BEKK) is quite similar, and so only the DCC code is included, and can be found in Appendix 6, while the code for the remaining models and for the correlation comparison graphs can be found attached along with the datasets. The models are evaluated by looking the at VaR (Value at Risk) values, and [11] subsequently at the full distribution of returns . The VaR evaluation, although not as general, allows us to look at only the far out negative tail of the returns, and therefore get more of a handle on the extreme risk properties of the models’ returns. Various VaR values are presented in Figure 3.4.2.1, from where it can be seen that diversifying by investing in all five indices consistently reduces the risk of the different models. Interestingly enough the BEKK performs worse than the DCC, while the smoothed DCC performs marginally worse than the DCC, suggesting that the optimum amount of generality in a model is around what the DCC provides (in this case). Lagged models, which are the ones to look at, obviously give slightly worse results since the non-lagged models are not replicable in real life due to asynchronous trading. Observations 3391 VaR % 99.9 99.5 99 97.5 95 Observation 3 16 33 84 169 DCC 5 -0.479 -0.373 -0.319 -0.243 -0.194 DCC 5 lagged -0.623 -0.407 -0.317 -0.244 -0.192 smoothed DCC 5 -0.514 -0.393 -0.312 -0.242 -0.192 smoothed DCC 5 lagged -0.658 -0.396 -0.321 -0.240 -0.194 Equally weighted 5 -1.750 -1.123 -0.940 -0.663 -0.470 BEKK 3 -1.175 -0.699 -0.571 -0.427 -0.309 DCC 3 -0.737 -0.540 -0.452 -0.361 -0.288 smoothed DCC 3 -0.780 -0.549 -0.446 -0.350 -0.287 Equally weighted 3 -1.893 -1.153 -0.927 -0.679 -0.468 Figure 3.4.2.1 (VaR values for the various strategies) 22 The next step is to look at the full distribution of returns, in order to gain a more general idea of the relative behavior of the models. In this case it is no longer particularly valid to compare the distributions of returns in the five index case and those of only the US subset, since return properties are clearly different due to the US technology boom. So first a comparison of the models trading the three US indices is presented in Figure 3.4.2.2, where it can be clearly seen that there is not much difference between the DCC and the smoothed DCC. While the BEKK exhibits a taller peak which supports the fatter tails that were observed in the VaR figures above, with the equally weighted portfolio doing so to an even greater extent. 500 400 BEKK 3 300 DCC 3 smoothed DCC 3 Equally weighted 200 100 0 -1 -0.5 0 0.5 1 Figure 3.4.2.2 (distribution of returns for models trading US indices) A more distinctive comparison can be observed in the case where all five indices are traded, which can be seen in Figure 3.4.3.3, between the DCC and the equally weighted benchmark. Which clearly shows the thinner tail properties of the returns from the risk managed DCC strategy versus the equally weighted benchmark. 23 450 400 350 300 250 DCC 5 lagged Equally weighted 200 150 100 50 0 -1 -0.5 0 0.5 1 Figure 3.4.2.3 (distribution of returns for models trading all five indices) 4 Conclusion While the return distribution properties relating to risk, outlined above, show that correlation models can in fact be used to reduce the risk of trading strategies it is also of interest to look at the actual results of the optimized trading strategies, since profitability is a large deciding factor at the end of the day. A comparison of the results of all the models trading only the US indices can be seen in Figure 4.1, where it can clearly be observed that as well as being less risky the optimized trading strategies also outperform the equally weighted one. Even more significantly, they outperform the best of the simple long strategies (Figure 1.1.1) as well as the best individual ARMA GARCH strategy (Figure 2.3.2.2) (NASD for both), it should be noted though that at this point the comparison is restricted to the US indices. Another feature is that the BEKK, as well as being more risky than the DCC as discussed above, also underperforms both the DCC and the smoothed DCC (which are very similar, as could reasonably be expected based on their nearly identical return distributions observed above). The BEKK based strategy also performs significantly worse around the 1994 to 1996 period, while the DCC breaks even at the same time, 24 suggesting that the DCC, although potentially poorly estimated on 1992 to 1994 data does not suffer from this as much as the BEKK. 250 200 150 BEKK 3 DCC 3 100 smoothed DCC 3 Equally weighted 50 0 19910102 19910820 19920406 19921120 19930708 19940223 19941011 19950529 19960112 19960829 19970416 19971202 19980720 19990305 19991021 20000607 20010123 20010910 20020426 20021212 20030730 -50 Figure 4.1 (returns of the models trading US indices) The real test is to evaluate the performance, of the DCC, with all five indices being traded, so avoiding the potential selection bias in only looking at US indices (since it would not have been possible to say in 1990 with certainty that the US markets would be the ones to experience the most significant boom). This is presented in Figure 4.2, from which we can see that it is still the case, although to a lesser extent, that the optimized strategy outperforms the equally weighted one, the best of the simple long ones, and is at least as good as the best of the individual ARMA GARCH strategies. All without having a country or an index selection bias, beyond potentially a heavier weighting on the US indices. Looking at the results of the optimized strategy on their own, there are two points to note: the poor performance at the start and at the end. Potential reasons for the poor performance in the first year, although it is outside the scope of this dissertation to fully evaluate this, are either the fact that the DCC model is estimated on only one year of data, but also that the market, following a late 1980’s crash is not well suited to being accurately modeled. As for the losses in the final year the post crash explanation could also apply, in that the volatility of the crash affects 25 the estimation of the model while the post crash behavior of the market is ill suited to modeling due to it’s often “directionless” behavior. Although here the market efficiency definition that considers the availability of forecasting models may also be applicable. 160 140 120 100 80 DCC 5 lagged Equally weighted 60 40 20 0 19910102 19910822 19920410 19921130 19930720 19940309 19941027 19950616 19960205 19960924 19970514 19980101 19980821 19990412 19991130 20000719 20010308 20011026 20020617 20030204 20030924 -20 Figure 4.2 (returns of the models trading all five indices) 4.1 Potential problems Even considering the encouraging results of using correlation forecasts to reduce the risk of a portfolio of index trading strategies there are potential problems with this approach. While using conditional correlation forecasts does reduce risk, it does not, even with a strategy that is allowed to go long as well as short, produce results that are entirely independent from the underlying markets. Using more robust models may allow us to approach this goal, but it will never be possible to reach it by relying on correlation forecasts alone, since dependence goes beyond what can be evaluated with just an analysis of correlation. This is an important matter to consider since achieving [12] market neutrality is important for investment purposes . Considering that correlation does not fully measure dependence, for example returns tend to exhibit 26 stronger correlation when the markets are falling (i.e. specifically when managing risk is of utmost importance), other ways of looking at the dependence of returns are required. There is also the issue of costs that go beyond those of holding cash to meet margin calls and commissions (considered in Section 1.2). First of all there are the setup and operational costs that would be significant for trading internationally, and then there are the potential operational risks, which are also not quantified here. 4.1 Beyond correlation While looking at operational costs and risks is beyond the area of quantitative analysis discussed here, there are ways to address the fact that correlation is not the same as dependence. Correlation forecasts imply linear dependence, however there are ways of accounting for the non-linear dependence structures that are observed in returns. The simplest of these is to look at correlations based on the magnitude and the sign of returns, and try to account for higher correlations associated with negative returns in this way. This approach is well suited to analysis of deviation from linear dependence but is not of much use at forecasting it. The next step is looking at modeling this non- [13] linear dependence; this is approached with the use of copulas where an attempt is made to describe the distribution of returns of one asset with respect to the returns of another. 27 References [1] quanto A cross-currency derivative, which is denominated in a foreign currency, on a foreign asset, but settles in domestic currency using a fixed exchange rate. (http://www.riskglossary.com/articles/quanto.htm) [2] futures margin requirements http://www.onechicago.com/010000_learningctr/oc_010500.html [3] time series models Basics of ARMA models covered in 2.6 of “Analysis of Financial Time Series” by Ruey Tsay (2002, John Wiley & Sons). GARCH model covered in “Generalized autoregressive conditional heteroskedasticity” by Tim Bollerslev (1986, Journal of Econometrics). More advanced ARMAX (incorporating other explanatory variables) and various refinements of the GARCH model could potentially be used to improve the forecasts. [4] market efficiency “A market is efficient with respect to information set t if it is impossible to make economic profits by trading on the basis of information set t ” “Weak-form efficiency: the information set contains only historical returns” from “Statistical versus Clinical Prediction of the Stock Market” by Harry Roberts (1967, Unpublished). “A market is efficient with respect to the information set t and forecast models Mt if it is impossible to make economic profits by trading on the basis of forecasts from a model in Mt using predictor variables in t ” from “Efficient Market Hypothesis and Forecasting” by Clive Granger and Allan Timmermann (2002, Working paper), which is more relevant to the use of the DCC model later on, since it was only published in 2002, with earliest mentions in 2001. [5] MatLab toolboxes “Econometrics Toolbox” by James LeSage 28 http://www.spatial-econometrics.com/ “UCSD GARCH Toolbox” by Kevin Sheppard http://www.kevinsheppard.com/research/ucsd_garch/ucsd_garch.htm Although Kevin Sheppard wrote all of the functions used directly, some of them do seem to rely on functions in the “Econometrics Toolbox” which were written by others. [6] vech model “A Capital Asset Pricing Model with time-varying covariances” by Tim Bollerslev, Robert Engle, and Jeffrey Wooldridge (1988, Journal of Political Economy) [7] survey of multivariate volatility models “Multivariate GARCH models: a survey” by Luc Bowens, Sebastien Laurent, and Jeroen Rombouts (2003, Discussion paper) A theoretic survey of multivariate volatility models, primarily focusing on multivariate GARCH models, with a mention of some alternative models. [8] DCC model “Theoretical and empirical properties of Dynamic Conditional Correlation multivariate GARCH” by Robert Engle and Kevin Sheppard (2002, Working paper) and “Dynamic Conditional Correlation – a simple class of multivariate GARCH models” by Robert Engle (2002, Journal of Business and Economic Statistics) Which is a dynamic extension of the CCC (Constant Conditional Correlation) model by Tim Bollerslev (1990, no exact reference beyond being mentioned in textbooks). [9] BEKK model “Multivariate simultaneous generalized ARCH” by Robert Engle and Kenneth Kroner (1995, Econometric Theory) [10] (global) minimum variance portfolio General minimum variance portfolio case covered in 3.8 of “Foundations for Financial Economics” by Chi-fu Huang and Robert Litzenberger (1988, Prentice Hall), the particular global minimum variance case, and notation, taken from “AC436 29 Financial Economics Michaelmas Term” by Rohit Rahi (2003, LSE AC436 lecture notes). [11] risk as the distribution of returns Some ideas taken from 4.3 of “Value at Risk” by Philippe Jorion (2001, McGraw- Hill) [12] market neutrality “Are ‘Market Neutral’ hedge funds really market neutral?” by Andrew Patton (2004, Working paper) [13] copulas “Correlation and dependence in risk management: properties and pitfalls” by Paul Embrechts, Alexander McNeil, and Daniel Straumann (2002, in “Risk Management: Value at Risk and Beyond” Cambridge University Press) [other] sources consulted “Mastering MatLab 6 – A Comprehensive Tutorial and Reference” by Duane Hanselman and Bruce Littlefield (2001, Prentice Hall) was used as a reference while writing the MatLab code. “Trade Like a Hedge Fund” by James Altucher (2004, John Wiley & Sons) was initially consulted for potential ideas on how to fine tune the trading strategy, but proved to be far too specific to be of any real use. “The dangers of using correlation to measure dependence” by Harry Kat (2002, Working paper) was referred to for support of the ideas presented in the conclusion regarding the importance of looking at ways of handling risk beyond correlation forecasts. 30 Appendices 1 Original versus in US This is something of an after the fact comparison, since it relies on the chosen setting for the ARMA and GARCH models, however, since this is the ultimate goal it can be argued that these results are in fact the most relevant. An ARMA(10,0) and a GARCH(1,1) models are used on both datasets (the three US indices appear in both, but are if fact the same). An interesting side note is the significant crash in HSENG’s strategy during the 1997 crisis, which is to a large extent a one day hit, which suggests that if applied in reality care should be taken on looking at whether exchanges have maximum allowed one day drops, and if not, at how such extreme results can be controlled in other ways (value cutoffs in the trading strategy may be of some use in preventing ‘next day’ over-betting). Whether or not DAX’s performance seems to potentially forecast this is beyond the scope of this dissertation. 150 100 DJIA NASD 50 SP500 FTSE DAX CAC 0 NIKK 19910102 19910617 19911128 19920512 19921023 19930407 19930920 19940303 19940816 19950127 19950712 19951225 19960606 19961119 19970502 19971015 19980330 19980910 19990223 19990806 20000119 20000703 20001214 20010529 20011109 20020424 20021007 20030320 20030902 HSENG -50 -100 Figure A1.1 (long-short results from the dataset in the original currencies) 31 150 100 DJIA NASD 50 SP500 FTSE_US DAX_US CAC_US 0 NIKK_US 19910102 19910624 19911212 19920602 19921120 19930512 19931101 19940421 19941011 19950331 19950920 19960311 19960829 19970218 19970808 19980128 19980720 19990107 19990629 19991217 20000607 20001127 20010517 20011106 20020426 20021016 20030407 20030925 HSENG_US -50 -100 Figure A1.2 (long-short results from the datasets in US Dollars) 2 Return correlograms (from EViews) Presented here are the remaining four (out of the five ultimately used in correlation forecasts) correlograms for returns in original currency. The entire thirteen correlograms can be found along with the attached datasets. 32 3 Squared return correlograms (from EViews) Presented here are the remaining four (out of the five ultimately used in correlation forecasts) correlograms for squared returns in original currency. The entire thirteen correlograms can be found along with the attached datasets. 33 4 MatLab code for individual ARMA GARCH models It should be noted that rFarch_garch.m, presented here, makes use of mod_armaxfilter_likelihood.m (not presented here, but can be found along with the attached datasets), which is a modification of armaxfilter_likelihood.m, which inputs data (handling lags internally) and parameters ultimately returning the ARMA model’s predictions. --- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ARCH GARCG predictions, out of sample, sliding (jumping) window (F.L.) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use: run /Applications/MatLabR13/toolbox/ac402/rFarch_dcc.m % LOADING DATA SET clear; % all load '/Applications/MatLabR13/toolbox/ac402/orig_ret.txt' -ascii date = orig_ret(:,1); data = orig_ret(:,2:9); clear orig_ret; [T,k] = size(data); % RESTRICTIONS ar = 10; % 5 10* 15 ma = 0; % 0* p = 1; % 1* 1 2 3x 5x q = 1; % 1* 3 2 3x 5x offset = 50; days = 261; F_pred_ARMA = ones(T,k) * 0; F_pred_GARCH = ones(T,k) * 0; year = 0; while ((year + 1)*days < T) col = 1; while (col <= k) % TRAIN Tstart = year * days + 1; Tend = (year + 1) * days; % ARMA [ARMA_parameters, ARMA_errors, ARMA_LLF , ARMA_SEregression, ARMA_stderrors, ARMA_robustSE, ARMA_scores, ARMA_likelihoods]=armaxfilter(data(Tstart:Tend,col:col),1,ar,ma); clear ARMA_errors; clear ARMA_LLF; clear ARMA_SEregression; 34 clear ARMA_stderrors; clear ARMA_robustSE; clear ARMA_scores; clear ARMA_likelihoods; [pred_ARMA_LLF, pred_ARMA, pred_ARMA_likelihoods] = mod_armaxfilter_likelihood(ARMA_parameters , data(Tstart:Tend,col:col) , ar , ma); clear pred_ARMA_LLF; clear pred_ARMA_likelihoods; % not really the most efficient way, should only use a subset data2 = data; data2(Tstart:Tend,col:col) = data(Tstart:Tend,col:col) - pred_ARMA; clear pred_ARMA; % GARCH [GARCH_parameters, GARCH_likelihood, GARCH_stderrors, GARCH_robustSE, GARCH_ht, GARCH_scores] = fattailed_garch(data2(Tstart:Tend,col:col) , p , q , 'NORMAL'); clear GARCH_likelihood; clear GARCH_stderrors; clear GARCH_robustSE; clear GARCH_ht; clear GARCH_scores; clear data2; clear Tstart; clear Tend; % PREDICT year = year + 1; Tstart = year * days + 1 - offset; Tend = min(T, (year + 1) * days); [pred_ARMA_LLF, pred_ARMA, pred_ARMA_likelihoods] = mod_armaxfilter_likelihood(ARMA_parameters , data(Tstart:Tend,col:col) , ar , ma); clear pred_ARMA_LLF; clear pred_ARMA_likelihoods; % not really the most efficient way, should only use a subset data2 = data; data2(Tstart:Tend,col:col) = data(Tstart:Tend,col:col) - pred_ARMA; [pred_GARCH_LLF, pred_GARCH, pred_GARCH_likelihoods] = fattailed_garchlikelihood(GARCH_parameters , data2(Tstart:Tend,col:col) , p , q, 1); % 1 = 'NORMAL' clear pred_GARCH_LLF; clear pred_GARCH_likelihoods; clear data2; clear ARMA_parameters; clear GARCH_parameters; % STORE F_pred_ARMA(Tstart + offset:Tend,col:col) = pred_ARMA(offset + 1:Tend - Tstart + 1,:); F_pred_GARCH(Tstart + offset:Tend,col:col) = pred_GARCH(offset + 1:Tend - Tstart + 1,:); clear pred_ARMA; clear pred_GARCH; clear Tstart; clear Tend; col = col + 1 year = year - 1; end 35 year = year + 1 end %save mF_arma_predicted.txt F_pred_ARMA -ascii -tabs; %save mF_garch_predicted.txt F_pred_GARCH -ascii -tabs; bF_pred_GARCH = F_pred_ARMA ./ F_pred_GARCH; %save mF_bF_pred_GARCH.txt bF_pred_GARCH -ascii -tabs; rARMA = data .* F_pred_ARMA; rGARCH = data .* bF_pred_GARCH; %save mF_rARMA.txt rARMA -ascii -tabs; %save mF_rGARCH.txt rGARCH -ascii -tabs; % Scale by abs(bet size) absBET = ones(1,k) * 0; for i=(days+1):T absBET(:,:) = absBET(:,:) + abs(bF_pred_GARCH(i,:)); end scaleRUN = ones(T,k) * 0; for i=(days+1):T scaleRUN(i,:) = scaleRUN(i-1,:) + ((rGARCH(i,:) ./ absBET) * 1000); end save scaleRUN.txt scaleRUN -ascii -tabs; --- 5 Grossman model of fully revealing prices “On the efficiency of competitive stock markets where traders have diverse information” by Sanford Grossman (1976, Journal of Finance) Assuming CARA (Constant Absolute Risk Aversion, valid since modeling as though always trading from the same base) the utility function is U(Wt ) erWt , making the assumptions of normally distributed returns it can be shown that maximizing utility is 1 given that Wt pt xt t (rt pt ) the equivalent to maximizing E(W t ) rVar(W t ) , 2 E(rt ) pt first order conditions give t . rVar(rt ) 6 MatLab code for the DCC model 36 As mentioned, mainly due to similarity and the length of the code, the code for the smoothed DCC, the BEKK, and the variations for the correlation comparison graphs, is not included here, but is instead attached along with the datasets. The modified function mod_armaxfilter_likelihood.m is once again used as mentioned in Appendix 4. --- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ARCH DCC predictions, out of sample, sliding (jumping) window (F.L.) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use: run /Applications/MatLabR13/toolbox/ac402/rFarch_dcc.m % LOADING DATA SET clear; % all load '/Applications/MatLabR13/toolbox/ac402/orig_ret.txt' -ascii date = orig_ret(:,1); data = orig_ret(:,[2 3 4 5 8]); %[2:djia 3:nasd 4:sp500 5:ftse 8:nikk]); clear orig_ret; [T,k] = size(data); %lag = 0; % TRUE/FALE setting for whether to lag the covariance matrix by a day lag = 1; % RESTRICTIONS ar = 10; % 5 10* 15 ma = 0; % 0* p = 1; % 1* 1 2 3x 5x q = 1; % 1* 3 2 3x 5x dccP = 1; dccQ = 1; archP = 1; garchQ = 1; % settings carried over from ARMA GARCH DCC_garchQ=ones(1,k)*garchQ; % k = data series DCC_archP=ones(1,k)*archP; % k = data series offset = 50; days = 261; grow = 1; % to how many extra years back the training window grows F_pred_ARMA = ones(T,k) * 0; F_pred_GARCH = ones(T,k) * 0; F_pred_CORR = ones(k,k,T) * 0; year = 0; while ((year + 1)*days < T) col = 1; data2 = data; data3 = data; while (col <= k) % TRAIN 37 Tstart = max(1, (year - grow) * days + 1); Tend = (year + 1) * days; % ARMA [ARMA_parameters, ARMA_errors, ARMA_LLF , ARMA_SEregression, ARMA_stderrors, ARMA_robustSE, ARMA_scores, ARMA_likelihoods]=armaxfilter(data(Tstart:Tend,col:col),1,ar,ma); clear ARMA_errors; clear ARMA_LLF; clear ARMA_SEregression; clear ARMA_stderrors; clear ARMA_robustSE; clear ARMA_scores; clear ARMA_likelihoods; [pred_ARMA_LLF, pred_ARMA, pred_ARMA_likelihoods] = mod_armaxfilter_likelihood(ARMA_parameters , data(Tstart:Tend,col:col) , ar , ma); clear pred_ARMA_LLF; clear pred_ARMA_likelihoods; % not really the most efficient way, should only use a subset data2(Tstart:Tend,col:col) = data(Tstart:Tend,col:col) - pred_ARMA; clear pred_ARMA; % GARCH [GARCH_parameters, GARCH_likelihood, GARCH_stderrors, GARCH_robustSE, GARCH_ht, GARCH_scores] = fattailed_garch(data2(Tstart:Tend,col:col) , p , q , 'NORMAL'); clear GARCH_likelihood; clear GARCH_stderrors; clear GARCH_robustSE; clear GARCH_ht; clear GARCH_scores; clear Tstart; clear Tend; % PREDICT year = year + 1; Tstart = year * days + 1 - offset; Tend = min(T, (year + 1) * days); [pred_ARMA_LLF, pred_ARMA, pred_ARMA_likelihoods] = mod_armaxfilter_likelihood(ARMA_parameters , data(Tstart:Tend,col:col) , ar , ma); clear pred_ARMA_LLF; clear pred_ARMA_likelihoods; % not really the most efficient way, should only use a subset data3(Tstart:Tend,col:col) = data(Tstart:Tend,col:col) - pred_ARMA; [pred_GARCH_LLF, pred_GARCH, pred_GARCH_likelihoods] = fattailed_garchlikelihood(GARCH_parameters , data2(Tstart:Tend,col:col) , p , q, 1); % 1 = 'NORMAL' clear pred_GARCH_LLF; clear pred_GARCH_likelihoods; clear ARMA_parameters; clear GARCH_parameters; % STORE F_pred_ARMA(Tstart + offset:Tend,col:col) = pred_ARMA(offset + 1:Tend - Tstart + 1,:); F_pred_GARCH(Tstart + offset:Tend,col:col) = pred_GARCH(offset + 1:Tend - Tstart + 1,:); clear pred_ARMA; clear pred_GARCH; clear Tstart; clear Tend; 38 col = col + 1 year = year - 1; end % DCC TRAIN (using overfit data2) Tstart = max(1, (year - grow) * days + 1); Tend = (year + 1) * days; [DCC_parameters, DCC_loglikelihood, DCC_Ht]=dcc_mvgarch(data2(Tstart:Tend,:),dccP,dccQ,archP,garchQ); clear DCC_loglikelihood; clear DCC_Ht; clear data2; clear Tstart; clear Tend; % DCC PREDICT (using true data3 - remember to trim) year = year + 1 Tstart = year * days + 1 - offset; Tend = min(T, (year + 1) * days); [pred_DCC_logL, pred_DCC_Rt, pred_DCC_likelihoods]=dcc_mvgarch_full_likelihood(DCC_parameters, data3(Tstart:Tend,:), DCC_archP,DCC_garchQ,dccP,dccQ); clear pred_DCC_logL; clear pred_DCC_likelihoods; F_pred_CORR(:,:,Tstart + offset:Tend) = pred_DCC_Rt(:,:,offset + 1:Tend - Tstart + 1); clear pred_DCC_Rt; clear data3; clear Tstart; clear Tend; end % DCC Returned a CORRELATION matrix, now to mix with the GARCH and get a COVARIANCE matrix F_pred_COV = ones(k,k,T) * 0; F_pred_GARCH_STDEV=F_pred_GARCH.^(0.5); for i=1:T F_pred_COV(:,:,i)=diag(F_pred_GARCH_STDEV(i,:))*F_pred_CORR(:,:,i)*diag(F_pred_GARCH_S TDEV(i,:)); end % The non synchronous shift if (lag == 1) F_pred_COV(:,:,2:T) = F_pred_COV(:,:,1:T-1); days = days + 1; end % OPTIMUM PORTFOLIO/BETS AND RESULTS F_pred_A = ones(T,1) * 0; F_pred_B = ones(T,1) * 0; F_pred_C = ones(T,1) * 0; for i=(days+1):T F_pred_A(i,:) = ones(k,1)' * F_pred_COV(:,:,i)^(-1) * ones(k,1); F_pred_B(i,:) = ones(k,1)' * F_pred_COV(:,:,i)^(-1) * F_pred_ARMA(i,:)'; F_pred_C(i,:) = F_pred_ARMA(i,:) * F_pred_COV(:,:,i)^(-1) * F_pred_ARMA(i,:)'; end F_pred_VAR = ones(T,1) ./ F_pred_A; % of the optimum portfolio F_pred_RET = F_pred_B ./ F_pred_A; % of the optimum portfolio bF_pred_DCC = F_pred_RET ./ F_pred_VAR; % of the optimum portfolio F_pred_W = ones(T,k) * 0; for i=(days+1):T 39 DELTA = F_pred_A(i,:) * F_pred_C(i,:) - F_pred_B(i,:)^(2); LAMDAH = (F_pred_C(i,:) - F_pred_B(i,:) * F_pred_RET(i,:)) / DELTA; SINGY = (F_pred_A(i,:) * F_pred_RET(i,:) - F_pred_B(i,:)) / DELTA; F_pred_W(i,:) = (LAMDAH * F_pred_COV(:,:,i)^(-1) * ones(k,1) + SINGY * F_pred_COV(:,:,i)^(-1) * F_pred_ARMA(i,:)')'; end % Results dataW = ones(T,1) * 0; for i=(days+1):T dataW = data(i,:) * F_pred_W(i,:)'; end rDCC = dataW .* bF_pred_DCC; rDCC_VAR = F_pred_VAR .* (bF_pred_DCC.^(2)); % actually ends up ret^2/var (if sub in for) % EQUALLY WEIGHTED bF_pred_GARCH = F_pred_ARMA ./ F_pred_GARCH; rGARCH = data .* bF_pred_GARCH; rGARCH_EW = (rGARCH * ones(k,1)) ./ k; rGARCH_EW_VAR = ones(T,1) * 0; bF_pred_EW = ones(T,1) * 0; for i=(days+1):T rGARCH_EW_VAR(i,:) = (ones(k,1)' / k) * F_pred_COV(:,:,i) * (ones(k,1) / k); bF_pred_EW(i,:) = bF_pred_GARCH(i,:) * (ones(k,1) / k); end % Running, comparable on bet size DCCsum = 0; EWsum = 0; for i=(days+1):T DCCsum = DCCsum + abs(bF_pred_DCC(i)); EWsum = EWsum + abs(bF_pred_EW(i)); end rDCC = rDCC / DCCsum * 1000; rGARCH_EW = rGARCH_EW / EWsum * 1000; save rDCC.csv rDCC -ascii; save rGARCH_EW.csv rGARCH_EW -ascii; rDCCsum = ones(T,1) * 0; rEWsum = ones(T,1) * 0; for i=(days+1):T rDCCsum(i,:) = rDCCsum(i-1,:) + rDCC(i,:); rEWsum(i,:) = rEWsum(i-1,:) + rGARCH_EW(i,:); end save rDCCsum.csv rDCCsum -ascii; save rEWsum.csv rEWsum -ascii; --- 40

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 4 |

posted: | 6/6/2012 |

language: | English |

pages: | 41 |

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.