. This is the reason for the breakout of thelinear relationship as depicted in Fig. 2.2 by the vertical line AB.The third scatterplot in Fig. 2.3 plots the S&P 500 vs. Japan’s Nikkei 225.Pearson’s coefficient of correlation is −0.445 and Spearman’s ρ is −0.4, suggestinga negative correlation for the period from 1 January 1992 to 13 December 2006. Bothvalues are, however, meaningless for making any useful predictions for the Nikkeibased on the S&P 500 as their relationship is not linear.A closer examination of the scatterplot, however, reveals that the scatter is clusteredaround three distinct areas, each having completely different slopes: Area A at thetop left of the chart exhibits a distinct positive correlation with the S&P; area B inthe center of the chart with a negative correlation; and area C at the bottom rightwith no correlation at all. The time period of the above different correlations canbe identified more precisely by superimposing a chart of the Nikkei on the S&P(Fig. 2.5). The period from 1992 to 2007 under study can be divided into six types.
24
Intermarket Trading Strategies
1600
B
LinearCubic fit line
1400
1200
S&P-500
1000
800
600
R Sq Linear=0.771400
R Sq Cubic=0.982
A
S&P-500 v s Nasdaq 100 15 Year Scatterplot
2000
1000
2000
3000
4000
5000
NDX
Figure 2.2 Scatterplot of the S&P 500 and the Nasdaq 100, for the last 15-year period. Therelationship is not linear, as the best fit line is curvilinear.
The first five from 1992 to 1999 (marked A, B, C, D and E) feature alternate positiveand negative correlations and the last one (marked F in Fig. 2.5) a distinct positivecorrelation for the period from 1999 to 2007. The positive correlation periods can beallocated to area A in Fig. 2.3 and the negative correlated periods to area B.Area C consists of smaller periods with zero or near zero correlation enclosedinside the longer periods.In view of the above, it is evident that neither Pearson’s nor Spearman’s correlationcoefficients are appropriate for analyzing nonlinear relationships. In these cases,mathematicians use the so-called coefficient of nonlinear correlation or Eta (denotedby the Greek letter η) which is computed by splitting one of the variables into groupsof equal width according to their rank. Eta is then calculated by dividing the group bythe total variance. Eta can be used to measure the degree of linearity of a relationship,as the extent to which Eta is greater than r is an estimate of the extent to whichthe data relationship is nonlinear. Unfortunately, Eta is not particularly useful foranalyzing financial markets because, in the case of time series, the groups should becategorized according to time and not rank.In cases of minor deviations from linearity (for example the relation between theFTSE and the S&P 500), transforming raw prices into percentage yields usuallyenhances the linear relationship between two variables, resulting in a more reliablecorrelation and regression analysis.
Correlation
25
1600.00
1400.00
A1200.00
S&P-500
B1000.00
800.00
600.00
C400.00
R Sq Linear=0.198S&P500 vs Nikkei-225 15 Year Scatterplot
200.00
5000
10000
15000
20000
25000
NIKKEI
Figure 2.3 Scatterplot of the S&P 500 and the Nikkei, for the last 15-year period. Therelationship is not linear, as the points deviate significantly from the best fit line.
Fortunately there are methods more appropriate for analyzing the nonlinearnature of the financial markets: artificial neural networks and kernel regression.Neural networks are nonparametric models which are inherently nonlinear in theircomputational elements and provide potentially the greatest opportunity for exploiting time series with low correlation dimension estimates by analyzing complex nonlinear relationships without making prior assumptions about the data distribution.More information on neural networks is provided in Chapters 10 and 14.
2.2.2 NormalityA correlation coefficient derived using Pearson’s formula makes the implicitassumption that the two variables are jointly normally distributed. In the case ofmost financial series this assumption is not justified, and a nonparametric measuresuch as the Spearman rank correlation coefficient might be more appropriate.
26
Intermarket Trading Strategies
Figure 2.4 Weekly chart of the S&P 500 (thick line) with the Nasdaq 100 superimposed(thin black line) from 1990 to 2007. The relative strength between the S&P 500 and the NDXis plotted in the top window.
Consider the histogram of 15-year S&P daily changes in Fig. 2.6. Overlayingthe normal (Gaussian) distribution we notice that these are not fully described by theGaussian model. There are two problems with approximating S&P returns with thenormal distribution model. The first is that the vast majority of the returns tend to belocated near the center of the distribution and the second – and most important – isthat the actual distribution has fatter and longer tails. This means that the probabilityof a larger movement in the index is much higher than that predicted by the normaldistribution. The Gaussian model predicted a virtually nil (0.000027) probability ofa one day 4 % decline in the index whereas such events occurred six times duringthe period from 1 January 1992 to 31 December 2006. This is more obvious in thenormal plot in Fig. 2.8 where it can be seen that for daily changes greater than 2 % orless than −2 % the distribution deviates significantly from normality. The volatilityand hence the deviation from the normal curve has been exacerbated since the “uptickrule” (a regulation that prohibited short selling following downticks) was abolishedby the SEC on 6 July 2007. The effect of the abolition of the uptick rule can be seen
Correlation
27
Figure 2.5 Weekly composite chart of the S&P 500 (thick line) with Japan’s Nikkei superimposed (thin black line) from 1990 to 2007. The 52-week Pearson’s correlation strengthbetween the S&P 500 and the Nikkei is plotted in the top window.
graphically in Fig. 2.9 which has “fatter” tails (that is, higher frequency at extremevalues) than the distribution in Fig. 2.6. In addition, the standard deviation of dailychanges, which was only 1.0 before the uptick was abolished, increased by more than30 % to 1.3 after the uptick rule was eliminated. It is not certain, however, that theincreased volatility can be wholly contributed to the repeal of the uptick rule as itcoincided with the sub prime mortgage financial upheaval and the collapse of BearStearns. At the time of writing, the situation with the financials has not yet normalizedbut it would be interesting to see the net effect of this rule on the distribution of dailychanges of the S&P 500 as soon as enough data are available for such a study.In any case, if we have to use statistical metrics that assume normality, it ispreferable to use daily or weekly changes instead of raw index values. A comparison of the distribution of raw S&P values in Fig. 2.7 with that of daily returns inFig. 2.6 will make this more obvious. In fact, Fig. 2.7 bears no resemblance to anormal distribution at all.
28
Intermarket Trading Strategies
700
600
Frequency
500
400
300
200
100
0–8 –7 –6 –5 –4 –3 –2 –1 0 1 2 3 4S&P Daily % Changes
5
6
Figure 2.6 Distribution of S&P 500 daily % returns for the 15-year period from 1992–2006.300
250
Frequency
200
150
100
50
0200.00
1400.00600.001000.00400.001600.00800.001200.00S&P-500
Figure 2.7 Distribution of S&P 500 daily prices for the 15-year period from 1992–2006.
Correlation
29
4
Expected Normal
2
0
–2
–4–8
–4
–6
0–2Observed Value
4
2
6
Figure 2.8 Normality plot of the S&P 500 15-year daily % returns.30
25
Frequency
20
15
10
5
0–4
–3
–2
–1
0
1
2
3
4
5
S&P Daily % Change
Figure 2.9 Distribution of S&P 500 daily % returns since the elimination of the uptick rule(from 9 July 2007 until 5 May 2008). Notice the unusually high frequency of more than –2.5 %daily declines during the relatively short period of 210 trading days. The standard deviationalso increased by more than 30 % and the kurtosis (which is the variance due to infrequentextreme deviations) increased by more than 700 % from 0.43 to 3.77.
30
2.3
Intermarket Trading Strategies
OUTLIERS
Because of the way in which the regression line is determined (especially the factthat it is based on minimizing the sum of the squares of distances of data points fromthe line and not the sum of simple distances) outliers have a significant influenceon the slope of the regression line and, consequently, on the value of the correlationcoefficient. This is more of a problem when working with financial series with smallsamples (less than a year’s data).A single outlier is capable of changing the slope of the regression line considerablyand, consequently, the value of the correlation, as demonstrated in the followingexample in Fig. 2.10 of the six month scatterplot of the Amex oil index (XOI) vs.the Nymex oil futures daily changes. By removing just one outlier (on the far rightof the graph), the correlation improved from 0.523 to 0.568 and the coefficient ofdetermination (r2 ) from 0.283 to 0.323.
3.000
XOI 1 day % Change
2.000
1.000
0.0005.357–0.557
–1.000
–2.000
–3.000
R Sq Linear=0.283–4.000–6.000
–4.000
–2.000
0.000
2.000
4.000
6.000
OIL NYMEX 1 day % Change
Figure 2.10 Six month scatterplot of the Amex oil index (XOI) vs. Nymex oil futures. Byremoving just one outlier (enclosed in the square on the far right of the graph), the correlationimproved from 0.523 to 0.568.
Correlation
2.4
31
HOMOSCEDASTICITY
In calculating Pearson’s correlation coefficient or the regression coefficients, the variance is assumed to be the same at any point along the linear relationship. Otherwisethe correlation coefficient is a misleading average of points of higher and lower correlation. A set of random variables having the same variance is called homoscedastic.Serious violations in homoscedasticity (assuming a distribution of data is homoscedastic when in actuality it is heteroscedastic) result in underemphasizing thePearson coefficient. Heteroscedasticity does not invalidate the analysis and can beusually rectified by transforming the price data to yields or logarithms. An example ofheteroscedasticity is depicted in Fig. 2.11 of the scatterplot of the S&P vs. Canada’sTSX index, where the variance is greater for larger values of the indices at the topright of the graph.
1600.00
1400.00
S&P-500
1200.00
1000.00
800.00
600.00
400.00
R Sq Linear=0.789
200.00
2000
4000
6000
8000
10000
12000
14000
TSX
Figure 2.11 Fifteen year scatterplot of the S&P 500 vs. Canada’s TSX composite index.The plot shows a violation of the assumption of homoscedasticity. For lower values on theTSX-axis, the points are all very near the regression line, while for higher values the variabilityaround the regression line increases dramatically.
3Regression
Man loves company, even if only that of a small burning candle.–Georg Christoph LichtenbergRegression involves the use of the concept of correlation in predicting future valuesof one security (dependent variable), in terms of another (independent or predictorvariable). For example, if there is high correlation between the S&P 500 and theEuro Stoxx 50 index we can use the linear regression equation to predict futurevalues of the S&P by extending the least squares or linear regression line into thefuture.The mere fact that we use our knowledge of the relationship between the twoindices to predict values of the S&P 500 from the Euro Stoxx doesn’t imply thatchanges in the Euro Stoxx cause changes in the S&P. These could be caused by anumber of economic or geopolitical reasons which affect both indices.
3.1
THE REGRESSION EQUATION
The general form of a simple linear regression is:y = bx + a
(3.1)
where a (regression constant) is the intercept and b (regression coefficient) is the slopeof the line, y is the dependent variable and x is the independent variable. Estimatesfor the values of a and b can be derived by the method of ordinary least squares.The method is called “least squares” because estimates of a and b minimize the sumof squared error estimates for the given data set. The regression constant a and the
34
Intermarket Trading Strategies
coefficient b are calculated using the following formulae: n xy − xy(xi − x̄)(yi − ȳ)= b=  22(xi − x̄)n x2 −xy−b x= ȳ − b x̄a=n
(3.2)
(3.3)
where x̄ is the mean of the x values, and ȳ is the mean of the y values.The formula for the regression coefficient b can be alternatively expressed in termsof Pearson’s correlation coefficient r:b=r
sysx
(3.4)
where sx is the standard deviation of the predictor variable x and sy is the standarddeviation of the dependent variable y.Table 3.1 shows an Excel sheet of one day changes between gold and the dollarindex, illustrating the calculation of the regression coefficient and the constant.Thus the regression equation to predict the dollar index in terms of gold isY (dollar) = −0.314 * X (gold) + 0.083In the following example only 15 data sets were used but in practice more thantwo years’ data need to be taken into account for a reliable prediction.3.2
MULTIPLE REGRESSION
The concept of linear regression with a single predictor variable can be extended formore than one variable combined into the following equation:y = b1 x1 + b1 x1 + . . . . + bk xk + a
(3.5)
In single regression we fitted a straight line to the scatterplot of points in a twodimensional graph. Extending this concept, the geometry of multiple regression(where two or more predictor variables are involved), would involve fitting a planein multi-dimensional space.However, since we live in a three-dimensional world, we cannot visualize thegeometry when more than two independent variables are involved. We can extend,however, the same method only mathematically.The practical problem in multiple linear regression is to select an effective set ofpredictor variables which will maximize the coefficient of determination, r squared,which is the proportion of variance in the dependent variable that can be explained bythe variance of the predictor variables. Therefore, we want to include predictor variables that are highly correlated with the dependent variable but have low correlationsamong themselves.
Row21222324
0.630150.0420.812
nmean µσ
H18/E18H20* C21/B21(C18-H21* B18)/B19C20-H22* B20
1.733
0.3250.0410.1290.1600.1400.1130.0110.5430.0010.0000.0370.0520.0310.0620.088
(Y − µ)
0.570−0.202−0.3590.4000.3740.336−0.106−0.7370.0260.0020.1930.228−0.177−0.249−0.297
X−µ2
G
F
9.223Covariance σ xy =Pearson’s Correlation rRegression Coef. b (formula 3.2)Regression Coef. b (formula 3.4)Regression Constant a =Regression Constant a =
1.9210.7870.0030.1350.2232.9100.0151.0940.1970.0850.0840.3260.1291.1900.124
(X − µ)
−1.3860.887−0.050−0.367−0.472−1.7060.1211.046−0.444−0.2920.2900.5710.3591.0910.352
X−µ2
E
D
Formula for Column H
1.052150.0700.352
Y
0.640−0.132−0.2890.4700.4440.406−0.036−0.6670.0960.0720.2630.298−0.107−0.179−0.227
X
−1.3440.929−0.008−0.325−0.430−1.6640.1631.088−0.402−0.2500.3320.6130.4011.1330.394
Date
C
12/8/0612/11/0612/12/0612/13/0612/14/0612/15/0612/18/0612/19/0612/20/0612/21/0612/22/0612/26/0612/27/0612/28/0612/29/06
B
A
−2.897−0.207−0.725−0.314−0.3140.0830.083
−0.790−0.1790.018−0.147−0.176−0.573−0.013−0.771−0.011−0.0010.0560.130−0.064−0.272−0.105
(X − µ)(Y − µ)
H
18192021222324
34567891011121314151617
2
1
Table 3.1 Example of calculating the regression coefficient b and the intercept a using Excel. The formula for calculating the otherstatistical metrics can be found in Table 2.2 (Chapter 2). The Greek letter µ depicts the mean for both the X and Y variables. The variables Xand Y are the one day percentage change of gold (spot) and the dollar index respectively from 8 December 2006 to 29 December 2006.
36
Intermarket Trading Strategies
1500
SPX
1400
1300
12003500
3700
4000ESTX
4250
4500
124
120
115YEN
112
105
Figure 3.1 Three-dimensional scatterplot visualizing the relationship between the S&P 500(on the Y-axis) vs. the Euro Stoxx 50 (on the X-axis) and the yen (on the Z-axis) for the 2-yearperiod from 1 January 2006 to 31 December 2007. The more points fall inside the regressionplane the better the predictive power of the regression model.
As a rule of thumb, intercorrelation among the independents above 0.80 signalsa possible problem and may cause the system to become unstable. The statisticallypreferred method of assessing multicollinearity is to calculate the tolerance coefficientfor each independent variable.Tolerance is 1 − r2 (one minus the coefficient of determination) for the regressionof each independent variable on all the other independents, ignoring the dependent.There will be as many tolerance coefficients as there are independents. The higherthe intercorrelation of the independents, the more the tolerance will approach zero.As a rule of thumb, if tolerance is less than 0.20, a problem with multicollinearity isindicated.High multicollinearity can be ignored when two or more independents are components of an index, and high intercorrelation among them is intentional and desirable.These are usually combined in an index prior to running regression, but when this isnot practically possible they can be entered individually. For example, if data for anobscure index are not readily available some of the component stocks can be usedinstead of the index itself.
Regression
37
Table 3.2 Correlation matrix of weekly % yields of major international indices, the CBOEvolatility index (VIX,) the Utility Index (UTY) and the 10-year Treasury yield (TNX) withthe S&P 500 for the 5-year period from 1 January 2001 to 31 December 2006.S&P 500 ESTXS&P 500ESTXDAXCAC 40FTSENikkeiVIXUTYTNX
10.810.800.800.740.42−0.720.600.39
DAX
0.810.8010.940.9410.970.920.880.820.490.51−0.57 −0.560.430.390.450.49
CAC 40 FTSE
Nikkei VIX
0.800.970.9210.890.49−0.560.430.46
0.420.490.510.490.451−0.360.210.29
0.740.880.820.8910.45−0.540.400.42
UTY
TNX
−0.720.600.39−0.570.430.45−0.560.390.49−0.560.430.46−0.540.400.42−0.360.210.291−0.43 −0.25−0.4310.04−0.250.041
Perhaps this is better understood with an example. Let’s say that we want todesign an intermarket system to trade the S&P 500. The first step is to calculate thecorrelation between the S&P 500 with major international equity, commodity andfinancial indices.Because of normality and linearity problems associated with raw index prices, theseare converted to weekly percentage yields and the correlation matrix is calculated(depicted in Table 3.2). The next step is to add to the regression equation the predictorvariables one at a time and calculate the coefficient of determination (r squared) andthe tolerance for each variable. As you can see in Table 3.3, including more thanthree variables will only improve r squared marginally or not at all and the tolerance
Table 3.3 The coefficient of determination (r2 ), the r2 change and the tolerance are depictedfor each model. The first model includes only the Euro Stoxx, the second includes the EuroStoxx and the VIX and one more index is added for each subsequent model.ToleranceModel
r2
r2 change
ESTX
VIX
UTY
TNX
DAX
FTSE
CAC 40
Nikkei
12345678
0.650.750.790.800.810.810.810.81
0.650.100.050.010.010.000.000.00
1.000.670.630.520.120.080.050.05
0.670.630.630.620.620.620.60
0.770.740.740.740.730.73
0.770.740.730.730.73
0.120.120.110.11
0.210.190.19
0.050.05
0.72
38
Intermarket Trading Strategies
drops below 0.2 for a number of cross correlated variables. Thus the first step is toexclude the DAX, FTSE and CAC 40 since they are highly correlated with the ESTX(Euro Stoxx). The Nikkei is then dropped from the analysis as it doesn’t improve ther squared coefficient at all. The remaining variables are the ESTX, VIX and UTY(model 3) and the regression equation becomes:SP = 0.366∗ ESTX − 0.067∗ VIX + 0.206∗ UTY + 0.045
(3.6)
where SP, ESTX, VIX, TNX and UTY are weekly percentage changes of the corresponding indices.Substituting the values for ESTX, VIX and UTY for 11/7/06 in (3.6):SP = 0.366∗ 1.7 − 0.067∗ (−0.09) + 0.206∗ (−1.6) + 0.045 = 0.343 % vs 0.36 %the actual S&P 500 weekly change for the specific week.
3.3
ASSUMPTIONS
The correlation assumptions discussed in Chapter 2 are also valid for regression,since according to (3.4) regression is directly proportional to correlation.The most important assumption is that of linearity. Checking that the linearityassumption is met is an essential task before using a regression model, as substantialviolation of linearity means regression results may be more or less unusable.Simple inspection of scatterplots is a common, if non-statistical, method of determining if nonlinearity exists in a relationship. An alternative is to fit a preliminarylinear regression and to use the appropriate diagnostic plots to detect departures fromlinearity. Transforming one of the variables (for example by taking differences or logs)can sometimes help linearize a nonlinear relationship between two financial series.Normality is also a problem when considering raw stock or index prices but it isless of a problem when taking log differences or percentage yields. The problem ofthe longer tails (discussed in Chapter 2) can be partially overcome by removing someof the most extreme outliers.Normality can be visually assessed by looking at a histogram of frequencies.Alternatively you can use a formal normality test such as the Shapiro-Wilks W testor the Kolmogorov-Smirnov D test.
3.4
NONPARAMETRIC REGRESSION
Nonparametric regression relaxes the usual assumption of linearity and makes noassumptions about the population distribution.
Regression
39
A more accurate estimate of the prediction is usually obtained by using nonparametric regression in cases of severe violations of linearity at the expense of muchgreater computation and a more difficult-to-understand result.Two common methods of nonparametric regression are kernel regression andsmoothing splines. The smoothing splines method minimizes the sum of squaredresiduals, adding a term which penalizes the roughness of the fit. The kernel regression algorithm falls into a class of algorithms called “SVMs” or “Support VectorMachines”. SVM-based techniques typically use a kernel function to find an optimalseparating hyperplane so as to separate two classes of patterns with maximal margin.SVM models are closely related to neural network models.In recent years, SVMs have received considerable attention because of their superior performance in forecasting high noise and non-stationary financial time series.A major advantage of SVMs over other nonparametric methods is that they can havegood performance even in problems with a large number of inputs. However, unlikeother nonparametric methods the major difficulty of the SVM approach lies in theselection of its kernel, as choosing different kernel functions will produce differentSVMs.
4International Indicesand Commodities
To conquer fear is the beginning of wisdom.–Bertrand RussellBefore proceeding with intermarket correlation, and for the benefit of US readers, Ithought it might be useful to say a few words about the international indices used inthe next chapters. I presume that readers who have bought this book are familiar withthe Standard & Poor 500 and the Nasdaq so I will start with European stock indices.
4.1
THE DAX
The leading index of the Deutsche Börse, the DAX (symbol: GDAXI) comprises ofthe 30 largest and most actively traded German equities (blue chips). The criteria forweighting the stocks in the index are trading volume and market capitalization. TheDAX is a performance index, which means that all income from dividends and bonusdistributions is reinvested into the index.In addition to the DAX, the Deutsche Börse calculates a number of other indices,the most important being:• The MDAX, which consists of the 50 largest companies from the classic sector ofthe Frankfurt Stock Exchange, that rank below the DAX components in terms ofmarket capitalization and trading volume.• The TecDAX, which consists of the 30 largest companies from the technologysector of the Frankfurt Stock Exchange, that rank below the DAX components interms of market capitalization and trading volume. The TecDAX is equivalent