predicting turning points300208/fulltext01.pdf · i.e. the stock market cycle can be divided in...

42
U.U.D.M. Project Report 2009:20 Examensarbete i matematik, 30 hp Handledare och examinator: Johan Tysk September 2009 Predicting Turning Points Jón Árni Traustason Department of Mathematics Uppsala University

Upload: others

Post on 25-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

U.U.D.M. Project Report 2009:20

Examensarbete i matematik, 30 hpHandledare och examinator: Johan TyskSeptember 2009

Predicting Turning Points

Jón Árni Traustason

Department of MathematicsUppsala University

Page 2: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,
Page 3: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Abstract

The paper investigates whether macroeconomic variables can predictturning points in the stock market where the focus is set on applying themas a predicting variable in a Hidden Markov Model (HMM). The sample ofpredicting variables consists of: the yield curve, the Purchasing ManagerIndex (PMI), historical stock returns, the VIX index, in�ation, housingstarts, vehicle sales and total production. The model of choice is theMarkov Bayesian Classi�er, MBC, introduced by Koskinen and Öller buthere we introduce a suitable optimization algorithm which makes applyingthe model in several dimensions plausible. The MBC does depend onprede�ned turning points and several de�nitions of turning points aresuggested and tested, both considering the long and the short term view.After suitable de�nitions have been sorted out the prediction power ofthe model is tested as well as if the prediction can be used in simpleinvestment strategies with pro�t.

Page 4: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,
Page 5: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Contents

1 Introduction 5

1.1 De�ning a Turning Point . . . . . . . . . . . . . . . . . . . . . . . 61.1.1 Adjustments in the Short Run . . . . . . . . . . . . . . . 71.1.2 Adjustments in the Long Run . . . . . . . . . . . . . . . . 71.1.3 De�nition Overview . . . . . . . . . . . . . . . . . . . . . 8

1.2 Disposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2 The Model 10

2.1 Markov Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.2 Hidden Markov Model . . . . . . . . . . . . . . . . . . . . . . . . 112.3 Markov Bayesian Classi�er . . . . . . . . . . . . . . . . . . . . . 122.4 The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.5 The cost function . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3 Estimation 15

3.1 Smoothing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.2 Optimization Method . . . . . . . . . . . . . . . . . . . . . . . . 15

3.2.1 Optimality . . . . . . . . . . . . . . . . . . . . . . . . . . 173.3 Verifying the Assumptions . . . . . . . . . . . . . . . . . . . . . . 183.4 The Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

4 Estimation Results 20

4.1 In-Sample Adjusments and Results . . . . . . . . . . . . . . . . . 204.1.1 De�nition Comparison . . . . . . . . . . . . . . . . . . . . 204.1.2 Lead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224.1.3 Choosing the Sample . . . . . . . . . . . . . . . . . . . . . 234.1.4 The Transition Probabilities and the Smoothing Parameters 244.1.5 Di�erent Estimation Periods . . . . . . . . . . . . . . . . 254.1.6 The length of the in-sample . . . . . . . . . . . . . . . . . 25

4.2 Out-Sample Results . . . . . . . . . . . . . . . . . . . . . . . . . 264.2.1 Short Run . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4.3 Buy or Sell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294.3.1 Di�erent Cost Function . . . . . . . . . . . . . . . . . . . 314.3.2 Available Information . . . . . . . . . . . . . . . . . . . . 31

5 Conclusion 31

6 Further Studies 32

6.1 Other Time Series . . . . . . . . . . . . . . . . . . . . . . . . . . 326.2 Behavior Over Time . . . . . . . . . . . . . . . . . . . . . . . . . 32

A Additional Derivations 36

A.1 Baye's Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36A.2 Adding Serial Correlation . . . . . . . . . . . . . . . . . . . . . . 36

B Other Markets 37

3

Page 6: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

List of Figures

1 De�ned Historical Short Run Turning Points, STP . . . . . . . . 82 De�ned Historical Long Run Turning Points, LTP . . . . . . . . 93 Hidden Markov Model . . . . . . . . . . . . . . . . . . . . . . . . 114 The Transition between States and the Information Series . . . . 125 Hidden Markov Model with lead . . . . . . . . . . . . . . . . . . 126 Di�erent De�nitions . . . . . . . . . . . . . . . . . . . . . . . . . 217 Di�erent leads for the short and long run. . . . . . . . . . . . . . 228 Di�erent sample sizes for the short and long run. . . . . . . . . . 239 Out-Sample De�nition Comparison . . . . . . . . . . . . . . . . . 2610 Out-Sample Turning Points . . . . . . . . . . . . . . . . . . . . . 2711 Out-Sample Probabilities . . . . . . . . . . . . . . . . . . . . . . 2712 Out-Sample Turning Points . . . . . . . . . . . . . . . . . . . . . 2813 Out-Sample Turning Points . . . . . . . . . . . . . . . . . . . . . 2914 Strategies based on prediction vs. buy and hold. . . . . . . . . . 3015 Turning Points in More Markets . . . . . . . . . . . . . . . . . . 3716 Turning Points in More Markets . . . . . . . . . . . . . . . . . . 3817 Out-Sample prediction in USA using Euro Zone plus macro sample. 3918 Out-Sample prediction in Sweden using other markets. . . . . . . 40

List of Tables

1 Historical Bear and Bull markets of the S&P500: 1990-2009 . . . 92 The Macroeconomic Variable Sample. . . . . . . . . . . . . . . . 193 Model �tted Bear and Bull markets of the S&P500: 1990-2009 . 224 The Optimal Combinations for Di�erent Sample Sizes . . . . . . 235 Optimization Parameter Analysis . . . . . . . . . . . . . . . . . . 246 Calculated Expected Time vs Historical Average Time . . . . . . 257 Predicted Bear and Bull markets of the S&P500: 2002-2009 . . . 268 Values of di�erent strategies for the short and long run. . . . . . 30

4

Page 7: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

1 Introduction

It is the dream of every investor to be able to predict the stock market. To beable to answer the question, what will the stock market do? The only answerJ.P. Morgan could give was: "It will �uctuate"1 . Despite the fact that this isprobably the only correct answer it does not help and a more in depth answeris desired. The aim of the thesis is to determine the turning point of the stockmarket cycle using macroeconomic variables, where the S&P 500 stock indexis assumed to represent the market. The exact value of the market will not bediscussed in any detail, the focal point will be to predict when it will turn. Thiswill help investors to time their strategies and could also be usefule guideline orbenchmark for macroeconomic analysist.

Earlier literature about turning points focus on the business cycle, bothidentifying them and predicting. Where the standard de�ntion of a businesscycle provided by Arthur F. Burns and Wesley C. Mitchell (1946, p3):

Business cycles are a type of �uctuation found in the aggregate eco-nomic activity of nations that organize their work mainly in busi-ness enterprises: a cycle consists of expansions occurring at aboutthe same time in many economic activities, followed by similarlygeneral recessions, contractions, and revivals which merge into theexpansion phase of the next cycle.

frames the problem at hand. The fundamental element from the de�ntion is thatthe business cycle can be divided into two distinct regimes and the goal becomesto identify or predict the point of a regime shift, a turning point. To be ableto predict a turning point in the stock market cycle the above also has to hold,i.e. the stock market cycle can be divided in distinct phases of di�erent behavior.

The stock market cycle, like the business cycle, is despite the name far frombeing cyclical, it is an irregular �uctuation as one can clearly see, e.g. in Figure1. The market �uctuation might therefore be a more transparent name but thestock market cycle is more common so we will use that throughout this paper.We would also expect investors to behave di�erently depending on how long wehave been in a certain state. Maheu & McCurdy show for example that stockprices increase the most in the beginning of an expansion, bull market. So beingable to predict when it starts is crucial for everyone that wants to pro�t fromstock trades. They also found out, in contravention of, at least, my believe, thatthe probability of leaving a state decreases with time. Despite this we will notregard time duration in our calculation; instead we assume that the economicstatus e�ects probability of changing states. The economy on the other handchanges with time and time is therefore implicitly taken into count.

In theory the stock price today re�ects the expected future return of thecompany, so the correlation between stock prices and general economic activ-ity is high. But as stated the stock prices re�ect the future return so stockindexes are a leading indicator therefore should stock prices reach minimum

1See e.g. http://www.investorwords.com/tips/760/jp-morgans-perspective-on-what-stock-markets-will-do.html

5

Page 8: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

before the business cycle. The goal is to use macroeconomic variables to predictthe future stock price in fact expected future macroeconomic variables shouldbe used. Trying to predict future stock prices using available public informationand past prices is also a violation of the semi strong form of the e�cient markethypothesis de�ned by Fama (1970). So why bother?

