Emilios C Galariotis
email: egalariotis@audencia.com

Professor Phil Holmes

Vasileios Kallinterakis
email: v.kallinterakis@liverpool.ac.uk

Xiaodong S Ma

MARKET STATES, EXPECTATIONS, SENTIMENT AND MOMENTUM: HOW NAIVE ARE INVESTORS?

Keywords: JEL Classification: G1 (G10, G14) Momentum, futures, expectations, sentiment, market states

Following Cooper et al (CGH) 2004 we test whether market states are relevant for predicting UK momentum profits. However, rather than simply categorising up/down markets based on actual prices as CGH, we suggest investors may view expectations and/or sentiment as important. Contrary to the findings for the US, we find that momentum returns are not related to CGH-defined market states. Similar findings hold for an expectations-based split. In contrast, for the whole sample period, construction and retail sentiment indicators explain differences in momentum profits. However, robustness tests suggest their explanatory power is driven by the post-subprime crisis period.

INTRODUCTION

Following the seminal work of Jegadeesh and Titman (henceforth JT) (1993), considerable attention has been devoted both to the identification of momentum profits and to explanations as to why such profits may exist. JT (1993) demonstrate that stock returns exhibit momentum over medium horizons, such that a zero investment strategy involving shorting past recent (six-month) losers and buying past recent (six-month) winners generates excess returns of the order of 1% per month in the following sixmonth period. Subsequent work has demonstrated similar findings over a range of markets, with extensive evidence of momentum over short-to-medium horizons, ranging from 3 to 12 months. 1 The evidence suggests that momentum abnormal returns are now a stylized fact and cannot be attributed to data mining. As a result, several papers have sought to explain the existence of momentum returns either arguing that such returns are a compensation for risk (see, for example, [START_REF] Conrad | An anatomy of trading strategies[END_REF] or by using a behavioural model based on inherent biases on the part of some investors (see, for example, [START_REF] Daniel | Investor psychology and security market under-and overreactions[END_REF][START_REF] Barberis | A model of investor sentiment[END_REF][START_REF] Hong | A unified theory of underreaction, momentum trading and overreaction in asset markets[END_REF].

In this paper we concentrate on the behavioural approach to explaining momentum profits, since recent evidence is more consistent with this view (see for example JT, 2001;[START_REF] Hvidkjaer | A Trade-Based Analysis of Momentum[END_REF][START_REF] Asem | Dividends and price momentum[END_REF][START_REF] Chui | Individualism and momentum around the world[END_REF] and in particular on one important aspect of the recent literature which argues that momentum profits are related to the prior state of the market. Specifically, consideration will be given to the approach adopted by Cooper et al (2004, hereafter CGH), which examines whether the profitability of momentum strategies differs depending on whether the market as a 1 For example, [START_REF] Rouwenhorst | International Momentum Strategies[END_REF] finds similar results to JT (1993) for 12 European countries over the period 1980 to 1995; [START_REF] Hart | Stock selection strategies in emerging markets[END_REF] find similar results to JT in examining 32 emerging markets; [START_REF] Griffin | Momentum investing and business cycle risk: evidence from pole to pole[END_REF] examine 40 markets including the US and find that macroeconomic risks do not explain findings; [START_REF] Galariotis | Contrarian and momentum profitability revisited for the London Stock Exchange over 1964 to 2005[END_REF] find similar evidence for the UK stock market; [START_REF] Chui | Individualism and momentum around the world[END_REF] consider the role of cross cultural differences in momentum profits and find momentum profits in 37 of the 41 countries included in their sample; [START_REF] Gupta | International comparison of returns from conventional, industrial and 52-week high momentum strategies[END_REF] using data for 51 countries and including more than 51,000 stocks find momentum profits using the conventional momentum strategy and using industrial and 52-week high momentum strategies; and [START_REF] Badreddine | The relevance of information and trading costs in explaining momentum profits: Evidence from optioned and nonoptioned stocks[END_REF] find that while transactions costs are important, once these are taken into account even for (highly liquid) UK optioned stocks, momentum profits persist for some strategies.

whole was 'up' or 'down' in the period prior to the momentum portfolio holding period.

However, unlike CGH, we not only examine the extent to which momentum profits are affected by whether the market has gone up or down, but also whether it has gone up or down relative to expectations. In addition, contrary to the CGH arguments that momentum performance is conditional only on past market states, we further test whether investor sentiment is relevant by using a range of sentiment measures. Given the arguments that sentiment is highly relevant in financial markets (see, for example, [START_REF] Shleifer | The Noise Trader Approach to Finance[END_REF][START_REF] Barberis | A model of investor sentiment[END_REF][START_REF] Barber | Do retail trades move markets?[END_REF] this is an important consideration for this most robust of anomalies.

CGH draw on the behavioural theories of [START_REF] Daniel | Investor psychology and security market under-and overreactions[END_REF] and [START_REF] Hong | A unified theory of underreaction, momentum trading and overreaction in asset markets[END_REF] to argue that there will be greater short-run momentum following market increases than following market decreases. The empirical evidence presented by CGH supports their argument, with short-run momentum profits exclusively following up-markets over the period 1929-1995 for the US market. 2 Thus they argue "consistent with [START_REF] Daniel | Investor psychology and security market under-and overreactions[END_REF] and [START_REF] Hong | A unified theory of underreaction, momentum trading and overreaction in asset markets[END_REF], the state of the market is critically important to the profitability of momentum strategies" (CGH, 2004. More specifically, they argue that as in [START_REF] Daniel | Investor psychology and security market under-and overreactions[END_REF], aggregate overconfidence will be greater following an upmarket, and that if, as supported by [START_REF] Hong | A unified theory of underreaction, momentum trading and overreaction in asset markets[END_REF], decreasing risk aversion leads to greater momentum profits, then, if risk aversion and wealth are inversely related, momentum profits will be higher following an up-market than following a downmarket. The state of the market has also been shown to be of importance in other areas. For example, [START_REF] Rosen | Merger Momentum and Investor Sentiment: The Stock Market Reaction to Merger Announcements[END_REF] argues that investors may be overly optimistic in 'hot markets'. He provides evidence of merger momentum and shows that bidder stock prices have a greater tendency to increase when the stock market is doing better: "mergers announced during hot stock markets tend to get a better reaction from the 2 Results are presented for mean returns, a CAPM model and a Fama-French 3 factor (FF3F) model. The main results presented in the paper are based on the state of the market in the three-year period prior to holding the momentum portfolio. They also present results based on the state of the market over a oneyear and a two-year period prior to holding the portfolio. The only case where there is evidence of momentum profits during a down-market is for the FF3F model using the one-year definition of the state of the market. market than those announced in a cold market" [START_REF] Rosen | Merger Momentum and Investor Sentiment: The Stock Market Reaction to Merger Announcements[END_REF]. Similarly, there is evidence of over-optimism in hot IPO markets (see, for example, [START_REF] Helwege | Is there a pecking order? Evidence from a panel of IPO firms[END_REF] and [START_REF] Holmes | Herding in a Concentrated Market: a Question of Intent[END_REF] find that herding is more evident during periods when returns are low, compared to periods when returns are high. Thus, there is considerable evidence to support the view that the recent performance of the market affects the magnitude (or, indeed, existence) of profits in relation to various market phenomena. In light of this, the extent to which momentum profits are affected by market states is clearly worthy of investigation in a market other than the US. In this paper we examine the issue for the UK market.3 However, the CGH classification of the previous market state as either an 'up-market' or a 'down-market' may not be the most appropriate method by which to analyse the issue of the impact of aggregate market overconfidence. The approach taken by CGH only compares the actual market price at the beginning of the holding period, time t, with the actual market price at an earlier date, t-i, where i takes on the value of 12, 24 or 36 months. If the market price at time t (MP t ) is greater than MP t-i , then the market is said to be up. In contrast, if MP t is less than MP t-i then the market is said to be down. 4 However, expectations and anchoring play an important role in finance and, particularly, in the behavioural finance literature. 5In a market in which investors are rewarded for risk-taking (whatever the return generating process) the expectation at time t-i is that MP t will be greater than MP t-i , i.e. by investing in a risky portfolio a positive return will be earned. 6 Despite this, expectations have no role in the CGH approach: they simply compare actual prices at two points in time. Rather than comparing the actual market price at two points of time, from both a rational and a behavioural perspective it is more relevant to compare the actual market price at the beginning of the holding period, t, with the expectation at time t-i of what the market price will be at time t.

This view is consistent with the notion of disappointment aversion as proposed by [START_REF] Gul | A theory of disappointment aversion[END_REF]. Disappointment aversion is based on the idea that individuals have a reference point which evolves endogenously. As [START_REF] Fielding | Myopic loss aversion, disappointment aversion, and the equity premium puzzle[END_REF] state "Reflecting the idea that pain is more urgent than pleasure, the disappointment related to outcomes below expectations is assumed (and normally found) to be stronger than the elation related to outcomes exceeding expectations." (p251, emphasis added). 7 If expectations are important, then a comparison should be made between MP t and E(MP t,t-i ), where the latter is the value that the market price is expected to have at time t, with the expectation formed at time t-i. To illustrate why this distinction might be important, consider the following situation:

E(MP t,t-i ) > MP t > MP t-i (1)
Here the price at the beginning of the holding period is greater than the actual price at time t-i, but is less than the value expected at time t-i for MP at time t. In these circumstances, investors may view the market as being 'down' (relative to expectations) even though the price of the market has risen over the period t-i to t. Consequently, to the extent that the prior market state and associated aggregate market confidence affects momentum profits as suggested by CGH, it is possible that the up/down split they use may not be accurately capturing investors' perceptions of the market state. A priori it is not possible to determine whether changes in actual prices or deviations from expectations are more important. It is possible that investors are relatively naïve and that the comparison of actual prices at times t and t-i may be more important than the comparison of MP t and E(MP t,t-i ). However, it is equally the case that trading strategies may be based more on variations from expectations, in which case a comparison of the actual and expected prices would be more relevant. Ultimately, it is an empirical issue as to which, if any, comparison is more relevant, one of the central issues that this paper seeks to address.

In addition to the specific case of expected future values being of potential importance, it is also possible that more general measures of investor sentiment might impact on momentum profits. We, therefore, examine the relationship between sentiment and momentum profits in the UK market as a second central issue in the paper, using a range of sentiment measures. 8 It is, of course, difficult to measure market expectations and levels of overconfidence or sentiment for all values of t. In this paper we employ different approaches for determining aggregate expectations and market sentiment.

First, we use a direct measure of market expectations, in the form of stock index futures prices. The price of a stock index future at time t-i provides a means by which a market determined expectation can be established for specific values of the index at time t.

Thus, the futures price provides a direct measure of E(MP t,t-i ). The second approach does not provide us with a direct measure of E(MP t,t-i ), but rather seeks to measure changes in market sentiment at different points in time, since investors seem to believe in sentiment [START_REF] Brown | Investor sentiment and the near-term stock market[END_REF] and sentiment is relevant to a range of other issues in financial markets (for example: asset pricing [START_REF] Baker | Investor Sentiment and the Cross-Section of Stock Returns[END_REF]; the value effect [START_REF] Frazzini | Dumb money: Mutual fund flows and the cross section of stock returns[END_REF]; feedback trading [START_REF] Chau | Investor Sentiment and Feedback Trading: Evidence from the Exchange-Traded Fund Markets[END_REF]; herding [START_REF] Blasco | Market sentiment: a key factor of investors' imitative behaviour[END_REF][START_REF] Philippas | Herding behavior in REITs: Novel tests and the role of financial crisis[END_REF]; stock returns [START_REF] Spyrou | Sentiment changes, stock returns and volatility: evidence from NYSE, AMEX and NASDAQ stocks[END_REF]; volatility [START_REF] Sayim | The effect of US individual investor sentiment on industry-specific stock returns and volatility[END_REF]; and bond yields [START_REF] Nayak | Investor Sentiment and Corporate Bond Yield Spreads[END_REF]). Specifically, we utilise a range of data from the OECD and the European Commission's Directorate General for Economic and Financial Affairs (DGEFA) resulting from business and consumer surveys which are designed to elicit judgements and expectations about the state of the economy. 9 We are then able to obtain measures of changes in these indicators from time t-i to t. By utilising both futures data and confidence indicators, we are able to examine the role of aggregate expectations and (over)confidence and thus to answer the question of whether investors are naïve in relation to the impact of market states in explaining momentum profits. In other words we test whether the lagged market return is the only relevant type of conditioning information that is necessary for predicting momentum portfolio performance, as CGH claim; or whether expectations and sentiment are also important.

It is, of course, the case that stock index futures prices are not available for long periods ahead (say the one, two or three years used by CGH). However, they are available typically for periods up to 8 months prior to maturity. 10 It should be noted that the choice of period over which to examine market states is arbitrary, as CGH recognise. From a theoretical perspective, there is no reason to believe that 3 years is more relevant than say 6 months, in terms of capturing the state of the market.11 Indeed, there are strong arguments for suggesting that shorter horizons are more appropriate. For example, [START_REF] Benartzi | Myopic Loss Aversion and the Equity Premium Puzzle[END_REF] argue that myopic loss aversion can play a central role in explaining the equity premium puzzle, arguing that agency problems make it likely that even pension funds and endowment funds will be characterised by myopia.

Furthermore, [START_REF] Haigh | Do Professional Traders Exhibit Myopic Loss Aversion? An Experimental Analysis[END_REF] find that traders from the Chicago Board of Trade exhibit behaviour consistent with myopic loss aversion; [START_REF] Froot | Herd on the street: Informational inefficiencies in a market with short-term speculation[END_REF] demonstrate the impact of short-horizon speculators on informational inefficiency; and Chang et al results are consistent with loss aversion at both monthly and yearly horizons. In addition, the availability bias, whereby individuals give greater weight to information which most easily comes to mind, is also consistent with shorter investment horizons. 12 Therefore, in investigating the impact of market states on momentum profits, we partition our sample to states by first examining the difference between MP t and MP t-i and between MP t and E(MP t,t-i ) for values of i ranging from 2 to 8 months. 13 We then There is evidence that during crisis periods financial decisions are made differently. For example, according to [START_REF] Anand | Market crashes and institutional trading[END_REF] institutions invest more in stocks that are more liquid and less risky during periods of market stress and [START_REF] Choe | Do foreign investors destabilize stock markets? The Korean experience in 1997[END_REF] find that during the 1997 Asian financial crisis herding and positive-feedback trading by foreign investors fell markedly. However, in contrast, [START_REF] Philippas | Herding behavior in REITs: Novel tests and the role of financial crisis[END_REF] find no impact of the subprime crisis in relation to herding. In order to examine if differences are evident in relation to the issues examined here, we undertake analysis both for a period including the subprime crisis (which began in 2007/8) and a truncated sample period excluding the crisis.

This paper, therefore, makes four contributions to the literature. First it proposes, and utilises, a comparison between the expected and actual market price in examining the 12 See, for example, [START_REF] Massa | Hedging, Familiarity and Portfolio Choice[END_REF] who examine the role of familiarity and find that availability impacts on the investment decisions of some investors. 13 Moreover, these periods for market movements are more in line with the periods used for identifying the individual stocks to be held when forming a momentum portfolio. 14 The economic sentiment indicator provided is a weighted composite indicator comprising the consumer confidence indicator (weight 20%), the retail trade confidence indicator (5%), the construction confidence indicator (5%), the industrial confidence indicator (40%) and the service confidence indicator (30%).

role of the state of the market. Second, it examines the impact of economy wide sentiment on momentum profits. Third, the paper undertakes an out-of-sample test of the role of the state of the market in explaining momentum profits, by analysing the issue for the UK market. Fourth, given our focus on behavioural explanations and in light of established arguments concerning frame dependence, we examine the extent to which the results vary when the subprime crisis period is excluded. The rest of the paper is organised as follows. The next section sets out the data and methodology used. Section 3 presents and discusses the results, which are checked for robustness in section 4. Finally, section 5 provides a summary and conclusion.

DATA AND METHODOLOGY

For the formation of momentum portfolios, we begin by employing all stocks listed on the London Stock Exchange between June 1984 and December 2009. All price data used are taken from DataStream Thomson Reuters. Consistent with previous studies, we exclude all penny shares with a price of less than £1 at the start of the holding period to minimise microstructure effects. We include companies that were delisted during the period so as to avoid survivorship bias and we simulate realistic ex ante scenarios to avoid look-ahead bias. We assume that all companies are active during the holding period until the actual delisting takes place, at which time rebalancing of the portfolio takes place. The total sample of stocks used is 8821 and the average number used each month is 5511. Stocks are sorted at time t based on their returns in the period t-j and split into equally weighted quintiles. We then form a momentum portfolio one month after t, with the portfolio consisting of a long (short) position in the time t-j to t winner (loser) portfolio, i.e. the highest (lowest) quintile, and hold the portfolio for k months. 15 Previous literature typically uses strategies ranging from 3 to 12 months, with most attention focused on 3 and 6 months. We restrict ourselves to two strategies, namely the 3x3 and 6x6 combinations. The first, allows us to examine one of the most profitable strategies in the seminal work of [START_REF] Jegadeesh | Returns to buying winners and selling losers: implications for stock market efficiency[END_REF], and the latter, one of the most typical momentum strategies in the literature as suggested by [START_REF] Galariotis | What should we know about momentum investing? The case of the Australian Security Exchange[END_REF].

For each holding period we calculate raw momentum portfolio returns (R p ) as well as risk adjusted returns considering market risk in the form of the capital asset pricing model (CAPM) and multifactor risk in the form of the Fama and French three-factor model (FF3F henceforth). In the CAPM specification the market factor proxy is based on the value weighted FT All Share Index and the 3-month t-bill rate proxies for the nominal risk free rate. Two additional factors constructed as in [START_REF] Fama | Multifactor Explanations of Asset Pricing anomalies[END_REF] are employed in the multifactor analysis: the return difference between portfolios of small and large capitalisation stocks (SMB); and the return difference between portfolios of high and low book-to-market ratio stocks (HML).

To ensure consistency throughout the sample period, we define the stock index future expiry day as time t and form momentum portfolios one month after the expiry date based on the performance of individual stocks in the period prior to t. To examine the impact of the market state we identify the prior state of the market at the beginning of each portfolio's testing period, based either on actual market prices at times t and t-i or on deviations between the actual market price at time t and its expected time t price, where the expectation was formed at time t-i.

As explained, stock index futures data is used to examine the role of expectations.

Futures on stock indices were introduced in the UK in May 1984 and to allow collection of futures data with a sufficient history prior to expiry of the contract, we begin by having the first holding period commence one month after the expiry of the December 1984 contract. Our futures sample covers the period up to the expiry of the June 2009 contract. There are four contract expiry dates each year (March, June, September and December) and we form non-overlapping portfolios for the 3x3 and 6x6 strategies. We use the FTSE-100 stock index return between times t and t-i to determine the state of the market using actual prices and to examine the impact of expectations we use the difference between the FTSE-100 index price at time t and its futures price at time To examine the role of sentiment changes in explaining momentum profits, we use the OECD and DGEFA data (from DataStream) resulting from business and consumer surveys concerning expectations about the state of the economy. The surveys are used to provide confidence or sentiment indicators on a monthly basis. We use the change in the indicator from time t-i to t to examine the impact of improving or declining confidence (or sentiment) on subsequent momentum profits. Since we focus on expectations and market states, we control for the subprime crisis period, due to its extreme nature and possible impact on results (the rationale is analytically explained in the relevant section).

For robustness we repeat all tests by ending the sample in August 2007.17

RESULTS

The empirical analysis first considers momentum profits in up and down markets based on raw returns. Following down market periods, the returns for momentum strategies in table 1 are positive and even higher than following up market periods. 18 For example, using actual market prices (the CGH basis for the up/down split) up market returns are economically significant and range from 1.91% per month to about 2.23% per month. However, the smallest return for down markets (2.36%) is larger than the highest one for up markets and the returns for down markets go as high as 3.69%. 19 This result is consistent with [START_REF] Griffin | Global Momentum Strategies: A Portfolio Perspective[END_REF] for the US market who use macroeconomic criteria for sample splits.

Results for splits based on expectations (UPE/DOWNE) show a similar pattern to those using the CGH (UP/DOWN) approach, however there are some differences between the two approaches. Specifically, when the median values are used, a pattern emerges for the returns based on expectations, which is not evident when actual prices are used.

In particular, for UPE (DOWNE) markets the portfolio median returns are monotonically decreasing (increasing) as values of i move from 2 to 8 months. More specifically, in the first case they move from 2.39% to 1.90%, while in the latter case they change from 18 CGH attribute losses following down markets to lower overconfidence and higher risk aversion, which is not consistent with the findings here.

2.03% to 2.78%. Nonetheless, overall the results from using expectations are not noticeably different from those using actual prices.

Panel C provides tests of equality of the mean under the assumptions of equal variances. 20 For the 3x3 strategy, in all cases the null hypothesis that the mean profits in UP and DOWN markets are equal is not rejected, which, given the presence of momentum profits in both states, is not surprising. These results are in stark contrast to the findings of CGH, in that there is no evidence that momentum profits vary with the state of the market for the 3x3 strategy. The negative signs in panel C are contrary to expectations and may be the result of extreme market periods having a higher impact than more normal up and down periods. This will be investigated in section 4.

Results for the 6x6 strategy, reported in the third and fourth columns of table 1 are different to those for the 3x3 strategy. More specifically, in both panels A and B mean returns are overall positive but insignificant. 21 Panel C shows that there are very few significant differences: for the split based on MP t-i there is evidence of a significant difference between returns in up and down markets in two cases based on the mean (when the sample split is based on i=4 and 6); when the split is based on expectations, there is only one case where the down market profits are significantly higher than those in the up market state using the mean profits (when the sample split is based on i=4). 22 In contrast to CGH, in all cases of significant differences the returns following down market states are higher than those following up markets.

20

Tests of (i) the equality of mean returns assuming unequal variances and (ii) the equality of median returns, were also undertaken, but are not reported in the interests of brevity. In general, the findings from the three tests are qualitatively similar. Reference will be made in the text where there are qualitative differences. 21 Exceptions in relation to significance relate to when the sample is split based on i=3 for both measures in panel A, and for i=8 for down markets in panel B for the CGH measure. The only negative coefficients are for i=6 in the up market. 22 There are no significant differences in median returns or in mean returns when unequal variances are assumed.

Overall, the findings so far suggest that market states do not seem to have the impact on the performance of momentum portfolios predicted by CGH. Rather, on average momentum strategies are profitable irrespective of state. In this setting, where market states do not matter, the expectations-based (futures prices) approach for splitting up and down markets does not add significant explanatory power to that obtained by the CGH approach. 23 INSERT TABLES 2 AND 3 ABOUT HERE Results for momentum profits based on returns adjusted by the CAPM and the FF3F factors are shown in tables 2 and 3 respectively. The layout of the tables is the same as in table 1. Interestingly, the results in these tables are markedly different from those for raw returns, highlighting the importance of taking account of risk. For the 3x3 strategy, while there were statistically significant momentum profits in table 1 for raw returns, they become insignificant once market (table 2) or FF3F factor adjustments (table 3) are performed for both up and down market states. 24 While in down states there is a negative value (when the sample split is based on i=8) following the adjustments, it is insignificant.

It should be noted, however, that CGH also find no evidence of significant profits at the 5% level for some of their strategies when CAPM and FF3F adjusted returns are used, while they also find that in most cases returns are positive. However, given the results in tables 2 and 3 it is not surprising that in panel C there is no case where the 3x3 strategy mean return is significantly different across market states. It seems again that momentum profits are unrelated to market states irrespective of whether one uses actual prices or the expectations-based measure, once risk is taken into account. Indeed, for the period examined, adjusting for risk leads to a lack of momentum profits following both up and down markets.

23 However, the expectations-based approach remains as an alternative, arguably less naive, method, which may be more applicable in other markets. 24 The only exceptions relate to significance at the 10% level for CAPM adjusted up market returns for i=2, 3 and 8 for the CGH measure and for i=8 for the expectations-based measure. However, not only is the statistical significance low, but economic significance is also low, especially when compared to table 1.

Turning to the 6x6 strategy in the final two columns of table 2, panel A, CAPM adjusted momentum delivers no statistically significant returns irrespective of market states using a measure based on either actual price changes or expectations. The difference here compared to table 1 is that in some cases momentum returns are negative albeit insignificant and in contrast to the arguments of CGH this holds for both the UP/UPE market and the DOWN/DOWNE market states. Looking at the same columns of table 3 however, where results for FF3F adjusted returns are presented, all momentum returns for both measures and states are, contrary to the arguments of CGH, positive and now with more cases that are statistically significant, especially for up markets. The up market results are also very significant economically, ranging from 5.3% to 13.48%. However, as in the case for raw returns, panel C of both tables 2 and 3, and for both the 3x3 and the 6x6 strategy show there are no significant differences in means across market states. 25Taken together, results for tables 1, 2 and 3 demonstrate the importance of how returns are measured (raw, CAPM adjusted or FF3F adjusted) when considering the significance of momentum strategies. However, findings relating to the extent to which market states impact on momentum profits are largely unaffected by the measure of returns, since statistical differences across market states are an exception whichever measure of risk is used.

The results so far show that for raw returns the 3x3 strategy experiences statistically and economically significant returns for both up and down market periods, yet they are marginally higher for down markets. When risk adjustments are made the returns become insignificant, but are higher for up markets rather than down ones. The exact opposite holds for the 6x6 strategy where results are generally insignificant for raw returns, but become significant when multiple contemporaneous risk considerations are taken into account. Given the lack of significant differences across market states the CGH results

and proposition appear to be sample-specific. Furthermore, the differences between splits based on actual prices and expectations are small, suggesting that using a more sophisticated approach based on expectations adds little to our understanding of the impact of market state. However, while up versus down states based on prices (actual or expected) does not reveal differences in momentum profits, measures of sentiment may be important for momentum profits. We now turn to investigate this issue.

INSERT TABLES 4 AND 5 ABOUT HERE Tables 4 and5 exhibit the relationship of momentum profits and market states for the 3x3 strategy when the split into up or down market states is determined by business and consumer surveys. 26 Table 4 shows results for market adjusted returns and table 5 for FF3F adjusted returns. Columns two to five show results for splits based on five sentiment indicators: construction; retail; consumer; industrial; and a composite economic sentiment indicator respectively. For convenience and comparison purposes, the first column of each table presents again the results for the CGH split in tables 2 and 3 (for tables 4 and 5 respectively). The results for the two sets of adjusted returns are broadly similar. In table 4, as can be seen from column one, the CGH split led to positive returns in all cases, contrary to their arguments, yet statistically significant only for up market cases. For all five sentiment indicators, the values of momentum profits in up markets are all positive, and statistically significant in 40% of cases. There is one significant value for each of the sentiment and industrial factors, three for the retail factor, but for the construction factor split, which seems to be the most informative, profits are significant throughout. This is confirmed by the results for down markets in panel B of the same table, where no value is significant, yet, all the values relating to the construction factor are negative as expected. The other factors offer few negative values.

The results in table 5, column one relate to the FF3F factor adjusted returns and are all statistically insignificant yet positive for both down and up markets, except for i=8 for DOWN. As regards the signs and significances, the results for panels A and B are generally in line with table 4. More specifically, all profits in up markets split on the basis of sentiment indicators from columns two to five are positive, but in many cases they are insignificantly different from zero. However, once again they are consistently statistically significant for construction (exception for split based on i=6). They are also significant for one (two) case(s) for the sentiment (retail) factor. The DOWN market values are consistently negative for construction, but insignificantly different from zero.

Panel C of tables 4 and 5 show that as far as the consumer, industrial and sentiment factors are concerned, the differences in profits between up and down markets are generally insignificant. 27 However, for construction and retail indicators the differences are significantly in two cases each, with differences having the sign predicted by the arguments of CGH. This pattern holds for both market adjusted and FF3F adjusted returns. 28 Furthermore, in both tables the differences between up and down momentum profits are of the expected sign for all (4 out of 5) values of t-i for the split based on the construction (retail) indicator.

Overall, tables 4 and 5 indicate that there are different patterns to momentum returns under different market states when those states are determined based on sentiment indicators. Generally, the two most relevant indicators appear to be the construction and the retail ones. Given the importance the media often gives these two measures as a barometer of economic activity, it is interesting that differences are seen when they are used as the basis for an up/down split. 29,30 27 There is one exception: using CAPM returns for the sentiment indicator for i=3.

28 This pattern relates to the case of assuming equal variances (panel C). If unequal variances are assumed there are three significant differences for FF3F returns for the construction indicator. For results in tables 4 and 5 there are no significant differences when median returns are used. 29 For example, an article in The Telegraph newspaper on 11 th July 2012, refers to a letter from high profile business leaders in the construction industry marking "the start of a new campaign called "Creating Britain's Future", which is designed to highlight the importance of the sector. It claims every £1 invested in construction generates £2.84 in economic activity, and the assets built "are vital to keep the UK economy competitive".

ROBUSTNESS

The sample period analysed thus far includes the subprime crisis, which had different characteristics and a huge impact compared to any other crises since the great depression. Given the earlier findings regarding the role of risk and potentially the psychological biases that can be exacerbated during such an extreme period, this section excludes data post-August 2007. 31 Hence, the tests and analysis are repeated in this section up to August 2007 with five tables that correspond to the earlier ones, i.e.

each table from 6 to 10 corresponds one-to-one to each table from 1 to 5.

INSERT TABLE 6 ABOUT HERE

In table 6, we can see that for the 3x3 strategy, when excluding the crisis period there is no real difference to the full sample period as far as panels A and C are concerned. The statistical significances are as in table 1, while the mean and median returns are close to the full sample ones. For example, the 2 month 3x3 strategy mean value in panel A of tables 1 and 6 is 0.0193 and 0.0194 respectively and both are significant at the 1% level. Where there seems to be an impact of the post-subprime crisis is on the mean returns of momentum portfolios during down markets (panel B). More specifically, when the crisis period is excluded the mean returns appear to be much lower yet positive, still contrary to the arguments of CGH. In the remaining panel, the null hypothesis that the mean profits in UP and DOWN markets are equal is never rejected as in table 1, in stark contrast to the findings of CGH that momentum profits vary with the state of the market.

The results are similar for the expectations measure that we propose (yet with more (http://www.telegraph.co.uk/finance/newsbysector/constructionandproperty/9393772/Constructionindustry-calls-on-Government-to-boost-infrastructure.html) 30 There is evidence that momentum profits may be due to the activities of individual investors (see, for example, [START_REF] Hvidkjaer | A Trade-Based Analysis of Momentum[END_REF][START_REF] Dorn | Correlated Trading and Returns[END_REF]. In contrast, futures prices are likely to capture the expectations of institutional investors. This may explain why expectations do not appear to impact on momentum profits, but sentiment does. The authors are grateful to an anonymous referee for suggesting this. 31 We also perform the tests using data for an extra year up to August 2008 to see the impact of the key early stage of this crisis; we do not report the tables for reasons of brevity, but discuss the findings, where appropriate.

significant cases), i.e. when the market behaves worse than expected (DOWNE), the returns are lower than in table 1, but still positive.

As regards the 6x6 strategy, the results are similar to table 1, with the same returns being significant, and no clear difference between up and down markets with both measures of market prices (actual and expectations) used here.

INSERT TABLES 7 AND 8 ABOUT HERE

Results for momentum profits based on returns adjusted for movements in the market and the FF3F factors are shown in tables 7 (related to table 2) and 8 (related to table 3) respectively. For the 3x3 portfolio the results with both adjustments are similar to the full sample results for all panels except panel B, i.e. when following down market periods. In panel B, the mean and, to a lesser extent, the median risk adjusted returns appear much higher when the crisis is excluded, yet as before panel C shows no statistically significant differences between periods. In relation to the 6x6 strategy, they are overall insignificant as for the full sample, but have the sign anticipated by CGH following down markets once risk is adjusted by the CAPM in table 7 (with returns even lower when the crisis period is excluded both in terms of mean and median). However, the differences between up and down markets are as before (with one exception for i=4 for mean returns assuming equal variances) insignificant for both measures used here. As far as the FF3F adjusted returns are concerned in table 8, the risk adjusted results are consistent with the rest of our evidence and contrary to the CGH arguments.

Specifically, they are positive following both up and down market periods irrespective of the method of splitting the sample used. Hence it is not surprising that there are no statistically significant differences in performance between up and down markets in panel C.

Overall in tables 7 and 8, consistent with the full sample results in tables 2 and 3, and contrary to CGH, risk adjusted returns between up and down market periods do not differ significantly. The same holds for our proposed expectations measure. Thus, the findings in tables 1-3, that momentum profits are insignificantly different across up and down markets, and contrary to the findings for the US in CGH, are not the result of including the crisis period.

As a final robustness test of the expectations-based approach, we examine whether the extent to which expectations have or have not been met impacts on momentum profits.32 Specifically, we exclude cases where the actual price is within 10% of the expected price and split the remaining sample into those cases where the price is (i) more than 10% higher than expected and (ii) more than 10% lower than expected. In all cases (for raw, CAPM adjusted and FF3F adjusted returns using both 3x3 and 6x6 strategies) there is no significant difference in momentum profits between the two groups at the 10% level of significance.

INSERT TABLES 9 AND 10 ABOUT HERE Tables 9 and 10 correspond to tables 4 and 5 respectively and relate to the 3x3 strategy for the sample pre-September 2007. In table 9, as for table 4, in up markets the profits are economically and statistically significant in all cases when the split is based on the construction factor. In relation to the split based on the retail factor they are also significant in two cases, that is, when splitting markets based on the indicator's data over the last 2 months and the last quarter. Finally, profits for the split based on the sentiment factor are also significant in up markets when information for the split is based on the news of the last quarter. The results as far as up markets are concerned are, therefore, consistent with the full sample results, i.e. in up markets the construction indicator is the most relevant.

However, when looking at the down market split in the same table, the results are different to those in tables 4 and 5. For the sample period including the post-subprime crisis period, momentum profits were insignificant in all cases following down markets and negative (albeit insignificant) when the sample was split using the construction indicator. Furthermore, tables 4 and 5 suggest there are significant differences between up and down markets, consistent with CGH. However, in tables 9 and 10 profits following down markets are positive in all cases (and significantly so in 11(7) cases using CAPM (FF3F) returns). Moreover, in tables 9 and 10 there are cases where profits following up markets are significantly higher than following down markets, as well as cases where the former are significantly lower than the latter. Thus, the evidence that up/down splits based on construction and retail indicators are important determinants of momentum profits appear to be driven by the post-subprime crisis period. 33Overall one can argue that the results of CGH are market specific, or at least that they do not hold for the UK, as their measure and the first expectations measure that we propose for splitting markets to up and down ones, do not seem to anticipate momentum performance. This is robust to both including and excluding the subprime crisis period. In general, following up market periods the construction sentiment indicator is better in anticipating momentum performance, but this does not hold true when the crisis period is excluded.

CONCLUSION

This paper examines the extent to which market states impact on momentum profits for the UK market. However, rather than simply categorising markets as in CGH as up or down based on a comparison of actual market prices, we suggest that sentiment and/or expectations are important in determining momentum performance. Hence, in examining the interaction of market states and momentum profits, a number of ways are used to determine whether the market is up or down. In addition to using the split suggested by CGH that compares the actual value of an index at two points in time, we also split the sample based on different measures of expectations and sentiment. First, we use index futures prices to obtain a market-determined measure of expectations, with an up market being defined as the case where the actual price at time t is higher than the futures price determined at time t-i for delivery at time t and the down market determined similarly. Second, we split the sample based on changes in five market sentiment indicators derived from business and consumer surveys. In addition, we not only present results for raw returns, but also for returns adjusted for risk using the market and the Fama-French factors. Two strategies are considered, namely the 3x3 and the 6x6.

Results for the 3x3 strategy are contrary to the findings and arguments of CGH both including the most recent crisis period and excluding it. Momentum performance is statistically and economically significant in both up and down market states and if anything higher in the latter. When the subprime crisis period is excluded, momentum returns remain positive and mostly significant following both up and down markets, hence down states are not associated with losses, contrary to CGH. These results hold irrespective of whether the up/down split is based on actual prices or expectations. The findings from the risk adjustments show that the performance is related to risk. For the full sample period the raw significant momentum returns become insignificant once risk is considered. Exclusion of the subprime crisis period leads to the loss of significance being much more subtle, affecting only the CGH measure and not the expectations measure we propose here. The results for the 6x6 strategy are similar when including and when excluding the subprime crisis period, but they are again inconsistent with CGH, as market states do not affect momentum performance.

When considering the impact of up/down splits based on sentiment indicators, results

are more meaningful as indicators can anticipate momentum performance in both up and down markets. However, the role of sentiment indicators is not evident when the post-subprime crisis period is excluded. Thus, the main findings of CGH for the US appear not to hold for the UK, whether splits are based on actual prices, expected prices or sentiment. Furthermore, the importance of considering the role of the subprime crisis is highlighted by the results presented here. The results in this paper are relevant to investors seeking to exploit momentum strategies based on market states and suggest that the results for the US may not hold in other markets. The table presents results on the raw returns of the zero cost investment portfolio for the period between December 1984 and December 2009. The first and third column show returns for those cases where the sample is split based on the relationship between the actual price of the index at time t (MPt) and the actual price at time t-i (MPt-i) for the 3x3 and 6x6 strategies, respectively. The second and fourth columns show returns for a sample split based on the relationship between the actual price of the index at time t (MPt) and the value of the index at time t expected at time t-i (EMPt,t-i) for the 3x3 and 6x6 strategies, respectively, where i = 2, 3, 4, 6, and 8. The table presents results on the Fama-French factors-adjusted returns of the zero cost investment portfolio for the period between December 1984 and December 2009. The first and third column show returns for those cases where the sample is split based on the relationship between the actual price of the index at time t (MPt) and the actual price at time t-i (MPt-i) for the 3x3 and 6x6 strategies, respectively, where i = 2, 3, 4, 6, and 8. The second and fourth columns show returns for a sample split based on the relationship between the actual price of the index at time t (MPt) and the value of the index at time t expected at time t-i (EMPt,t-i) for the 3x3 and 6x6 strategies, respectively.

( 2000 )

 2000 argue that herding in South Korea and Taiwan may be the result of short-horizon investors. Similarly, Fang (2012) "investigates the aggregate investor preferences and beliefs of the US stock market by examining enduring puzzles in finance" (p 546) and 9 Two indicators, those relating to Consumer Confidence and Industrial Confidence are from OECD and the other three indicators used are from the DGEFA.10 Frequently, stock index futures trade nine months prior to maturity. However, even in highly liquid markets the volume of trade for such contracts is relatively low and arguably the forward rate unbiasedness hypothesis is less likely to hold.

  partition the sample based on the following five sentiment indicators: the consumer confidence indicator; the retail trade confidence indicator; the construction confidence indicator; the industrial confidence indicator; and the economic sentiment indicator. 14 By comparing actual prices, deviations of prices from expectations and market sentiment, important insights should be provided about the market and the attitude of market participants to actual prices, expectations and investor sentiment.

  Panel A contains the results for UP/UPE market states, while panel B for DOWN/DOWNE market states. The first figure in each cell in panels A and B relates to mean returns and the figure in square brackets to median returns. Panel C provides results on the equality of the mean returns for the UP/UPE and DOWN/DOWNE market states assuming equal variances. * indicates significance at the 10 percent level; ** indicates significance at the 5 percent level; *** indicates significance at the 1 percent level.

  Panel A contains the results for UP/UPE market states, while panel B for DOWN/DOWNE market states. The first figure in each cell in panels A and B relates to mean returns and the figure in square brackets to median returns. Panel C provides results on the equality of the mean returns for the UP/UPE and DOWN/DOWNE market states assuming equal variances. * indicates significance at the 10 percent level; ** indicates significance at the 5 percent level; *** indicates significance at the 1 percent level.

  In considering both actual prices and expectations, i takes on the values 2, 3, 4, 6 and 8 months. When actual prices are used, the approach utilised by CGH is employed. If MP t  MP t-i then the market state is defined as UP. If MP t < MP t-i then the market state is defined as DOWN. For comparing the actual and expected prices with the futures price at time t-i, we start by defining the market as

	being up relative to expectations (UPE) if MP t  E(MP t,t-i ) and down relative to
	expectations (DOWNE) if MP t < E(MP t,t-i ). 16

t-i for the contract expiring at time t.

  Table1presents raw profits to the zero investment portfolio, with panel A showing results for the 'UP/UPE' market state and panel B the results for the 'DOWN/DOWNE' market state. The first two columns relate to the 3x3 strategy and the final two columns the 6x6 strategy. The first and third columns show profits for those cases where the sample is split based on the relationship between the actual price of the index at time t (MP t ) and the actual price at time t-i (MP t-i ). The second and fourth columns show profits for a sample split based on the relationship between the actual price of the index at time t (MP t ) and the value of the index at time t expected at time t-i (EMP t,t-i ). The first figure in each column relates to mean returns and the figure in square brackets to median returns.INSERT TABLE 1 ABOUT HEREConsidering the first two columns of the table, momentum profits are consistently positive for the 3x3 strategy irrespective of whether the CGH approach or expectations are employed to define market states. Profits are significantly different from zero for all up market cases (panel A) and for all but one down market cases (when the sample split is based on i=6, panel B), contrary to the CGH findings of momentum losses.

Table 1 :

 1 Momentum Profits and Market States: Raw Returns

	Lags (i)	3 x 3		6 x 6
	Panel A:	MP t >MP t-i	MP t >EMP t,t-i	MP t >MP t-i	MP t >EMP t,t-i
		UP	UPE	UP	UPE
	2 months	0.0193***	0.0212***	0.0755	0.0755
		[0.0203]	[0.0239]	[0.0353]	[0.0353]
	3 months	0.0207***	0.0210***	0.0210***	0.0210**
		[0.0219]	[0.0226]	[0.0353]	[0.0359]
	4 months	0.0223***	0.0218***	0.0009	0.0005
		[0.0219]	[0.0202]	[0.0184]	[0.0196]
	6 months	0.0222***	0.0233***	-0.0006	-0.0019
		[0.0191]	[0.0193]	[0.0256]	[0.0256]
	8 months	0.0196***	0.0179***	0.0966	0.0172
		[0.0202]	[0.0190]	[0.0332]	[0.0311]
	Panel B:	MP t <MP t-1	MP t <EMP t-1	MP t <MP t-1	MP t <EMP t-1
		DOWN	DOWNE	DOWN	DOWNE
	2 months	0.0284***	0.0252**	0.0048	0.0048
		[0.0245]	[0.0203]	[0.0196]	[0.0196]
	3 months	0.0268**	0.0259**	0.1083	0.1031
		[0.0240]	[0.0238]	[0.0156]	[0.0180]
	4 months	0.0243*	0.0249**	0.1843	0.1417
		[0.0240]	[0.0240]	[0.0449]	[0.0410]
	6 months	0.0236	0.0215	0.1578	0.1414
		[0.0249]	[0.0245]	[0.0449]	[0.0411]
	8 months	0.0369**	0.0353***	0.0402***	0.1626
		[0.0264]	[0.0278]	[0.0411]	[0.0411]
	Panel C:	Test for mean equality: (up-down) = 0
	2 months	-0.833	-0.368	0.855	0.855
	3 months	-0.548	-0.442	-1.029	-0.982
	4 months	-0.170	-0.281	-2.107**	-1.723*
	6 months	-0.116	0.152	-1.764*	-1.633
	8 months	-1.308	-1.385	0.501	-1.383

Table 3 :

 3 Momentum Profits and Market States: FF3F Returns

	Lags (i)	3 x 3		6 x 6
	Panel A:	MP t >MP t-i	MP t >EMP t,t-i	MP t >MP t-i	MP t >EMP t,t-i
		UP	UPE	UP	UPE
	2 months	0.0070	0.0046	0.0785	0.0785
		[0.0055]	[0.0002]	[0.1067]	[0.1067]
	3 months	0.0067	0.0063	0.1159***	0.1197***
		[0.0031]	[0.0011]	[0.1067]	[0.1094]
	4 months	0.0053	0.0063	0.1307***	0.1348***
		[0.0057]	[0.0079]	[0.1123]	[0.1123]
	6 months	0.0047	0.0036	0.1268***	0.1301***
		[0.0020]	[0.0025]	[0.1064]	[0.1096]
	8 months	0.0048	0.0056	0.0530	0.1285***
		[0.0016]	[-0.0019]	[0.0970]	[0.1121]
	Panel B:	MP t <MP t-1	MP t <EMP t-1	MP t <MP t-1	MP t <EMP t-1
		DOWN	DOWNE	DOWN	DOWNE
	2 months	0.0018	0.0053	0.1416***	0.1416***
		[0.0037]	[0.0064]	[0.1196]	[0.1196]
	3 months	0.0018	0.0028	0.0722	0.0676
		[0.0044]	[0.0050]	[0.1571]	[0.1334]
	4 months	0.0041	0.0027	0.0213	0.0392
		[0.0044]	[0.0029]	[0.1807]	[0.1239]
	6 months	0.0046	0.0065	0.0457	0.0498
		[0.0064]	[0.0044]	[0.1807]	[0.1153]
	8 months	-0.0079	-0.0060	0.1468***	0.0224
		[0.0007]	[0.0020]	[0.1523]	[0.1153]
	Panel C:	Test for mean equality: (up-down) = 0
	2 months	0.475	-0.072	-0.817	-0.817
	3 months	0.444	0.321	0.547	0.664
	4 months	0.099	0.325	1.311	1.233
	6 months	0.010	-0.249	0.944	0.962
	8 months	0.970	0.928	-0.889	1.057

The London Stock Exchange is chosen for analysis in this paper for a number of reasons. First, it is one of the largest exchanges in the world in terms of market capitalization, trading value and number of trades (see http://www.world-exchanges.org/statistics); second it is the most international of stock exchanges (see http://www.londoncapitalventures.com/) and; third, it is a market where momentum profits have been evident in a number of studies (see, for example,[START_REF] Liu | The profitability of momentum investing[END_REF],[START_REF] Hon | Momentum in the UK stock market[END_REF] and relevant references in footnote 1). Investigation of the issues for this market will be of interest to a wide range of investors, both domestic and overseas.

CGH also consider the market state as a continuous variable and find a non-linear relationship exists.However, the results from the use of a continuous variable for market state show a positive relationship between momentum profits and lagged market returns.

Anchoring refers to the tendency when making estimates to start at an initial value (the anchor point) and adjust away from that point. In many situations, different initial values lead to individuals making different final estimates. See[START_REF] Tversky | Judgment under uncertainty: Heuristics and biases[END_REF].

This is consistent with the findings of CGH. In their sample more than 84% of periods are classified as UP using a 36 month lag and over

72% are UP when using a 12 month lag.7 Fielding and Stracca (2007) examine behavioural explanations of the equity premium puzzle and suggest that a combination of myopic loss aversion and disappointment aversion provide "an attractive explanation of the equity premium puzzle" (p252).

In a recent paper[START_REF] Antoniou | Cognitive Dissonance, Sentiment, and Momentum[END_REF] examine the role of sentiment on momentum profits in the US market, based on arguments relating to cognitive dissonance and information diffusion. They find that momentum profits are only evident in the presence of optimism.

As noted by CGH, the results of using a 1, 2 or 3 year horizon are broadly similar.

In line with previous literature, a month is skipped between the ranking period and the start of the holding period to avoid factors which may induce negative serial correlation (see, for example, Jegadeesh and Titman, 1993, who skip a week). We skip a month as we are using monthly data.

In the remainder of the paper we will use upper case UP/DOWN to relate to market states based on actual prices and UPE/DOWNE to relate to market states based on expectations. Lower case 'up' and 'down' will be used to refer in general to categories of market states.

Given that there is not a precise date for the start of the crisis, we also repeat the analysis including the period up to August 2008. In the interests of brevity we compare in the text, where appropriate, the differences between the two sets of results, without presenting tables.

The results for median returns show a similar pattern, with down market returns being higher than up market returns for all values of i.

The only exception is for the 6x6 strategy when i=4, with mean returns being significantly different at the 10% level assuming equal variances. However, the differences in mean returns are insignificant when assuming unequal variances. Similarly, there are no significant differences between median returns.

This part of the analysis concentrates on the 3x3 strategy, since the sample numbers for the 6x6 strategy are relatively low. In addition, given the results in tables 1-3 for the 3x3 strategy, if significant differences are found here for this strategy, this would provide strong support for the importance of sentiment.

We thank a referee for suggesting this robustness check. In the interests of brevity, results are not reported.

In relation to both tables 9 and 10, there are no cases where the median returns are different across market states.

See notes to table 3 as this table presents the same results as table 3 but for June 1984 -pre-September 2007 (i.e. excluding the crisis period).

The table presents results on the CAPM-adjusted returns of the zero cost investment portfolio for the period between December 1984 and December 2009. The first and third column show returns for those cases where the sample is split based on the relationship between the actual price of the index at time t (MPt) and the actual price at time t-i (MPt-i) for the 3x3 and 6x6 strategies, respectively. The second and fourth columns show returns for a sample split based on the relationship between the actual price of the index at time t (MPt) and the value of the index at time t expected at time t-i (EMPt,t-i) for the 3x3 and 6x6 strategies, respectively, where i = 2, 3, 4, 6, and 8. This table presents results on the CAPM-adjusted returns of the zero cost investment portfolio for the period between December 1984 and December 2009. The first column shows returns for those cases where the sample is split based on the relationship between the actual price of the index at time t (MPt) and the actual price at time t-i (MPt-i) for the 3x3 strategy, where i = 2, 3, 4, 6, and 8. The remaining five columns exhibit returns for a sample split based on the relationship between the actual price of a sentiment-index at time t and the value of that index at time t-i for the 3x3strategy, where i = 2, 3, 4, 6, and 8. The sentiment indices used here are the Construction Confidence Index, the Consumer Confidence Index, the Industrial Confidence Index, the Retail Trade Confidence Index and the Economic Confidence Index obtained from OECD and DGEFA.


Adrien Bullich

Mikaël Briday

Jean-Luc Béchennec

Yvon Trinquet

A compiled Cycle Accurate Simulation for Hardware Architecture

ComCAS: A Compiled Cycle Accurate Simulation for Hardware Architecture Adrien Bullich, Mikaël Briday, Jean-Luc Béchennec and Yvon Trinquet

IRCCyN -UMR CNRS 6597 1, rue de la Noë 44 321 Nantes Cedex 3 France Email: {first name.last name}@irccyn.ec-nantes.fr Abstract-The context of our research works is the real-time embedded systems domain. It is often difficult to test systems in order to ensure an appropriate running. A simulator presents the advantage that the detailed evolution of each component can be followed. These simulators require a very long development time. HARMLESS has been developed to automate this step. It is a hardware description language (HADL), readable by a compiler which allows the generation of a functional simulator (ISS) and a temporal simulator (CAS). CAS are costful in execution time. Several techniques exist in the literature to improve the speed of temporal simulators. In this paper we explore a new approach: the compiled simulation, which is used for functional simulators.

I. INTRODUCTION

Our works are in the field of real-time embedded systems. Since this kind of systems becomes more and more employed and complex, the guarantee of a correct running is an important property. We need to validate the security (the system disallows dangerous behaviours) of the system. Three different methods exist to give these results: the model-checking in the first step of the development, the simulation and series of tests in the last step. These different methods give complementary results. For example, the simulation allows to examine the evolution of each component in an operating system, whereas it is a difficult thing with series of tests in embedded systems. In this paper, our approach focuses on simulation techniques.

Several kinds of simulators are in the literature, according to the field studied, objectives followed or the abstraction level required. For hardware simulation, the implementation is complex, costful in time, and errors are difficult to avoid. That is the reason why people would rather use simulator generators. The construction of a simulator generator is based on a Hardware Architecture Description Language (HADL).

We can make out functional simulators i.e. Instruction Set Simulator (ISS), and temporal simulators i.e. Cycle Accurate Simulator (CAS). The simulation of real-time systems needs temporal informations, so we consider especially CAS. This kind of simulators has the disadvantage to be costful in execution time. In this paper, we propose to explore a technique to improve the speed of CAS: ComCAS, a compiled simulation for CAS. Our works are in the context of simulation based on the HARMLESS language, which implements an ISS and a CAS with interpreted methods [START_REF] Kassem | HARMLESS, a hardware architecture description language dedicated to real-time embedded system simulation[END_REF].

The paper is organized in seven parts: this introduction, related works, the interpreted model, the compiled model, valuation of the model size, performances and finally prospects for future works.

II. RELATED WORKS

Several kinds of simulators based on HADL are in the literature. For a simulation about the functional aspect, an Instruction Set Simulator (ISS) is required (nML [START_REF] Fauth | Describing instruction set processors using nml[END_REF], ISDL [START_REF] Hadjiyiannis | Isdl: an instruction set description language for retargetability[END_REF], HARMLESS [START_REF] Kassem | Instruction set simulator generation using HARMLESS, a new hardware architecture description language[END_REF] for example). It gives the instructions behaviour, without considering the details of the microarchitecture. If temporal informations are expected, a Cycle Accurate Simulator (CAS) is required (LISA [START_REF] Pees | Lisa -machine description language for cycle-accurate models of programmable dsp architectures[END_REF], MADL [START_REF] Qin | A formal concurrency model based architecture description language for synthesis of software development tools[END_REF], HARM-LESS [START_REF] Kassem | Simulator generation using an automaton based pipeline model for timing analysis[END_REF] for example). In this case, the microarchitecture must be modeled.

Compiled simulation, opposed to interpreted simulation, is a general programming technique in order to speed the execution of a simulator. It consists in moving certain tasks from the execution to the compilation. In an interpreted simulator, these tasks are done during the execution and, in a compiled simulator, they are done during the compilation. In consequence, compiled simulation has shorter execution time than interpreted simulation, but longer compilation time. Since compilation is done less times than execution (classicaly, one compilation for several executions), it could be a global gain of time.

An ISS can be implemented like an interpreted simulator or a compiled simulator [START_REF] Mills | Compiled instruction set simulation[END_REF]. In that case, the task moved from the execution to the compilation is the analysis of the program to simulate. In spite of having a faster simulator, this leads to have a less flexible one: the compiled simulator is attached to a particular program, and if a user wishes to simulate a new one, he needs to compile again.

For ISS, compiled simulation uses Binary Translation (BT) ( [START_REF] Cifuentes | Binary translation: Static, dynamic, retargetable?[END_REF] or [START_REF] Bellard | Qemu, a fast and portable dynamic translator[END_REF]). It consists of translating the binary program in order to be executed on the simulator operating system.

In the context of real-time systems, CAS is more appropriate, because it allows temporal considerations. Nevertheless, the implementation is more complex and it is a costful approach, considering the execution time. Few methods exist to lighten this execution time.

In the literature, we mainly find interpreted methods (HARMLESS for example [START_REF] Kassem | Simulator generation using an automaton based pipeline model for timing analysis[END_REF]). The technique of BT cannot easily be adapted to CAS, but solutions exist [START_REF] Jones | High speed cpu simulation using ltu dynamic binary translation[END_REF], coupling interpreted parts and translated parts. We also finds statistic approaches, called Cycle Approximate Simulator, based on the sampling of instructions [START_REF] Wunderlich | Smarts: Accelerating microarchitecture simulation via rigorous statistical sampling[END_REF]. However it is not exactly equivalent with a CAS, because of margin of errors.

In the state of our knowledge, the technique of compiled simulation has not yet been employed to speed CAS, because of restrictions it implies: it is difficult to determine statically the evolution of the microarchitecture, especially because of indirect branches or self-modifying code. It is, however, the main contribution of the paper.

III. INTERPRETED SIMULATION MODEL

The contribution of the compiled simulation must be assessed in comparison with the interpreted approach associated. In this section, we present the interpreted model of the HARM-LESS-based simulator [START_REF] Kassem | HARMLESS, a hardware architecture description language dedicated to real-time embedded system simulation[END_REF], who is the base of our ComCAS model.

CAS are mainly implemented thanks to interpreted methods, it is based on the interpretation of the code during the execution. The construction of a CAS includes the construction of an ISS, in order to get functional aspects of the system. The modelisation of an ISS requires the modelisation of the instruction set and of the memory. We globally obtain the development chain presented in figure 1.

The development of a CAS requires precedent elements and the modelisation of the microarchitecture which has a great influence on the temporal evolution of the system, and especially the pipeline architecture who determines the management of data hazards, structure hazards and control hazards. In figure 2, we get the development chain of a CAS. In [START_REF] Kassem | HARMLESS, a hardware architecture description language dedicated to real-time embedded system simulation[END_REF], the authors use the model of finite automata, because the system can be considered as a discrete transition one (an evolution at each cycle). That is the definition on which our contribution is based. A state represents the system in a particular cycle. To determine it, we need informations on the microarchitecture. This is given by:

• which instruction is in each stage of the pipeline

• and the state of internal resources.

Internal resources are elements of the microarchitecture, whose availability allows or not the evolution of an instruction in the pipeline. Stages of the pipeline are considered as internal resources.

A transition represents a discrete event who brings the system from a state to another. It is determined by the state of external resources and the instruction who may enter in the pipeline.

External resources are elements who are not in the microarchitecture, but whose avaibility has an influence on the evolution of an instruction in the pipeline. It is the case of memory for example. As they are external of our modelisation, their avaibility is determined during the execution by the intervention of external resources.

In order to lighten the model, the authors use instruction classes (instructions with same behaviours) and not directly instructions.

The content of states is abstracted, and informations required for the simulation are gathered on transitions. That is why transitions are labeled with notifications (answering if a particular event happens or not).

We can now formalize the model as it follows.

Let AI an automaton defined by {S, s 0 , ER, IC, N, T }, where:

• S is the set of states,

• s 0 is the initial state (empty pipeline) in S,

• ER is the first alphabet of actions (external resources),

• IC is the second alphabet of actions (instructions class),

• N is the alphabet of labels (notifications),

• T is the transition function in S × ER × IC × N × S. In the example of figure 3, the notation [b_a_] represents the state of the pipeline: it means that instruction b is in the first stage and instruction a is in the third stage. There are no others instructions.

We have only one notification who represents the entry of an instruction in the second stage of the pipeline. There are one external resource. The instruction b needs to take the external resource to enter in the pipeline.

We note 01:a(10) a transition (in T) where 01 ∈ ER means that the first external resource is taken (1) and the second is free (0), a ∈ IC means that an instruction of class a enters in the pipeline, 10 ∈ N means that the first notification does not happen (0) and the second does [START_REF] Kassem | HARMLESS, a hardware architecture description language dedicated to real-time embedded system simulation[END_REF].

The run of the automaton is done throught the intermediary of external resources and the instruction class. It means that the simulator computes the new state of external resources and the new instruction class in order to fire a transition and to find the new state in the automaton. Firing the transition, we get the state of notifications. They give informations to the user about the performing of the simulation. They are helpful to compute the new state of external resources too.

IV. COMCAS MODEL

In this section, we adapt the interpreted model to be a compiled one: the ComCAS model.

The compiled simulation is opposed to the interpreted simulation according to the repartition of tasks between compilation and execution. We recall that, in our case, the task is the analysis of the program. An interpreted simulator analyzes the program during the execution. A compiled simulator analyzes the program during the compilation.

Because of this moving, the compiled simulation has a faster execution than the interpreted simulation. However, the compiled simulation has an heavier compilation time than the interpreted simulation. This is not necessarily a problem: usually, the compilation is done only one time and the execution several times.

A compiled simulation is compiled for a special architecture and for a special program. Consequently, the simulator is less flexible, attached to a particular program. If the need is to simulate several programs, the interpreted simulation will be more efficient. But if the need is to simulate only one program with different scenarios, the compiled simulation will be more efficient.

In the figure 2 and4 we can see the difference between the development chain of the interpreted simulation and the compiled simulation (respectively). We notice especially that for the interpreted simulation the program is at the end of the development chain, at the beginning for the compiled simulation.

To perform the interpreted model to a compiled model, we need to add informations on the program reading in the system, i.e. the PC and the memory of called function. Then, the determination of our system is given by:

• which instruction is in each stage of the pipeline,

• the state of internal resources,

• the position in the program reading (the Program Counter)

• and the memory of called functions (a stack of Program Counter in order to return in previous functions). With this model, instructions become labels on the automaton and no more actions. Indeed, we only determine the evolution of the system with external resources and instructions become an information we get of this run. We put on transitions the instruction to execute, as an event. However, it cannot be reduced to a simple notification (a boolean information), so we add the Program Counter (PC) on the transition label.

We can formalize our ComCAS model as it follows.

Let AC an automaton defined by {S, s 0 , ER, I, N, T }, where:

• S is the set of states,

• s 0 is the initial state (empty pipeline, initial PC, empty stack) in S,

• ER is the alphabet of actions (external resources),

• I is an alphabet of labels (instructions),

• N is an other alphabet of labels (notifications),

• T is the transition function in S × ER × I × N × S.

[____] pc0 stack

[a___] pc1 stack

[_a__] pc1 stack

[b_a_] pc2 stack 10:pc1(0) 0 0 : p c 1 ( 0 ) 0 1 : p c 1 ( 0 ) . Automaton in compiled simulation: 10:pc1(0) means that the first external resource is free and the second taken [START_REF] Bellard | Qemu, a fast and portable dynamic translator[END_REF], that the instruction with PC pc1 enters in the pipeline and that the notification does not happen (0)

In the example of figure 5, we have only one notification who represents the entry of an instruction in the second stage of the pipeline. There are two external resources. The instruction b, with PC pc2, needs to take the second external resource to enter in the pipeline. We note 10:pc1(0) a transition (in T) where 10 ∈ ER means that the first external resource is free (0) and the second taken (1), pc1 ∈ I means that the instruction with PC pc1 enters in the pipeline, 0 ∈ N means that the first notification does not happen (0). The management of branches uses a specific external resource. If this resource is taken, we consider the branch taken. If it is not, we consider the branch is not taken. During the simulation, we can detect jump in PC and define dynamically the value of this resource. In order to represent the latency of the branching, according to the branching policy, an other specific external resource could be employed and simulate control hazards. If the microarchitecture uses branching predictor, the simulator would emulate this branching predictor and define dynamically the value of the correponding external resource. While the resource is defined to be taken, the following instruction could not enter in the pipeline.

An example is given in figure 6. The first external resource represents the branch to pc3. If it is taken, then the model goes to pc3, else it goes to the next PC pc1. The second resource represents the branching latency. As long as it is taken, no instruction cannot enter in the pipeline. The compiled simulation needs to compute statically the control flow of the program in order to model it during the compilation. In the case of indirect branches or code selfmodifying, this computation is impossible unless we execute the different scenarios of the program. That is the main restriction of our model. Without the possibility to determine statically the target of indirect branches, the solution is to plan the different possibilities. Unfortunately, it leads to a considerable increase of the size of the automaton.

Indirect branches are unavoidable if we want to model functions calls, because of RETURN instructions. For this specific problem, a PC stack is added in states. The stack in states allows to memorise original PC when is executed a CALL instruction. When a RETURN instruction is executed, thanks to this stack, it is possible to determine the target PC of the branch, during the compilation.

The processus is the following. When a CALL instruction enters in the pipeline, we push the original PC in the stack and we branch to the target PC. When a RETURN instruction enters in the pipeline, we pop a PC from the stack and we branch on it. An example is given in figure 7.

The main advantage of the compiled simulation is to make possible the move of analysis functions in the compilation step. For example, the interpreted method manages data hazards during the execution, thanks to the intervention of an external

pipeline PC call [] pipeline PC k [PC call ] pipeline PC return [pc call ] pipeline PC call +1 []
Fig. 7. A CALL function push the original PC in the stack, and a RETURN function pop the PC from the stack resource. It is a task costful in time. In our model, we compute statically the data dependency, verifying if instructions in the critic section of the pipeline do not write in registers we want to read. This technique solves data hazards directly during the compilation.

V. VALUATION OF THE NUMBER OF STATES

In order to give an idea of the complexity of ComCAS model, we propose to valuate the number of states.

A state is composed of the pipeline state, the PC read and the stack of called functions. In a first step, we will consider there are no stack in states, and we will add their consideration in the last step. The global method consists in counting pipeline states for a PC given. We find three different situations in the control flow: linear configuration, beginning of the program and branching configuration.

In a linear configuration, for a PC given, one past exists. Consequently, the state of the pipeline is only determined by stalls. The problem is reduced to a combinatory one: if s is the number of stages, we count C k s (k among s) pipeline states with k instructions inside (k ∈ [0; s]). Thus, the total number of pipeline states is

s k=0 C k s .
If the PC read is at the beginning of the program, pc n with n < s, it is impossible to put more than n instructions in the pipeline. So, in this case, the previous value is truncated to

n k=0 C k s .
To simplify calculus, we use f s : n → n k=0 C k s . And we know that f s (s) = 2 s . At this step of our computation, we can valuate the number of states in a perfect linear program (with no branch). Let i the number of instructions. The s first instructions are in the second case (beginning of the program), and i -s others instructions are in the first case (endless linear configuration). It gives:

s-1 k=0 f s (k) + (i -s).2 s .
This value is a maximum and it is reached if every pipeline states are explored. It is the case if an external resource manages the entry of instructions in the first stage, allowing all stalls arrangements.

To count pipeline states is more complex if we include branches in the control flow. Let us consider the case in figure 8, with k < s. In this situation, if we put j instructions in the pipeline with j ≤ k, the branching is not visible in the pipeline. Thus, we remain in the same previous situation: C j s pipeline states. But, if we put j instructions in the pipeline with j > k, then for each stalls arrangement two pipeline states exist, with the two different origins. So we count 2.C j s pipeline states. The total number of pipeline states is (1 -b).

k j=0 C j s + s j=k+1 2.C j s . It is equivalent with 2 s+1 -f s (k).
s-1 k=0 f s (k) + (i -(1 -b).s).2 s
The expression is valid if branch configuration is the same we give in figure 8. It means two conditions:

• branch targets are separated by more than s instructions,

• no branch less than s instructions after a branch target.

In fact, we can confirm that the first condition does not degrade our valuation. The second condition is more important and avoid too small loops.

The analysis of our valuation reveals that the number of states is linear with the number of instructions, and exponential with the number of stages. We can compare the expression with the number of states in interpreted simulation: (ic+1) s , which is more exponential considering s.

In our valuation, we have not yet considered the use of PC stack in states. We can see in figure 9 the effect on the control flow of the add of PC stacks. It can be regarded as inlining: functions are duplicated. If we consider this new control flow, our reasoning is the same. Let us call i the number of couple of instruction and PC stack, and b the new number of branch targets. Thus, the number of states becomes:

(1 -b ). s-1 k=0 f s (k) + (i -(1 -b ).s).2 s
The influence of this inlining is very dependent on the code. For example, we observe that programs using floating numbers increase significantly the size of the automaton, and make the building of the model difficult.

VI. TESTS AND PERFORMANCES

In this section, we present experimental results about performances of ComCAS model in comparison with the interpreted simulation.

The architecture simulated in these tests is a PowerPC (MPC 5516, a RISC architecture from Freescale). We simulate benchmarks of Mälardalen [START_REF] Gustafsson | The Mälardalen WCET benchmarks -past, present and future[END_REF]. Simulations are made with an Intel Core i7 vpro computer. We execute 50 000 times each program.

We give in figure 10 an illustration of the influence of the inlining and the number of states. This allows to confirm that if a function is called one time during the execution, PC stack has no influence on the size of the model. We note that the number of states is smaller than the valuation we give, because the model does not explore every pipeline states. With particular external resources (making every pipeline states possible) we get the same result than our valuation. To allow a comparison, with the same configuration the interpreted model gets 1 024 states. Smaller is the code, smaller is our model. The figure 11 represents performances of ComCAS model in comparison with the interpreted method for the execution time. The compilation in the compiled approach is more complex than the interpreted approach. It contains: construction of the ISS, analysis of the program (thanks to the ISS), construction of the model and final compilation.

Program

As we said before, benefits in execution time is paid with heavier compilation step. This drawback can be easily counterbalanced if several execution are done for a compilation. The main impact of our model comes from the possibility of managing during the compilation analysis tasks and especially the data dependency control. In the interpreted simulation, during the execution, the functionality tasked with data dependency management, costs correctly 30% of the total time, explaining the benefit we get.

VII. PROSPECTS

In this paper, we have discussed of the different techniques to implement high speed Cycle Accurate Simulator. We study the difference between interpreted simulation and compiled simulation in the implementation of Instruction Set Simulator. We develop a model to adapt this compiled approach to Cycle Accurate Simulator: ComCAS. We study the theoritical size of our model. Finally, we compare performances of our model with the interpreted method associated.

It appears to bring efficiency because it allows the remove of analysis tasks in the execution step. However, the technique is limited by the use of indirect branches, else the size of the automaton could increase considerably. Nevertheless, we make possible to take in consideration CALL and RETURN instructions, in order to simulate classical programs.

In the future, we propose to work on a Just In Time Simulator, which could bring a solution to the problem of indirect branches.

Then, we propose to improve the efficiency of the ComCAS model thanks to the move in the compilation step of the fetch cache management and thanks to a reduction of states, using "macro-instructions". In a compiled simulation it is possible to consider gathering of instructions to reduce the automaton and the execution time.

Fig. 1 .Fig. 2 .

 12 Fig. 1. The development of an ISS requires the modelisation of the instruction set and the memory

Fig. 3 .

 3 Fig.3. Automaton in interpreted simulation: 0:b(1) means that the external resource is free (0), that the instruction b may enter in the pipeline and that the notification happens[START_REF] Kassem | HARMLESS, a hardware architecture description language dedicated to real-time embedded system simulation[END_REF]

Fig. 4 .

 4 Fig. 4. The development of a compiled CAS requires to move the program analysis in the compilation

Fig. 5

 5 Fig.5. Automaton in compiled simulation: 10:pc1(0) means that the first external resource is free and the second taken[START_REF] Bellard | Qemu, a fast and portable dynamic translator[END_REF], that the instruction with PC pc1 enters in the pipeline and that the notification does not happen (0)

Fig. 6 .

 6 Fig. 6. The second external resource specifies if the branch b is taken or not. The first external resource specifies if the instruction e can enter or not in the pipeline.

For

  one branching situation, we have k varying in [0; s-1]. Let b the number of branch targets. So the total number of states becomes s-1 k=0 f s (k) + (i -s -s.b).2 s + b.(s.2 s+1s-1 k=0 f s (k)). It is equivalent with:

Fig. 8 .

 8 Fig. 8. A branch configuration in the control flow. If k < s then in PC pcn the pipeline can remember two origins.

  pc k [pc call ] pc ret [pc call ] pc k [pc call ] pc ret [pc call ]

Fig. 9 .

 9 Fig. 9. Stack consideration consists in an inline in the control flow. These two automata are equivalent.

Fig. 10 .

 10 Fig. 10. Influence of the inlining: i is the number of instructions, b the number of branch targets, i' the number of instructions with the inlining and b' the number of branch targets with the inlining

Fig. 11 .

 11 Fig. 11. Comparison of execution time in s. Gray is for interpreted simulation and black is for compiled simulation.