First of all, some macroeconomic variables today give a clue about the fu-ture. The yield curve gives us information about how the future interest ratewill be and unemployment, in�ation and GDP give us a clue about future con-sumption and investment. Second, is the market really e�cient? Many claimotherwise. The e�cient market hypothesis has also been attacked by critics whoblame belief of rational markets for much of the last bubbles and bursts. Onecan also see the obvious, that if no one would could make money of analysingthe market no one would bother. Last, we note that the aim is not to predictevery step of the stock return only when it will turn. With that in mind we areset to go, but to be able to predict a turning point a concrete de�nition is needed.

1.1 De�ning a Turning Point

As the name points out a Turning Point is when the market turns, i.e. goes frombeing upward moving to downward or vice versa. The upward moving marketis commonly named a bull market and the downward period a bear market butalthough bull and bear market are common words in an investors dictionarythere does not exist any academic general de�nition. The de�nition �rst andforemost needs to capture the trend of the market, upward or downward. Itshould however not follow every turn it takes and should ignore short timedecreases of stock prices during a bull market, correction and a short termincrease of stock prices during a bear market, rallies.

De�nition 1. A Bull Market starts when stock returns go from being neg-

ative to being positive in two consecutive time periods while a Bear Market

starts when stock prices go from increasing to declining for two consecu-

tive time periods. The point when the market goes from being bullish to

bearish or vice versa is de�ned as a Turning Point. Where a short run

turning point, STP, is de�ned when the time period is set as one month

and a long run turning point, LTP, when it is set as one quarter.

As noted there does not exist any general de�nition for bull and bear marketsand consequently not for turning points. The reason is perhaps that a lot canor should be taken into count, volatility, the degree of the movement, historicaltrend or even the market price of risk. One reason for that De�nition 1 is notconsidered as su�cient is because of risk of hidden bull or bear market betweenstates which leads to late or no signal. E.g. a hidden bear market happens whenin a bear market and a major increase in stock price occurs in one month but isfollowed by a minor decrease, correction, the month after. A bull market mighttherefore have started although the de�nition states otherwise, this is particu-larly dangerous when this repeats itself. Although this is perhaps a more of arisk factor for in the short run, the long run de�nition also has its miss match.Since the timeperiod is one quarter but the time series monotored monthly a

6

Page 9: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

LTP might be signaled before the actual turn.

Since a general de�ncition is lacking and more importantly the model appliedin the paper depends heavily on the how the past states are categorized fewalternatives or adjustments are considered. The di�erent de�nitions will beinvestigated in more details, both how they �t the model and capture the trends.

1.1.1 Adjustments in the Short Run

The default de�nition might be misleading since stock prices tend to have anincreasing long term trend, to avoid this the returns are adjusted with respectto the historical average. Adjusted turning points, ATP, are de�ned when stockreturns go from being lower than the historical average to be higher than it fortwo periods in a row. This way the economic values will only signal a chancewhen they �uctuate more than normally. Here the historical average is assumedto be 0.6% a month and these kind of adjustment will only be made for theshort run turning points.

A di�erent adjustment can be maid by classifying the regimes by the marketprice of risk or the Sharp Ratio. The market price of risk is the return in excessof the risk free interest rate that the market demands as compensation for therisk taken, the reward-to-risk ratio of the market portfolio. The market price ofrisk is de�ned as MPR = µ−rf

σ , where µ is the return during the time period,σ is the volatility and rf is the risk free interest rate. As for ATP, the marketprice of risk turning points, MTP, are de�ned when the MPR goes from beingbelow its historical average to being higher and stays above the average for atleast two periods. The idea here is to take both the return and the risk, thevolatility, of the stock into count. The states would represent when it pays o�for an investor to take a risk, buy stocks, and when it doesn't.

At last, the de�nitions of the turning points given above are compared to theturning points that follow every change of direction in the stock returns or everydirection turning points, EDTP. This obviously eliminates the risk of a hiddenmarket but on the other hand it violates the fact that rallies and correctionshould not be de�ned as trends. This is also what investors would like to beable to predict and will therefore be tested.

1.1.2 Adjustments in the Long Run

Volatility of the market is far from being constant over time and dividing thestock market into di�erent states with respect to volatility is therefore plausible.Some evidence point to that volatility is higher during a downward trend, e.g.Maheu & McCurdy. Plus that expected stock returns and volatility are relatedthrough the capital asset pricing model (CAPM)2, where higher volatility leadsto lower expected return when the stock and the market are positively corre-lated, here the portfolio in hand is the market portfolio so the correlation isobviously one. It is therefore concluded that de�ning upward and downward

2E[ri] = rf +Cov(ri),rm

V ar(rm)∗ (E[rm] − rf ), where ri is the return of stock i and rm is the

market portfolio

7

Page 10: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

regimes in the stock market based on volatility is reasonable. A volatility turn-ing point, VTP, is de�ned when the volatility goes from being higher to lowerthan the historical average for two consecutive periods or vice versa. Here thevolatility is estimated by the standard deviation of daily returns within eachmonth. Since volatility is more stable over time than the stock returns the VIPare categorized as long run turning points.

So far the turning points have all be de�ned strictly based on if returns (orvolatility) are higher or lower than they used to be not how much higher orlower. The third alternative is to de�ne a bull market, as a gain of 15% ormore from a low point which was preceded by a 15% decline and vice versa forbear market. A degree turning point, DTP, is de�ned at the trough or the peakbetween the trends that are identi�ed by the minimum 15% change.

1.1.3 De�nition Overview

Given the de�nitions above we can now identify the turning points in the stockmarket, below in Figures 1 and 2 the STP and LTP turning points are presentedrespectively.

Figure 1: De�ned Historical Short Run Turning Points, STP

8

Page 11: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Figure 2: De�ned Historical Long Run Turning Points, LTP

Given the nature of the de�nition the statistics between the regimes ob-viously di�ers and in Table 1 few statistics are given. In short the statisticsindicate that the average monthly returns are two to three percent, where thedirection depends on the trend, and that the volatility is signi�cantly higherin bear markets. Which is interesting since that no condition was set on thevolatility in none except one de�nition, which strengthens the ground for VTP.Despite the seemingly relation between the return and volatility the VTP doesnot capture the trends as well as the other de�nitions. It should also be notedthat DTP does seem to capture bear markets best of the long run de�nitionsconsidered so setting it as default long run de�nition is tempting.

De�nition Avr Bear Vol Bear Avr Bull Vol Bull AT Bear AT BullSTP -2.61 18.67 2.02 13.57 5.57 10.06ATP -1.99 16.92 2.54 13.92 6.62 7.24MTP -1.53 15.86 2.81 14.51 7.81 6.50EDTP -3.73 16.23 3.19 14.70 1.54 2.30AEDTP -3.14 15.44 3.58 15.08 1.88 2.10LTP -2.13 21.40 1.48 12.72 12.80 32.60VTP -0.77 22.18 1.24 10.78 13.00 19.71DTP -2.98 23.07 1.48 12.82 13.00 43.75

Here the average returns are simply calculated taking the average of the monthlyreturns in the corresponding state and the average time is the given in months.The average volatility is calculated by taking the average of annualizaed of theinner month volatility of daily returns in each state.

Table 1: Historical Bear and Bull markets of the S&P500: 1990-2009

1.2 Disposition

The paper is organized as follows. In the next section the model will be intro-duced, where we start of by a brief introduction to Markov chains and hiddenMarkov model, then the model is constructed. Starting of deriving the prob-abilities wanted and then the cost function that needs to be minimized. In

9

Page 12: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

section three the estimation method is introduced in details and the optimalityconditions investigated. In section four the empirical results are calculated andpresented and a short discussion is given of them. The last section, Section 5,concludes the paper.

2 The Model

To be able to capture the di�erent behavior in the stock market the model hasto take into count di�erent regimes where the value of the parameters changesdepending on in which regime it is. In our model the stock market can only bein one of the two regimes, bear or bull, and the regimes are recurrent but notperiodic. The future states are unobserved and the goal is to predict when aswitch between them will occur given the information today. There are two mainmethods how to determine this switch of regime, using a speci�c threshold or ahidden Markov chain. When a speci�c threshold is applied the regime changeis assumed to happen when a certain value, threshold, is reach. Although onecan say that the behavior in the stock market changes when a top or bottom isreach there is no way of de�ning that kind of threshold. A general threshold suitsbetter when modeling e.g. in�ation or exchange rate, where reaching a certainlevel will trigger government intervention. In the Markov chain approach theregimes are assumed to follow a particular stochastic process, namely a Markovchain. The stochastic evolution of the states is a closer �t to the stock marketbehavior and therefore the focus is set on the Markov chain approach.

2.1 Markov Chains

A Markov chain is a stochasic process with Markov property. The idea is thatevery state of the Markov chain determines in which regime the economy is inat time t and in our case we have de�ned two cases and the Markov chain, Stis de�ned as:

St ={

0 if we are in a bear market (recession)1 if we are in a bull market (expansion)

. (1)

Our goal is to estimate P (St+l = j|It), where It is the information we have attime t, and then determine from that whether a turning point will occur or not.

The Markov Property states that the future states of a Markov chain donot depend on all past states only a �xed number of states. The simplest form,a �rst order Markov chain, is that the future state of the Markov chain onlydepends on the present state, i.e. the Markov chain has no memory

P (St+1 = j|St = i, St−1 = q, ...) = P (St+1|St). (2)

In our calculations time duration of a state is not taken into count, i.e. ourMarkov chain is of the simplest form, a �rst order Markov chain with twodiscrete states. The probability of going from i to j is given by pij and thetransition matrix is:

Ptrans =[p00 p01

p10 p11

]=[

p00 1− p00

1− p11 p11

]. (3)

10

Page 13: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

From equation (3) we see that only two transition probabilities need to beestimated to get the transition matrix, the general rule is that z2 − z have tobe estimated to get the transition matrix where z is the number of states inthe Markov chain. It is therefore clear that the dimension of the problem willincrease signi�cantly for every state added. As noted above our Markov chainis recurrent so we will always return to both states and we are interested inforecasting in which state we are in the future or more precisely when we willchange states. The probability of being in state j after n months given that weare in state i today is given by p(n)

ij . Now since the chain is recurrent and giventhat the natural assumption p00, p11 > 03 holds the probability of being in thesame state after n months can be calculated4

p(n)00 =

1− p11

2− p00 − p11+

1− p00

2− p00 − p11(p00 + p11 − 1)n. (4)

Like before we have the relation p(n)01 = 1 − p

(n)00 and similar formula can be

derived for p(n)11 .

It is also interesting to take a quick look at the expected duration in the cur-rent state. We de�ne the expected time of leaving state i as ki = E[time to leave i]which in our case is very easy to derive :

ki = 1 + pii ∗ ki + pij ∗ kj (5)

now kj = 0 since when we are in state j we have left i and we have,

k0 =1

1− p00and k1 =

11− p11

. (6)

This isn't however the whole story since our Markov chain is hidden but it willbe interesting to compare, e.g. the real average time of a state and the expectedtime estimated using eq.(6).

2.2 Hidden Markov Model

In a Hidden Markov Model, HMM, a �nite set of states, that follows a Markovchain, is assumed to explain a di�erent behavior in a time series. The statesare however not directly observable, only the dependant time series. In our casethe unobserved states are given by eq.(1) and the observed series , Xt, thatrepresent the information that we can observe at time t, the relationship can beexpressed graphically as:

Figure 3: Hidden Markov Model

3In fact it is enough that p00 + p11 > 0, i.e. St is ergodic.4See J.R. Norris (1997) p.5 and 57-58

11

Page 14: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Where each observation Xt is generated by a probability denstity function,bSt

(Xt), that depends on the state St. Here the information, Xt, is a vector oftime series given by:

Xt = the observed time series = [X1t, X2t, ..., Xkt], (7)

where the sample of choice in this paper is presented in Table 2. The connectionbetween the information and the states is graphed in Figure 4

Figure 4: The Transition between States and the Information Series

2.3 Markov Bayesian Classi�er

We follow Koskinen and Öller (1999) in details but we apply it on the stockmarket cycle not the business cycle. To be able to apply the model three as-sumptions have to hold; some macroeconomic variables lead the stock marketand the stock market cycle can be modeled with a two state Markov chain wherethe observed variables are normally distributed within the states.

Since the information today, Xt, is assumed to lead the state, St, the relationgraphed in Figure 3 above changes. In Figure 5 the Hidden Markov Model ispresented where Xt is assumed to lead St by l periods.

Figure 5: Hidden Markov Model with lead

The probability density function now depends on a future state St+l and thenormality assumption gives Xt ∼ N(µSt+l

, σ2St+l

). The goal is, as stated above,to estimate the probability of the stock market cycle being in a certain state inthe future given the present information, that is:

P (St+l = j|Xt). (8)

These probabilities are estimated with the recursive algorithm presented below,using the transition probabilities of St and the density function of Xt.

It is not enough to state some probability of being in a state, a decisionhas to be made. So a function, g(Xt), is de�ned, that decides which state ispredicted,

g(Xt) = j if P (St+l = j|Xt) ≥12

(9)

12

Page 15: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

and state j is predicted at time t+l if g(Xt) = j. This with the normalityassumptions

2.4 The Algorithm

Now to estimate the probability we use a recursive algorithm 5. In the beginningof every iteration we start with P (St+l−1|Xt−1) from earlier calculations andwe take the following steps.

Step 1 - a natural probability estimate given the earlier probability estimationand the transition probabilities

P (St+l = j|Xt−1) =1∑i=0

pij ∗ P (St+l−1 = i|Xt−1). (10)

Step 2 - Baye's Theorem 6

7P (St+l = j|Xt) =f(Xt|St+l = j) ∗ P (St+l = j|Xt−1)∑1i=0 f(Xt|St+l = i) ∗ P (St+l = i|Xt−1)

. (11)

Where f is the density function of the multivariate normal distribution 8.One can now put these steps together in one and obtain one formula that

estimates the probability at each time.

P (St+l = j|Xt) =(p0j ∗ p0(t+ l − 1) + p1j ∗ p1(t+ l − 1)) ∗ f(Xt|St+l = j)∑1i=0((p0i ∗ p0(t+ l − 1) + p1i ∗ p1(t+ l − 1)) ∗ f(Xt|St+l = i))

. (12)

To be able to use this algorithm we need µSt, σSt

and the transition matrix, P.We can calculate µSt

and σSt, since we know in which state we have been in so

far. This emphasizes how important the de�nition of choice is since it is neededto adjust the algorithm. The transition matrix, P, is how ever the variable thatwe use to minimize the cost of being wrong, see the cost function below.

To start the algorithm some starting value is needed, one simple approach is juststart with the neutral probability 1

2 of both states (Koskinen and Öller (1999)).One could also consider the steady state probabilities 9

P (S0 = 0) =1− p11

2− p00 − p11, P (S0 = 1) =

1− p00

2− p00 − p11. (13)

This can be added to the algorithm and estimated or we can use the method ofestimating transition probabilities from Andersson(2006)

p00 =n00

n00 + n01, p11 =

n11

n11 + n10(14)

5Hamilton (1994), p.6926Derived in Appendix A7Note that the decision function, eq.(9), can now be expressed as P (St+l = j|Xt−1) ∗

f(Xt|St+l = j) > P (St+l = i|Xt−1) ∗ f(Xt|St+l = i)

8f(Xt|St = j) =1

(2 ∗ π)n2 ∗ |σj |

12∗ exp(− 1

2∗ (Xt − µj)

′ ∗ σ−1 ∗ (Xt − µj)

9Kim and Nelson (1999), p.63-64

13

Page 16: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

where nij is the number of transitions from state i to j. Netfci (1984) statesthat when the time series is long the initial probability do not play a big partin the �nal result, so this complication might not pay o�.

2.5 The cost function

The cost function C which is used in the estimation and minimized subject tothe transition matrix in the recursive algorithm above. It is given by

C = ω ∗MSE + (1− ω) ∗ ECE, (15)

where ω ∈ (0, 1) and its value depends on which is valued more MSE or ECE.MSE is the Brier's probability score

MSE =1T∗∑t

e2t . (16)

With the error estimate et = P (St+l = j|Xt) − δ(St+l, j), where δ(St+l, j) isthe Kronecker delta function, and T is the length of Xt. ECE is the error countestimate

ECE =1T∗ count(g(Xt) 6= St+l). (17)

MSE can be interpreted as how wrong the prediction is and ECE as how oftenit is wrong. So the decision can be made with con�dent a emphasis will be puton MSE, i.e. MSE is valued more so ω > 1

2 . We will follow Koskinen and Öllerand set ω = 2

3 .

Now our problem can be formulated as:

minimize C(Ptrans)subject to 1 > pii > 0 , for i = 1, 2. (18)

Here, Ptrans is the transition matrix (3) that determines the probabilities (16),the upper constraint is strictly less than 1 since we assume that the Markovchain is recurrent and the natural assumption that the transition probabilityis strictly larger than 0, since else the market would jump from the state aftereach time period with probability 1. The problem looks simple at �rst glancebut the estimation becomes sort of cumbersome because of the complexity ofthe cost function.

Our objective function is obviously not continuous since at some points theECE part causes n

T jump, where n is the number of periods where the predictionchanges and T is the number of periods. However, this does not apply for allpredictions since at some points the decision will not change even though thedecision probabilities change slightly, i.e. the cost function is continuous aroundthese points.

De�nition 2. A prediction is said to be stable if the Error Count Estimator is

continuous in the neighborhood of it. Let v ∈ <n be the variables that are taken

into count when the cost function C(v) is estimated and the prediction is found.

Then the prediction is said stable if for all ε > 0 there exist a δ > 0 such that

‖ v − u ‖< δ ⇒‖ ECE(v)− ECE(u) ‖< ε.

14

Page 17: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

In other words a prediction is said to be stable if a small change in the inputvariables does not change it. In our case the prediction is the decision vectorg(Xt) and the input variables here are the transition matrix, Ptrans. Our predic-tion is stable as long as the probability vector does not have any values close to12 , this is something that is desired since a 50/50 prediction is not really reliable.

3 Estimation

After the model has been de�ned it has to be estimated, in this section theestimation will be discussed as well as what macroeconomic variables will beused as a predictor.

3.1 Smoothing

Before the model is applied some �lter should be considered. Smoothing thedata should decrease the risk of a false alarm since a high noise will be smooth.Applying a �lter should also help to shift the time series into the right phase,this is essential since the macroeconomic variables may have a di�erent lead onthe states of the stock market. There is also a drawback of smoothing the data,the smoothing shortens the distance between the observations which reducesthe probability of a successful detection and the probability of detecting it intime. We will therefore apply the model with and without a smoothing. Thesmoothing �lter that is applied is an Exponential Weighted Moving Average,EWMA, and our smooth series is de�ned as

Xt = λ. ∗Xt + (1− λ). ∗ Xt−1 (19)

where .* is the element wise multiplication and λ is the weight vector of the vari-ables. Now the smoothing parameters, λ is added to our optimization variablesand the problem (18) becomes:

minimize C(Ptrans, λ)subject to 1 > pii > 0 , for i = 1, 2

1 > λj > 0 ,∀λj ∈ λ(20)

Now let de�ne the feasible domain D as a domain where all constrains areful�lled and the problem becomes:

min(p,λ)∈DC(P, λ). (21)

3.2 Optimization Method

The most straight forward method to apply when the solution is estimated is asimple grid search, which is easy to apply when k is low, where k is the numberof macroeconomic variables. The grid search is applied in two stages, in the �rststage the smoothing parameters are estimated, λ, and the transition probabili-ties, P, using a 0.1 grid with, i.e. λj = pii = 0.1, 0.2, .., 1 for j = 1,2,..,k+1 andi = 1,2. In the second stage λ is hold constant and the transition probabilitiesare �ne-tuned using 0.01 grid with. However the cost of an additional macroe-conomic variable is extremely high, given that time is money, the number of

15

Page 18: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

calculations that have to be made in the �rst stage of the grid search is givenby 10 ∗ 10(k+1). Most of more sophisticated techniques, such as Newton's orOasi-Newton's methods, rely on the derivative of the objective function but inour case the objective function, eq 15, is not di�erentiable. Therefore a moreadvanced search algorithm that is more e�cient with increasing dimension ofthe problem is needed.

The algorithm of choice is DIRECT, a Lipschitzian optimization algorithm,10.In standard Lipschitzian optimization the objective function, f, is believed to beLipschitzian continuous in the feasible domain, D', that is there exists a knownconstant C such that

|f(x)− f(x′)| ≤ C ∗ |x− x′|, ∀x, x′ ∈ D′. (22)

Thus there exists a constant, C, that is a upper bound on the rate of change ofthe function and a lower bound can be estimated in any closed hyper rectan-gle, when the vertices points have been calculated. Then an algorithm, such asShubert's algorithm, and the lower bound is applied to choose between hyperrectangles, i.e. where to search, until the optimal point is obtained. However inDIRECT the Lipschitz constant is not needed. The advantage of not needing theLipschitz constant are that it can be hard to estimate, which it is for eq. 15, andthe Lipschitz constant is often fairly large since is a bond on the rate of changeof the corresponding function. The problem that follow a cumbersome estima-tion of it are obvious and when it is large it will lead optimization algorithmsbased on it to overemphasis on global search which leads to slow convergence.As mentioned above, the Lipschitz constant is not used in the classical sensein DIRECT but can be looked as a weighting parameter between global verseslocal search. That is, instead for calculating the Lipschitz constant, all possibleconstants between zero and in�nity are applied to select the set of potentiallyoptimal intervals. This solves two of the three problems of traditional Lipschitzoptimization are met, namely slow convergence and specifying the Lipschitzconstant. The third problem is complexity in higher dimension. Conventionalalgorithms estimate the vertices of each hyper rectangle which leads to 2n eval-uations, where n is the number of dimensions. The algorithm in hand howeveruses the midpoint of the space, which is one no matter the dimension of theproblem. Like other Liptschitzian algorithms, the DIRECT algorithm is alsodeterministic which makes multiple runs unnecessary, unlike genetic optimiza-tions where the optimal solution obtained is in some sense stochastic.

The selection of a potentially optimal interval does, as noted, depend on theLipschitzian constant where a hyper rectangle j is said to be potentially optimalif there exists some C > 0 such that

f(cj)− C ∗ dj ≤ f(ci)− C ∗ di ,for all i = 1, ...,m (23)

f(cj)− C ∗ dj ≤ ε|fmin| (24)

where ci is the midpoint of i-th hyper rectangle, di the distance from the verticesand ε is a lower bound for how much the checked solution needs to exceed thecurrent best solution, fmin. ε is the only parameter that has to be determined

10Jones, Perttunen and Stuckman 1993

16

Page 19: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

beforehand where evidence point out that DIRECT is fairly insensitive to thesetting of it, here the default value 10−4 is used. For further details such asgraphical explanations, performance comparison, convergence and how to di-vide the hyper rectangles see reference [8].

To apply DIRECT the constraints of the problem need to be fairly simpleand in our case they are indeed so, the only thing we assume about the opti-mization variables is that they are in the domain D or inside the unit hypercube.

A su�cient condition for convergence of the algorithm is that the functionis continuous - or at least continuous in the neighborhood of the optimal solu-tion. However, when the prediction is stable, the function is continuous in theneighborhood of the input variables. That is when our global optimum leads tostable prediction the algorithm will converge to it.

3.2.1 Optimality

A little further investigation of the optimality conditions is needed. The La-grangian of the problem is de�ned by:

L(P, λ, ν, γ) =

C(P, λ) +1∑i=0

(ν2i − ν2i+1) ∗ pi − ν2i +k∑j=0

(γ2j+1 − γ2j+2) ∗ λj+1 − γ2j+1 (25)

and the dual function is de�ned as the minimum of the Lagrangian,

d(ν, γ) = inf(P,λ)∈DL(P, λ, ν, γ). (26)

The Lagrangian dual problem becomes:

maximize d(ν, γ)subject to ν, γ ≥ 0 . (27)

One can see that an optimal solution to the Lagrangian dual problem, d∗, isalways less or equal to the optimum of the initial problem, c∗, that is d∗ ≤ c∗,this is called weak duality. When we have d∗ = c∗ then we say that strongduality holds and the optimal duality gap is zero. When all constraints areinactive so called Slater's conditions hold and the point is strictly feasible. Inour case we assume that the transition probabilities are always strictly feasible,but the smoothing parameters can theoretically be equal to 1, if the futurestate only depends on the present value of the variable not the past states. Theoptimal solution of the dual problem, d(ν∗, γ∗), is in our case obviously obtainedwhen

∑1i=0(ν2i−ν2i+1)∗pi−ν2i+

∑kj=0(γ2j+1−γ2j+2)∗λj+1−γ2j+1 = 0. Thus

d∗ = c∗ and strong duality holds and the complementary slackness conditionsgives:

0 < p∗i < 1 =⇒ ν∗2i, ν∗2i+1 = 0 (28)

0 < λ∗j < 1 =⇒ γ∗2j , γ∗2j+1 = 0 (29)

or,λ∗j = 1 =⇒ γ∗2j ∈ <+, γ

∗2j+1 = 0. (30)

17

Page 20: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

The problem is that the stationarity conditions of the KKT optimal conditionsdoes not hold when some, λi = 1, thus the necessary optimal conditions are notsatis�ed,

∇C(P, λ) +1∑i=0

(ν2i − ν2i+1) +k∑j=0

(γ2j+1 − γ2j+2) 6= 0, (31)

since γ∗2j ∈ <+. It might be added that the strange looking cost function is stilla bit of a problem since it is not possible to calculate the derivative of it rigor-ously (it can only be estimated numerically). However if Proposition 1 holds,then the necissary conditions for ∇C(P, λ) = 0 are ful�lled.

The conclusion is that in order of our solution to converge to the optimalsolution we must have a stable prediction and none of the smoothing parameterscan equal 1. Both cases are highly unlikely but neither of them is impossible.Note also that if the optimal value of some smoothing constant equals one nosmoothing should be applied on the corresponding variable.

3.3 Verifying the Assumptions

To apply our model we assume three assumptions, that the macroeconomic vari-ables have a lead the future state of the stock market, the stock market behaviorcan be categorized into two regimes and that within these states the informationseries is normally distributed.

There are in fact no tests that we can apply to verify that the macroeconomicvariables do lead the state of the stock market cycle, the variables included inour sample are simply picked with an economical feeling and partly based onthe results from S-S. Chen.

The next two assumptions go hand in hand, since the distribution withinin the states depends on how many states we assume and how the states arede�ned. In our case several de�nitions of de�ning the market into two stateshave been proposed and a multivariate normal distribution assumed11. But tocheck for the normality the smoothing parameters have to be determined so thenormality test cannot be done until after the calculations have been done. Thecalculations on the other hand depend on the distribution so for the momentnormality is just assumed to hold12.

3.4 The Data

Before we apply the models a closer look has to be taken at the data. We have tochoose the macroeconomic variables that we consider and which of them we use.

11The student t distribution was also tried, simply by comparing the cost from the normaldistribution when �tting the model to the whole period, with poor results.

12After the estimation had be done and the smoothing coe�cients determined a HenzeZirkler's Multivariate Normality Test was applied, in short the test denies normality for STPand DTP de�ned states. For simplicity the normal distribution is despite that assumed wherea solution to this is left for further studies, e.g. by using mixed distributions.

18

Page 21: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

First of all the sample of possible macroeconomic variables have to be cho-sen. There are a lot of literature that look into the connection between thestock market and macroeconomic variables. A simple solution would be to con-sider the same macroeconomic variables as Boström (2009) or Shiu-Sheng Chen(2008) and then check the forecasting performance of the variables. We how-ever don't want our sample to be extremely large and therefore try to pick oursample carefully, the sample that is considered is presented in table 2.

The Macraeconomic Variable SampleStock Returns X1The Purchasing Managers' Index Change, PMI X2Total Production Growth X3Yield Curve (5y - 1y) X4Vehicle Sales Growth X5Housing Starts Growth X6In�ation (from PPI) X7The VIX Index Change13 X8

Table 2: The Macroeconomic Variable Sample.

The closing value in each month is considered in all cases and the growth iscalculated in all of the variables except the Yield Curve (since the value of itcan be negative). The change is calculated by taking the �rst di�erence of thenatural logarithm of the series, i.e. Zt = ln(Yt) − ln(Yt−1). The PMI and thetotal production are seasonally adjusted and it should be added that dividendsare excluded in the stock prices.

The data sample is not picked randomly and an economic reasoning lies be-hind the sample of choice. The PMI re�ects the expectations of the companies,hence their expected revenues which a�ects the stock prices. The total pro-duction growth does obviously a�ect the economy as a whole, thus the stockmarket, where it re�ects the overall demand side. The yield curve is assumedto indicate the monetary policy which gives clue about future or expected in�a-tion. The vehicle sales and housing starts growth represent the households andtheir �nancial expectations. The in�ation calculated using the PPI does in somesense lead the CPI in�ation and is an evidence of both expected revenues of thecompanies and households, through the cost and wages respectively. Finally theVIX index change does give information about the volatility, risk, of the market.

After choosing the data some transformation is usually needed to obtain sta-tionarity but here two states of di�erent behavior of the time series is assumed,i.e. nonstationarity is assumed. The two states also address the problem ofheteroskedasticity, at least up to some level, since we have di�erent volatility inthe states.

Autocorrelation is a common problem when dealing with �nancial time se-ries. One solution would be to address this directly in the model, that is assumethat the stock market cycle would follow a switching AR(1) model:

Xt − µSt+l = φ(Xt−1 − µSt+l−1) + εSt+l (32)

19

Page 22: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

where εSt+l ∼ N(0, σSt+l). This would complicate our recursive algorithm be-cause the past probability would have to be taken into count plus the densityfunction would now be dependant of two states14. The main problem is howeverto estimate φ because φ is a vector since the autocorrelation coe�cient couldbe di�erent between the time series, i.e. if a multivariate autocorrelation is as-sumed. If however we assume vector autoregressive model, VAR, φ is a matrixand the estimation becomes even more cumbersome. On top of these com-plications, Ivanov (2000) states that the problem of autocorrelation is mostlycaptured by the probability of staying in the same state. The adjustment toserial correlation is therefore considered unnecessary and left for further studies.

4 Estimation Results

When testing our model the smoothing coe�cients and the transition proba-bilities are estimated in an in-sample period. Then, holding the coe�cientsconstant, the model is used to predict the states in an out-sample period. Anexpanding out-sample window is applied, starting from January 2002 and theexpanding step is one month up to July 2009. Note that although the return forthe last month can be observed the state cannot be determined with full cer-tainty since a turning point has occurred if and only if the return has changedfor two consecutive months. The latest information that is included in the in-sample is therefore Xt−l−1. Before the model is put in use, the lead, the size ofthe sample and the combination of variables has to be decided. To make thisdecision the model is applied to the whole period and the results are compared,thus in all cases the decision is made by a simple trial and error method.

4.1 In-Sample Adjusments and Results

We start of by a comparison of the di�erent de�nitions from the introduction.Then the short and the long-run de�nitions, STP and LTP, are analyzed inmore details and the other de�nitions are assumed to have similar characteristicsdepending on in which category they are in, short or long run.

4.1.1 De�nition Comparison

The results for the �t of the di�erent de�nitions to the model are presented inFigure 6, there the �t of the non-smoothed STP and LTP are also presented,de�ned as NSTP and NLTP respectively.

14See Appendix A for details.

20

Page 23: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Figure 6: Di�erent De�nitions

We clearly see from that when trying to capture every direction change,EDTP, the model does not give as good �t as when the focus set on the suggestedde�nitions in the short run. It can also be concluded from Figure 6 that thede�nition of turning points based on the MPR does not work and that thesmoothing is necessary to get decent results. The STP and ATP give on theother hand a good �t of the model and the �t of those two is almost identical.In the long run DTP gives the best �t which among the historical de�nitionsin Table 1 hints that for it should be applied for the long run.15 Althoughthe cost does give us a good idea on how the model does �t the de�nition, thede�nitions are di�erent which skews the comparison. One should therefore alsotake a brief look at the statistics obtained by �tting the model, see Table 3which corresponds with the historical statistics given in Table 1.

15Note that taking a di�erent period might lead to di�erent results. Couple of other periodswere tested which gave similar results, the cost however did vary which is not a surprise sincethe longer the period is the harder it is to �t the model which can be explained with therelation minx(f1(x) + f2(x)) ≥ minx1 (f1(x1)) +minx2 (f2(x2)). Thus one would expect thecost to increase with a longer period but the trend to stay similar.

21

Page 24: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

De�nition Avr Bear Vol Bear Avr Bull Vol Bull AT Bear AT BullSTP -1.20 20.02 1.14 13.32 6.80 17.88ATP -1.23 18.04 1.79 13.11 11.33 15.88MTP -0.05 16.27 1.31 14.31 7.33 8.50EDTP -2.51 18.53 1.42 14.24 1.27 3.82AEDTP -1.33 16.12 1.84 14.56 2.02 2.56NSTP -0.57 22.46 0.72 13.36 2.58 10.00LTP -1.57 22.61 1.27 12.17 10.83 32.40VTP -0.47 22.41 1.02 10.79 12.71 23.33DTP -2.58 22.91 1.41 12.75 10.80 43.25NLTP -0.95 22.26 0.94 12.73 5.27 16.9

Table 3: Model �tted Bear and Bull markets of the S&P500: 1990-2009

This strengthen our decision of disregarding further investigation of theMTP since it does not capture the bear markets at all according to the av-erage monthly returns. The VTP and the NSTP also have hard time capturingthe bear markets and due to the bad �t of the NSTP further investigation ofit is regarded with fair con�dence. The general trend trough the de�nitions isthat the average returns are between one and two percents, where the directiondepends on the state, and that the monthly volatility is on the interval 5-5.5%in the bear market against 3-3.5% in the bull market. Note that as before thatin none of the de�nitions except VTP a condition is put on the volatility whichsuggests that volatility are higher in a downward trend.

4.1.2 Lead

To be able to predict turning points the information obviously has to give a hintabout the future behavior of the stock returns. To determine how long this leadis we test our model using the whole sample of variables and the whole periodand de�ne the turning points for . We expect the model to give better resultswhen more information is taken into count, so the model should �t better whenthe lead is shorter. The cost for leads up to one year are presented for STP andLTP in 8.

(a) Short Run, STP (b) Long Run, DTP

Figure 7: Di�erent leads for the short and long run.

In the short run, Figure 7(a), the results are as one would expect, the costdoes increase with a longer lead assumed. The encouraging results are that

22

Page 25: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

the cost is not minimized when no lead is expected but when one month leadis assumed, which suggest that the assumption of a leading information seriesholds. The cost is also fairly low up to three month lead which gives somefreedom when making a prediction where couple of possible leads can be tested.After three months the cost jumps up and again after eight so one can see astepwise increasing trend. The lead in the short run will however be assumedto be one month if not stated otherwise throughout the paper. In the long run,Figure 7(b), the trend is not as obvious and perhaps the only thing one can readfrom the results is that the cost is minimized when the lead is assumed to bethree months, which will be assumed as the default lead for the long run hereafter.

4.1.3 Choosing the Sample

Next the optimal sample is found when the model is �tted to the whole period.Here we both investigate how the �t changes with the size of the sample usedand which variables are in the optimal samples. From above we see that thecost is minimized when the lead is assumed to be one month in the short runcase and one quarter in the long run, we therefore assume those leads in theestimations below.

(a) Short Run, STP (b) Long Run, DTP

Figure 8: Di�erent sample sizes for the short and long run.

Size Short Run, STP Long Run, LTP1 X6 X72 X6 and X8 X1 and X33 X4, X5 and X6 X1, X3 and X74 X1, X5, X6 and X7 X1, X2, X3 and X75 X1, X5, X6, X7 and X8 X1, X2, X3, X6 and X76 X1, X2, X3, X6, X7 and X8 X1, X2, X3, X6, X7 and X87 X1, X2, X3, X5, X6, X7 and X8 X1, X2, X3, X5, X6, X7 and X8

Table 4: The Optimal Combinations for Di�erent Sample Sizes

In both cases the cost decreases with the number of variables included, inthe short run however the cost is minimized when a sample of seven variablesis applied. It should though be noted that the cost reduction is fairly small

23

Page 26: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

when a variable is added to a sample of 5 or more variables16. The results forthe short run optimal combinations are kind of mind puzzling and not in linewith our expectations. There the housing starts, X6, are an obvious winnerwhere they are in all samples and the yield curve, X4, is excluded in all but theseven variable sample which is in contradiction to S-S Chen where they werefound to give the best predicting power of a sample of variables, when theyare examined individually. The long run results are in some way similar to theone in the short run, where the general trend is a decreasing cost with largersample. The cost also seems only to decrease slightly with an extra variablewhen the sample consists of 5 or more variables and is again minimized with asample of seven variables where the yield curve is excluded. An optimal sevenvariable sample, opt7, where the yield curve is excluded will therefore also betested in both cases. These results do hint that a �ve variable sample could besu�cient. Keep though in mind that these optimal samples do change over timeand therefore the optimal sample will be applied as well as the whole sample inthe out-sample. The optimal combinations are however extremely fragile givenwhich period the model is �tted to. The explaination of why the yield curve isexcluded could be that a change has been in the smoothing coe�cient for it or aregime shift in the monetary policy over the period. A simple test was done forthe short run by taking the periods 1990 to 1999 and 2000 to 2009 seperately, inboth cases the yield curve proved to be a strong candidate where it was includedin most of the optimal combinations. The cost did also decrease continuouslyfor every added variable the prediction presented will therefore be given takingthe whole sample.

4.1.4 The Transition Probabilities and the Smoothing Parameters

Here we show the smoothing parameters when they are estimated using thewhole periods as an estimation sample. The problem is that the estimatedvalues change depending on the period used for estimation so the analysis herebelow is not �nal. As concluded above, the cost is not minimized when allvariables are taken into the prediction but when the Yield Curve is excluded soan analysis of the coe�cients for the optimal sample is also presented

Parameter STP STP, opt7 DTP DTP, opt7p00 0.7469 0.7780 0.9815 0.9787p11 0.8512 0.9799 0.7346 0.9252λ1 0.0432 0.1703 0.1626 0.2325λ2 0.1488 0.1237 0.2654 0.1612λ3 0.0556 0.0556 0.0556 0.0501λ4 0.1118 *** 0.0556 ***λ5 0.6399 0.0514 0.6605 0.118λ6 0.1749 0.1644 0.1667 0.1680λ7 0.0501 0.0432 0.0514 0.0556λ8 0.1584 0.1310 0.0556 0.5562

Table 5: Optimization Parameter Analysis

16Here no penalty is given for the size of the function, which perhaps should be considered.

24

Page 27: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

From the smoothing parameters one can conclude how long a change has tobe to a�ect the state, where a lower smoothing parameter indicates that only along lasting trend change in the time series a�ects the state, i.e. if the coe�cientis 0.0432 a 4.32% weight is put on the current value. To put things in perspectiveit should be noted that the EWMA smoothing coe�cients corresponds to a nstep simple moving average where the relationship between the length n and thesmoothing constant a is a = 2

n+1 ; so the smaller a is, the longer period is takeninto count in the smoothing process. The long run results are therefore in morecontexts to our expectations since the stock market should take in informationrather quickly, the results however do suggest that our model does need somesmoothing to be considered. From the transition probabilities the expected timefor each state can now be calculated using equation (6).

Time STP STP, opt7 DTP DTP, opt7Model expected time in Bear 4.0 4.5 54.1 46.9Model expected time in Bull 6.7 49.8 3.8 13.3Real average time in Bear 5.6 *** 13.0 ***Real average time in Bull 10.1 *** 43.8 ***

Table 6: Calculated Expected Time vs Historical Average Time

As mentioned, these calculated expected times do not give a clear picture sinceare not in a general Markov chain framework but in a HMM. That is indeed thecase the only estimated time that gives some evidence is the estimated time forthe STP.

4.1.5 Di�erent Estimation Periods

In the above examples the whole period has been taken into count, one couldargue that taking the initial in-sample (up to 2002) would be more coherentexample but since the in-sample will expand and the question can be raisedabout which in-sample should be taken we take the whole period. Similar ex-ercise was however carried out for the initial in-sample, from 1990 to 2002. Itgave almost identical solutions in the de�nition comparison, only with lowercost (see footnote). The lead comparison did however not give any concreteresults where the cost started to increase as above but then decreased again.Finally the sample comparison was in line with the results above, i.e. the costdecreased with the size of the sample. The optimal combination in each size didhowever change which leads to that the predicting power of the macroeconomicvariables is unstable.

4.1.6 The length of the in-sample

Until now the in-sample has been taken as large as possible, i.e. taken allavailable information. This might however be misleading because the behaviorof the stock market cycle is perhaps better described or predicted taking e.g. thelast 5 years. So instead of holding the starting date of the in-sample constantat 1990 we let the length of it be constant and investigate how the cost changeswith the size of it. A running in-sample of di�erent lengths is applied and usedin out-sample prediction. In short the results are, perhaps not surprisingly, that

25

Page 28: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

the pest prediction is obtained when as much information possible is taken intothe estimation, i.e. when the in-sample is always taken from the starting date,January 1990. There is however, no trend in the cost reduction given with alarger in-sample and that might be explained by the fact that the business cycleis cyclical.

4.2 Out-Sample Results

4.2.1 Short Run

We start o� as in the in-sample by comparing the de�nitions but now we haveexcluded some of them and added other variation of lead and samples found inthe with in-sample testing, see Figure 9.

Figure 9: Out-Sample De�nition Comparison

As before the cost is not considered su�cient and the statistical table isrevisited but now for the predicted states over the out-sample period.

De�nition Avr Bear Vol Bear Avr Bull Vol Bull AT Bear AT BullSTP -1.18 24.25 0.80 12.35 4.88 5.78ATP -0.48 21.87 0.45 12.30 3.78 3.23LTP -0.055 25.87 -0.047 14.26 2.78 7.33DTP -2.13 29.12 0.54 14.16 2.5 8.88VTP -0.35 22.65 0.23 12.59 4.40 5.22

Table 7: Predicted Bear and Bull markets of the S&P500: 2002-2009

The initial de�nition of a turning point with the time period set as one clearlygives the better results than ATP, below the prediction states are presentedgraphically for STP as well as the probability that the model returns.

26

Page 29: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Figure 10: Out-Sample Turning Points

Figure 11: Out-Sample Probabilities

The model signals clusters of turning points in the beginning of the bullmarket in 2003 and in the middle of the bull market throughout 2005. Thecluster that is signaled in the W shaped recovery in 2003 might be caused byuncertainty in economy that re�ects in the model. Where the uncertainty ofthe economy was caused by the few things e.g. The aftermath of the Enroncase which ended with the Sarbanes-Oxley act17 in July 2002 that a�ected the�nancial statements over the next periods and thus the expected revenues. Theinvasion in Iraq which led to increased uncertainty in the US economy and oilprices. The aftershock of the IT bubble in the labor market, where the volatility

17Accounting Law in USA enacted in July 30, 2002.

27

Page 30: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

in the monthly employment was exceptionally high around 2003. Finally onecan look at the expansionary Monetary Policy in the US where interest ratewas set at historical low level for a long period. In 2005 we have a hidden bullmarket, where the market is in a slow uptrend while the de�nition is stuck ina bear market. This might explain the problem that the model has, where themodels signals a bull market in 7 out of 10 months of the hidden bull market. Ifone would count these signals as right ones, as they surely are, the ECE woulddrop from 0.4066 to 0.3297. This struggle could also indicate that a third stateshould be considered since the market almost moves sideways throughout thecluster.

A part from the struggles the prediction is good. It does get the right signalafter the clusters and more importantly it does signal a bear market in thebeginning of the �nancial crisis in 2007, where the signal is given in October2007 with 99% probabilities. Although the model does miss the short time bullmarket in the beginning of 2008 one might look at that as insigni�cant since itis followed by a massive bear market. The signal for the bull market is, like in2003 a bit too late, where a bull market is �rst signaled in July 2009 with theprobability of 0.7267. A W-shaped recovery like in 2003 is therefore not out ofthe question but at least the signal indicates that a bottom has been reached.The model does however also predict a bull market in August with roughly 94%chance (which was correct since the return for August was around 1.86%) andthat does strenghteh the probability of that the market has turned.

Figure 12: Out-Sample Turning Points

28

Page 31: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Figure 13: Out-Sample Turning Points

Again the model returns a cluster of signals around the turning point in 2003which might be caused by the above mentioned events that shocked the market.Now on the other hand the model does not get into trouble in 2005, perhapsbecause the DTP de�nition does not de�ne the hidden bull market. Here themodel does on the other hand give misleading signals in the 2007 crisis; the leadassumed here is however three months which gives the user time to reconsider.For example a signal could not be taken seriously except if it does hold for atleast two months. When looked into the future the model does give extremelyhigh possibility for a continuing bull market, with probabilities close to 100

4.3 Buy or Sell

We don't get paid in probabilities so we would like to value our predictionsomehow. Three simple investment strategies are proposed:

1. A passive strategy, where stocks are hold when the model signals a bullmarket and bonds are hold when a bear market is signaled.

2. An aggressive strategy, where investor buys stocks during bull marketsand shorts during bear markets.

3. A probability approach, where the investor buys stocks if the probabilityof bear market are less than 0.3, shorts stocks when the probabilities areabove 0.7. If the probabilities are there between the investor buys butholds bonds when the model returns a probability there between.

The return from the bond is calculated using the 3 month Treasury Bill, wherethe given yearly return from the data series, y, is transformed into monthly rateusing (1 + y)

112 . To keep things simple all transaction costs are also excluded,

which might skews our results if the transactions between states are frequent.

The metholigy is simple, 100$ are invested in each strategy at the start of2002 which are followed throughout the out sample period or up to July 2009.

29

Page 32: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

The value of the initial investment is plotted in Figure 14 and the value at theend of the period is given in Table 8.

(a) Short Run, STP

(b) Long Run, DTP

Figure 14: Strategies based on prediction vs. buy and hold.

Strategy Str1 Str2 Str3 Bond StockShort Strategy 157.33 220.30 178.53 119.44 86.98Long Strategy 143.53 204.99 190.88 119.44 86.98

Table 8: Values of di�erent strategies for the short and long run.

All strategies that base their decision on the prediction of the model do beatthe buy and hold strategies. The short run strategies do return higher pro�tfor strategies 1 and 2 while it does not cut out as many bad periods based onprobability which leads to higher value of strategy 3 in the long run. The longrun strategies are also signi�cantly better than the buy and hold portfolio ofbonds from late 2003 and from middle of 2002 for the stock portfolio. The shortrun strategies do on the other hand not beat the buy and hold continuously, the

30

Page 33: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

bond portfolio gives a better or similar return up until the beginning of 2006.The stock portfolio does even give more revenues than strategy three for a longperiod, thus one should avoid investing in the market based on strategy twofor the short run estimated model. Strategies one and two do however bring inmore, or as much, money as the stock portfolio over the whole period.

4.3.1 Di�erent Cost Function

Since the model is used in an investment strategy to pro�t from the market thecost function could be tailored made to that. Recall that the cost function ismade of two parts, MSE and ECE, where MSE (see eq16) can be looked at ashow right we are and ECE, see eq 17, is a measure on how often we are right.Now instead of minimizing the cost of missing a turning point, ECE, the focuswill be set on capturing the degree of the movement within the states with aperformance estimator,

PE =‖ 1tr0∗∑i

r0i +1tr1∗∑i

r1i − 1 ‖ . (33)

Where trj is the total return over state j and rji is the return at time i where themodel predicts state j for j = 0, 1. Similar to MSE and ECE the performanceestimator, PE, returns a number from 0-1 that indicates how much of the move-ment in stock returns the prediction captures, where 0 is optimal and is given ifall movements are captured. This change of cost function does however not im-prove our results in the short run, where the ECE and the investment strategiesare worse o� (the MSE is however slightly better). In the long run the cost doeshowever decrease signi�cantly while the investment strategies, that the aim wasto improve, do not give a higher return.

4.3.2 Available Information

When applying the model one should take into consideration when the informa-tion is available. Three of the variables in the sample are not available in the�rst week of the month, namely X3, X6 and X7 which makes it impossible toapply them if one is relying on one month lead, as for the STP prediction, toinvest in the market. One therefore needs to either apply the sample with a twomonth lead or to apply a sample of the fast available variables. This exercisedoes however not give impressive results, it should though be noted that assum-ing two month lead does give fairly good results while the sample stripped of X3,X6 and X7 does give bad results. That indicates that the variables excluded arenecessary which is in line with the results from the sample combinations foundin Table 4.

5 Conclusion

The paper investigated if general trends or turning points in the stock marketcan be predicted using macroeconomic variables. Several de�nitions of turningpoints were given and tested on the model where the STP de�nition gave best re-sults in the short run and the DTP in the long run. A sample of macroeconomicvariables where assumed to lead the market where the optimal lead was found

31

Page 34: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

to be one month in the short run and three months in the long run. Assumingthe optimal leads even gave better results than taking no lead at all when themodel was �tted to the whole period, 1990 � 2009. The optimal sample used to�t the model did decrease with size. Signi�cantly at �rst but when the samplereached the size of �ve or more variables the cost reduction of was little or none.Constructing an optimal sample did however not give a concrete solution wherethe optimal combination of di�erent sizes was extremely unstable over time.

As mentioned, a larger sample of variables did improve our results and thatare clearly the results when a prediction is made with only a single variable andthe historical stock returns. To be able to apply the model in higher dimensionsa suitable optimization, DIRECT, is introduced. The prediction made with thewhole sample did show some promising results and both in the short and thelong run a bear market was signal for the current crisis. In both cases the sig-nal of a bull market has also been given which might indicates that the worstis over. Both the long and the short run did however have some di�cultiesidentifying the W-shaped recovery in 2003. That could be explained by theextreme uncertainty in the US market at the time. The short run predictiondoes also cluster around 2005 which might indicate that a third state, sidewaymarket, should be introduced. The hidden bull market in 2005 might thoughbe a better explanation since the long run prediction is free from a heavy sig-nal cluster. The prediction is however fairly right when the trend is strong fora period of time and any signal might therefore indicate turbulence in the trend.

Three naive investment strategies that rely on the prediction were also sug-gested and in all cases they did beat the simple buy-and-hold strategies for bothbonds and stocks. That does strengthen the evidence that the model does givereliable prediction, at least up to some extent.

6 Further Studies

Here we present couple of suggested further investigation, we sill only dip ourtoes a bit in the water and will not go into any details.

6.1 Other Time Series

Applying this model to other time series, e.g. housing prices, interest rate or ex-change rate, and predict turning points in them using macroeconomic variableswould be interesting. It is also a bit closer to the economic theory, i.e. thatpresent macroeconomic variables do a�ect future value of, for example, housingprices.

6.2 Behavior Over Time

As mentioned in 4.1.5 the optimal prediction sample of macroeconomic variablesis not stable over time. An interesting topic would be to investigate how thepredicting power of the variables changes and what it is that drives the predict-ing power. One could even try to take this further and optimized a predicting

32

Page 35: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

sample to use depending on the economic or �nancial status, e.g. volatility,trends, volume of trades, business cycle, etc.

33

Page 36: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

References

[1] Andersson, E., Bock,D. and Frisén,M. (2006): "Some Statistical Aspectsof Methods for Detection of Turning Points in Business Cycles", Journal ofApplied Statistics, 33, 257-278.

[2] Boström, J. (2009): "Forecasting Stock Market Return based on Macroe-conomic Variables".

[3] Chen, SS. (2009): "Predicting the bear stock market: Macroeconmomicvariables as leading indicators", Journal of Banking & Finance, 33, 211-223.

[4] Fama, Eugene F. (1970): "E�cient Capital Markets: A Review of Theoryand Emperical Work", Journal of Finance, 25, 383-417.

[5] Hamilton,J.D. (1989): "A new Approach to the Economic Analysis of Non-stationary Time Series and the Business Cycle", Econometria, 57, 357-384.

[6] Hamilton J.D. (1994): "Time Series Analysis", Princton, New Jersey,Princeton University Press.

[7] Hamilton, J.D., and Susmel, R. (1994); "Autoregressive conditional het-eroskedasticity and changes in regime", Journal of Economics, 64, 307-333.

[8] Jones, D.R., Perttunen, C.D., Stuckman, B.E. (1993): "Lipschitzian Opti-mization without the Lipschitz Constant", Journal of Optimization Theoryand Application, 79, 157-181.

[9] Ivanov, D., Lahiri, K., and Seitz, F. (2000): "Interest rate spreads as pre-dictors of German in�ation and business cycle", International Journal ofForecasting, 19, 39-58.

[10] Kim, CJ., and Nelson, C.R. (1999): "State-Space Models with RegimeSwitching", Cambridge, Massachutes, The MIT press.

[11] Knif,J., Kolari,J. and Pynnönen,S.(2005): "What drives correlation be-tween stock market returns? International Evidence"

[12] Koskinen, L. and Öller, LE. (2004): "A Classifying Procedure for SignalingTurning Points", Journal of Forecasting, 23, 197-214.

[13] Maheu, J.M. and McCurdy, T.H. (2000): "Identifying Bull and Bear Mar-kets in Stock Returns", Journal of Business & Economic Statistics, 18�100-112.

[14] Neftci, S.N. (1982): "Optimal Prediction of Cyclical Downturns", Journalof Economic Dynamics and Control, 4, 225-241.

[15] Norris, J.R. (1997): "Markov Chains", New York, New York, CambridgeUniversity Press.

[16] Piger, J. (2007): "Econometrics: Models of Regime Changes", preparedfor: Springer Encyclopedia of Complexity and System Science.

34

Page 37: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

[17] shu] Shubert,B.O. (1972) : "A Sequential Method Seeking the Global Max-imum of a Function", SIAM Journal on Numerical Analysis, Vol.9,No.3,379-388.

[18] Trujillo-Ortiz, A., R. Hernandez-Walls, K. Barba-Rojo andL. Cupul-Magana (2007). HZmvntest:Henze-Zirkler's Multivari-ate Normality Test. A MATLAB �le. [WWW document]. URLhttp://www.mathworks.com/matlabcentral/�leexchange/loadFile.do?objectId=17931

[19] www.investopedia.com

[20] www.stockcharts.com

35

Page 38: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

A Additional Derivations

A.1 Baye's Theorem

The Baye's Theorem used in the algorithm is a bit di�erent from the usual onebecause of the state dependence of the density of Xt and the fact that the stateis hidden and we wish to derive it18. The joint density function of Xt and St isgiven by:

f(Xt, St+l|Xt−1) = f(Xt|St+l, Xt−1) ∗ P (St+l|Xt−1)

where Xt−1 is the information up to time t-1. Because the state is hidden andthe density of Xt depends in it, the density function is de�ned by summing overall possible values of St+l19

f(Xt|Xt−1) =1∑i=0

f(Xt|St+l = i) ∗ P (St+l = i|Xt−1).

The joint density can also be de�ned as 20:

f(Xt, St+l|Xt−1) = f(Xt|Xt−1) ∗ P (St+l|Xt).

Now the version of Baye's Theorem used in step 2 in the recursive algorithmcan be obtained by putting the de�nitions of the joint distribution together:

P (St+l = j|Xt) =f(Xt|St+l = j) ∗ P (St+l = j|Xt−1)∑1i=0 f(Xt|St+l = i) ∗ P (St+l = i|Xt−1)

.

A.2 Adding Serial Correlation

When the stock market cycle is assumed to follow an AR(1), see equation (32),the density function and the algorithm would has to be adjusted accordingly.We still have the normal density function but now it depends both on two states,St+l and St+l−1. Let Ztij

= (Xt − µj − φ(Xt−1 − µi) then

f(Xt|St+l = j, St+l−1 = i) = fji(Xt) =1

(2 ∗ π)n2 ∗ |σj |

12∗ exp(−1

2∗ (Ztij

)′ ∗ σ−1j ∗ Ztij

(34)

and equation (12) now becomes:

P (St+l = j|Xt) =p0j ∗ p0(t+ l − 1) ∗ fj0(Xt) + p1j ∗ p1(t+ l − 1)) ∗ fj1(Xt∑1i=0((p0i ∗ p0(t+ l − 1) ∗ fj0(Xt) + p1i ∗ p1(t+ l − 1) ∗ fj1(Xt)

. (35)

18A deravation can also be found in Hamilton (1994), p.69319Kim and Nelson, p.60-6120Kim and Nelson, p.172

36

Page 39: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

B Other Markets

Although that the focus is on the U.S. market other markets are of course ofour interest, it would therefore be really convenient if other markets and theU.S. market would turn simultaneously. In �gure 15 the STP turning pointsof di�erent markets are plotted, where the indices are assumed to re�ect thecorresponding market and just by observation we see that the indices turn at asimilar time.

Figure 15: Turning Points in More Markets

Although graphical evidence is nice the correlation between stock marketshas been investigated in more depths. These studies conclude that stock mar-kets are correlated and further more that the correlation is unstable over time,where it tends to be stronger during high volatility periods or bear markets.It is therefore not a ridiculous idea to investigate if turning points can be pre-dicted or the macroeconomic sample improved using other stock market returns.

We start of by analyzing the cost from the turning point prediction whenuse only the market returns as the predicting variable sample. Where as in theUSA market an index is assumed to re�ect the stock market in the correspondingcountry, Nikkei in Japan, FTSE in UK, SIX in Sweden and STOXX in the EuroZone.

37

Page 40: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Figure 16: Turning Points in More Markets

The results are no surprising, the prediction gave best results in the Swedishmarket which is the smallest and might therefore lag or depend more on theothers. The Japanese market on the other hand gives the poorest results whilethe USA, UK and Euro Zone give a fairly similar cost. It is also obvious thatthe macroeconomic sample did give a better prediction based on the cost, thestock market returns might though improve the sample and the results for theSwedish market results encourage us to take the analysis further.

First the e�ect on adding the stock market data to the macroeconomic sam-ple is examined, where the naive trial and error approach is still applied. Themarket return series are added to optimal sets that contain 5 or more variablesobtained above. For the samples with six variables or more the cost can bereduced by adding the Euro Zone market series to the sample. The minimumcost is reach when the Euro Zone market is added to the optimal seven variablesample, which was the optimal sample, and the total cost is 0.0945. This showsthat our sample is not �nal and adding variables to it can improve our results.Again we examine the out run taking the whole sample and the optimal samplebut know we add the Euro Zone market series to both samples, as above theresults are slightly better taking the whole sample.

38

Page 41: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Figure 17: Out-Sample prediction in USA using Euro Zone plus macro sample.

The results are similar to what obtained before where the clusters still showup in 2003 and 2005 and a bear market is signaled for the 2007 crisis (althoughhere with a strange bull market lasting one month after the signal). Here themodel does not predict until in August 2009 with 87% chance which is monthlater than before. The investment strategies all give worse return, they do how-ever all still beat holding bonds or stocks over the period and when looking overthe whole period they perform better in the beginning since the 2003 turningpoint is captured better.

Before we dig our teeth into the out-sample analysis we check is a bettercombination of the markets can be obtained to use as a predicting sample forthe Swedish market. The method is of a no surprise, we still apply the simpletrial and error method, after all lengths and combinations have been checkedwe �nd out that the cost can not been reduced by excluding a market returnseries. The only remarkable conclusions from this experiment is that the marketthat proves to be in most of the optimal combinations, a part from the Swedishseries itself, is in most cases the Euro Zone market and that the cost reduceswith the length of the prediction sample.

39

Page 42: Predicting Turning Points300208/FULLTEXT01.pdf · i.e. the stock market cycle can be divided in distinct phases of di erent behavior. The stock market cycle, like the business cycle,

Figure 18: Out-Sample prediction in Sweden using other markets.

In the Swedish case the bear markets are always extremely short and thebiggest drawback in the prediction is the long delay for a warning for the 2007crash. The start of the bull markets are though always fairly right (when it isnot followed by a bear market signal shortly after) which may indicate that the2007 bear market did end in the beginning of 2009. Although the bear marketsseem to be hard to capture in this example the investment strategies all giveexceptionally good results.

40