1 Introduction

A widely debated topic in the financial and economic fields over the last century concerns the efficiency of stock markets. Research has been conducted by many academics using a range of tests in an attempt to determine whether various markets around the world show signs of informational efficiency (see Fama 1965b; Jefferis and Smith 2005; Mangani 2007). It has recently been suggested that the efficient market hypothesis (EMH) may be tested using tests of random number generators (RNGs), which are designed to assess whether sequences of numbers are truly random (Doyle and Chen 2013). One such test is the overlapping serial test (OST) which is considered to be amongst the strongest tests of RNGs available (Xu and Tsang 2007). The use of such tests has received little attention in studies of efficiency in South African markets. This study aims to implement such methods on the Johannesburg Stock Exchange (JSE) while tailoring the methodology to take into account the unique characteristics of this market by making adjustments for thin trading. It is assessed whether sufficient evidence of non-randomness exists in price changes of small, mid and large cap stocks. This is done by examining these stocks at an individual share level as well as an index level.

This paper will begin with Sect. 2 providing some background theory on the EMH and RNGs, as well as a review of market efficiency in South Africa. The methodology employed in this study is then described in Sect. 3, after which the results and analysis are then presented in Sect. 4. The paper ends by stating the conclusions in Sect. 5.

2 Background theory

This section introduces the concepts of efficient markets and random number generators, and how they tie together. Existing literature on market efficiency is thereafter reviewed.

2.1 The efficient market hypothesis

In an efficient market the prices of stocks take all available information into account, and any new information should thus be rapidly assimilated by the market and reflected in share prices (Bodie et al. 2010). In such a market a stock’s price should be a fair estimation of its intrinsic value (Fama 1965a). Closely linked and researched alongside the EMH is the idea that stock market price changes or returns may follow a random walk. If the returns of a stock follow a random walk, it would imply that they are independent of one another, and therefore past price changes should not affect price changes in the future. In other words, future stock price changes should not always be accurately predictable beforehand and used in a consistently successful investment strategy.

If a market is efficient and all available information is considered by share prices, which are approximating their intrinsic values, then the occurrence of new information would cause share prices to follow a random walk (Malkiel 2003). This is because the occurrence of new information and news is by nature generally unpredictable, and the resulting price changes will be as well. If this is the case, investors employing a technical or fundamental strategy will not consistently be able to earn a return that is above the average buy-and-hold strategy without accepting above average risk (Malkiel 2003). This suggests that an uninformed investor could potentially achieve returns similar to investment professionals by investing in a portfolio of stocks.

There are three recognised forms of market efficiency: weak form, semi-strong form and strong form. Weak form efficiency describes the case where stock prices are said to reflect all information about historical share prices and trading volumes (Fama 1970). Semi-strong form efficiency states that stock prices will reflect any information related to the stock that is publicly available. This includes price and trading data as well as firm specific data, such as the competency of management and forecasts of company performance (Bodie et al. 2010). Strong form efficiency asserts that stock prices will reflect all information in the other two efficiency forms and in addition considers insider information that is known only by those in close relation to the company.

2.2 Stock markets as random number generators

In describing the random walk theory of stock returns, Fama (1965b: 34) explained that: “the future path of the price level of a security is no more predictable than the path of a series of cumulated random numbers.” In fields such as computer science and operational research, sequences of random numbers are required for uses such as encryption and Monte Carlo studies (Marsaglia 1985). There are several different types of random number generators (RNGs) which can be used to generate random number sequences, and the two main categories are: pseudo random number generators (PRNGs) and true random number generators (TRNGs) (Kohlbrenner 2003). PRNGs produce sequences of numbers by using a predefined algorithm and an input value called the “seed”. Despite the fact that these sequences usually appear random, they are often not: if the same input value is used, an identical sequence will always be produced (Kohlbrenner 2003). This suggests that there could be an element of predictability in PRNG sequences. TRNGs produce sequences that are unpredictable and that cannot be reproduced. This is achieved by using physical processes that are often natural sources of randomness, such as white noise, the decay of radioactive material, or flicker noise of resistors (Kohlbrenner 2003).

In conducting studies and simulations it is often important that a good quality RNG is used to produce the sequence of random numbers. Consequently there are several tests available that can be used to test the robustness of RNGs, such as: the gorilla test, the overlapping serial test, the birthday-spacings test, and various other tests (see Marsaglia 1985; Xu and Tsang 2007). If stock market returns follow a random walk, or the market is efficient, the returns of securities may be viewed as a sequence of random numbers, as would be generated by an RNG (Doyle and Chen 2013). It may therefore be enlightening to treat stock returns as if they were sequences of random numbers and subject them to the same tests that RNGs are critiqued by. In this sense the stock market will be treated as if it were an RNG, and the market movements as the random number sequence produced.

The overlapping serial test (OST) is a test of randomness that was developed by Good (1953), and has also been referred to as the overlapping m-tuple test by Marsaglia (1985). The OST is borrowed from the field of operational research where it is used in testing the stringency of RNGs. The usefulness of operational research techniques in finance was pointed out by Mulvey (1994), as well as his specific mentioning of the use of these techniques when looking for security anomalies. In the past, many of the studies that have tested for dependencies in stock price movements used tests such as the runs test, serial correlation, auto regression analysis, variance ratio tests, Dickey Fuller test, and the Box Pierce test (see Bonga-Bonga 2012; Jefferis and Smith 2004; Hadassin 1976). Doyle and Chen (2013) discussed that many of the tests which are often used in EMH studies detect the clustering of similar returns; the OST, however, does not use the clustering of similar returns, but rather looks at the distribution of the patterns or sequences of returns in the market. The OST identifies significant deviations from randomness that differ from deviations found by the commonly used tests of market efficiency (Doyle and Chen 2013). The OST also analyses all possible patterns of a specific length at the same time, and does not simply choose the most imposing deviations, after which the distribution of patterns is observed to see if it is irregular. It may therefore be expected that by using the OST, evidence may become available that would not be found by other tests.

In order to test the strength of the OST and its ability to reject poor RNGs, Xu and Tsang (2007) conducted a study where the OST was tested on a library consisting of 57 RNGs. The study was set up so that the more powerful the test of randomness, the more RNGs it would reject. The study found that the OST is as powerful and as difficult to pass as the gorilla test, which is considered to be one of the most stringent tests of RNGs available. The OST rejected 29 of the RNGs, which is one more than the Gorilla Test was able to. Both tests rejected mostly the same RNGs in the library, with the remaining RNGs that were not rejected being considered robust generators (Xu and Tsang 2007). This justifies the use of the OST for testing whether sequences of numbers are random.

Other than being implemented in the study by Doyle and Chen (2013) to test the JSE All Share Index (ALSI), there are no other known studies where the OST has been used to test market efficiency on the JSE. However, the JSE ALSI was only briefly tested in their study alongside 75 other indices from around the world and no analysis or interpretation of its results was made. In general, the use of stringent RNG tests in testing the EMH has not received much attention, and detailed analysis of the stock market using such tests seems to have been largely overlooked in South Africa so far.

2.3 Market efficiency in South Africa

In this section, we discuss past studies on market efficiency pertaining to South Africa. A summary of tests discussed in this section is included in Table 5 in the “Appendix”. There are numerous studies providing evidence for and against the EMH and the random walk model on the JSE (see Affleck-Graves and Money 1975; Hadassin 1976). The studies providing evidence against the EMH include that of Hadassin (1976), who used Von Neumann serial correlation and runs tests to determine if the share returns of 30 stocks listed on the JSE followed a random walk. The runs test analyses the number of upward price movements and downward price movements that occur in sequence before the opposite price movement or no price movement occurs. This study found correlation between historical and future price changes, therefore concluding that the JSE is not efficient and does not support the random walk model, as this may enable an investor to form a trading strategy by predicting future stock prices (Hadassin 1976). However, in this particular study a fairly short sample period was analysed (January 1971–December 1973). It may therefore be subject to time-period bias and the results may reflect other economic conditions that existed at the time. A later study tested shares from the gold mining, non-gold mining and industrial categories on the JSE for independence in price changes, using serial correlation tests and runs tests (Roux and Gilberston 1976 cited by Strebel 1977).Footnote 1 A high number of observations were found around the mean which was a result of zero returns being found in many stocks. After testing for independence, both tests provided evidence that movements in stock prices may not be entirely independent; however, as these dependencies were small and not consistent, they may not allow for an investor to continuously make profitable trades (Roux and Gilberston 1976 cited by Strebel 1977). The above two studies were reviewed by Strebel (1977) and it was suggested that their results may have been difficult to interpret due to no adjustments being made for “false” zero returns, which could be a result of thin trading, especially in smaller stocks.

It should be pointed out that many types of runs tests do not look at all of the possible patterns that may exist in stock returns and are limited to picking up autocorrelation; in addition, if the stock market alternates between positive and negative serial correlation, these effects may cancel out and cause the market to incorrectly appear efficient (Doyle and Chen 2013).

In their study using the OST, Doyle and Chen (2013) include results for efficiency on the JSE ALSI, though no analysis of the results was performed. The results suggest that during the period 1 January 1996 to 21 June 2012, the JSE ALSI displayed signs of non-randomness for a window length of 2 days, and randomness for the remaining window lengths.

Affleck-Graves and Money (1975) tested the JSE for independence in weekly stock price changes, using autocorrelation, during the period from April 1968 to September 1973. In most instances little evidence of autocorrelation was detected; in cases where dependencies were detected, the evidence was minimal and as a result would probably not be of much use to an investor in predicting stock movements. The findings of this study suggest that the JSE is weak form efficient. In Xu and Tsang’s (2007) study, mentioned earlier, in which the strength of the OST was tested, it is stated that the serial correlation test was only able to fail one RNG out of the 57 in the RNG library, compared to the 29 rejections by the OST. This demonstrates how weak some serial correlation tests can be at testing random sequences.

According to Lim (2007), many studies providing evidence in favour of the EMH implemented tests for linear dependencies in stock returns, therefore overlooking the possibility of non-linear dependencies. In South Africa, studies testing stock returns for dependencies on the JSE have generally tested for linear serial dependence. However, more recently Kruger et al. (2012) conducted a study on the JSE testing for nonlinear serial dependence in stock price changes. For the period January 2002–December 2009, the study tested 109 shares using several full period tests and episodic tests, and evidence of linear and nonlinear dependence was found in stock returns—although this dependence was not observed consistently or regularly over time. It was thus concluded that, for the sample period, the JSE was for the most part an efficient market with brief periods of inefficiency (Kruger et al. 2012).Footnote 2

Using a time varying generalised autoregressive conditional heteroskedasticity (GARCH) method as a test of evolving efficiency (TEE), Jefferis and Smith (2005) tested the JSE Actuaries ALSI for changes in efficiency over time. They found that throughout the period January 1990–June 2001 the JSE exhibited fairly constant weak form efficiency and showed no sign of changing in this regard. More recently, Bonga-Bonga (2012) applied a time varying GARCH model to weekly stock returns on the JSE. It was concluded that during the period March 1995–December 2009, the JSE was weak form efficient. The two studies above suggest that since the 1990s the JSE has been reasonably constant in exhibiting the EMH in its weak form.

Morris et al. (2009) tested the JSE for the existence of long term memory in daily stock prices on the exchange during the period January 2005 to December 2007. Autoregressive fractionally integrated moving average (ARFIMA) and wavelet analyses were used to test share returns of the JSE Top 40 Index and various sectors; each represented by a selection of shares. The results suggested that share prices have a long term memory and price changes are correlated over time, providing evidence that the JSE is not efficient, even in its weak form. The distributional properties of stock returns on the JSE were tested by Mangani (2007) using the weekly closing prices of 42 stocks from February 1973 to April 2002. He found that stock returns on the JSE were non-linearly dependent and could be predicted over time. This may provide evidence against weak form EMH. However, an observation made by Kruger et al. (2012) was that Mangani (2007) only made use of one of the many available nonlinear dependency tests, as well as having a fairly small sample size.

Variance ratio tests have also been used to test stock returns for evidence of a random walk, with the advantage of using such a test being that it can be used even when returns are not normally distributed (Jefferis and Smith 2004). Smith et al. (2002) used multiple variance ratio tests to discover whether or not the JSE ALSI follows a random walk. Weekly share price data was used from January 1990 to August 1998, over which period the JSE ALSI appears to follow a random walk. In a similar study, but with the addition of time-varying GARCH, Jefferis and Smith (2004) suggested that the JSE indices consisting of a majority of large cap stocks were weak form efficient from April 1996 to March 2001. Smaller cap indices were generally inefficient and tests of evolving efficiency did not show any indication that these indices were becoming efficient. The above study suggests several characteristics that a weak form efficient market is likely to have, including good availability and quality of information, substantial market size, frequent and continuous trading, and the presence of large cap and cross-listed stocks.

Previous studies on the JSE have not conformed to the use of a single price interval length, with some using daily share returns and others using weekly or monthly returns. Kemp and Reid (1971) suggest that the smaller the interval, the more accurate the results will be, and ideally data from each transaction could be used; however this information is not always available or practical to use. Therefore the use of daily closing share price data should be considered as this is the smallest practically feasible interval to apply. The use of an interval larger than a day can result in events or movements that have occurred on a specific day being overlooked. There is also no consensus as to whether use should be made of index data, or data at an individual share level when conducting tests of market efficiency. According to Kemp and Reid (1971) price changes observed in an index only provide an indication of the general trend of the index and may be misleading as to the degree that the individual stock prices contained in the index fluctuate. An index can hide the existence of zero price changes, which may remove some of the effects of thin trading but can hide dependencies caused by genuine zero returns at a single share level.

Thin trading can also be a cause for concern when testing stock exchanges for market efficiency, as it may lead to an interpretation of results that is misleading (Strebel 1977). This issue has been neglected by some previous studies on market efficiency and the random walk model. It is important to take trading activity into account as non-trading days may produce false zero returns, which can lead to the illusion that dependencies exists between stock returns when they may actually not (Strebel 1977). In some studies larger time intervals have been used in an attempt to reduce the impact of thin trading, as there is greater chance that a specific stock will be traded during the interval (Mlambo et al. 2003). However, this may conceal pertinent information that could exist at a daily price level. Other studies have removed zero price changes from their data to curb the issue of thin trading; however, this may incorrectly remove some zero returns that are not a result of thin trading (Mlambo et al. 2003). Genuine zero returns could arise even if a stock is traded during the period. The removal of all zero returns may therefore negatively impact the validity of results.

3 Data and methodology

In this section the data and sample period used in this paper are explained, after which the full methodology employed is presented.

3.1 Data

The full sample period used in this study is 1 March 2005–31 December 2009. The daily closing price, dividend payment and daily volume traded data for all shares listed on the JSE were obtained from McGregor BFA for this period. Shares that were not listed on the JSE throughout the entire sample period were not included in the analysis and were therefore discarded from the data set.Footnote 3 In the case where shares were suspended during the sample period the same applies. This may result in survivorship bias as only companies listed throughout the sample period were considered.

Shares in the sample were sorted according to their market capitalisation values (cap) into three categories; small, mid and large cap, with large cap being represented by the JSE Top 40 index. The shares in these categories were thus the constituents of the Top 40, Small and Mid Cap indices. A list of the constituents of each of these indices was obtained from the JSE quarterly review (Johannesburg Stock Exchange 2013). In addition to the constituents of these indices being analysed, the daily closing prices of these indices themselves were examined as well as the JSE ALSI. After removing shares which were suspended or not present for the full sample period, the remaining sample to be examined consisted of 31 small cap, 44 mid cap and 36 large cap shares; totalling 111 shares.

The sample period was further divided into two periods, a stable period and an unstable period, split similarly as in the study by Kruger et al. (2012). The stable period contains daily closing stock prices from 1 March 2005 to 31 July 2007 and the unstable period contains closing prices from 1 August 2007 to 31 December 2009. The unstable period includes a period corresponding to the 2008 financial crisis and provides some comparability to identify any differences in the efficiency of the JSE during this period. It is also advantageous to test more than one sample period in order to detect whether any time-period bias exists, that is, to obtain results that are relevant to a specific time period and will not hold over different sample periods.

3.2 Methodology

The following methodology for the overlapping serial test is adapted from the study conducted by Doyle and Chen (2013). Major differences include adjustments for thin trading, using individual share level data and the inclusion of dividend payments.

3.2.1 Thin trading adjustments

This paper uses the thin trading adjustment method proposed by Mlambo et al. (2003), which adjusts for price age as well as autocorrelation that arises from false zero returns on non-trading days. This method uses a similar calculation to the method of Atchison et al. (1987) which equally distributes the return realised at the end of a period of zero-trading over the thinly traded days. The Atchison et al. (1987) method adjusts for price age without affecting the number of observations in the time series; however, a major drawback to using this method is that it does not correct for false autocorrelation that may be present in the time series. The significant difference between these two methods is that the Mlambo et al. (2003) method completely removes zero-trade days from the time series and a single return adjustment is used to represent the change in price over several non-trading days. This corresponds with the observation made by their study that once-off price adjustments are frequently observed in thinly-traded shares. These adjustments may be delayed after information becomes available to the market, possibly due to less investors following these stocks closely compared to larger stocks, or poorly disseminated information. A potential drawback to this method is that some prices are removed from the sample as a result of thin trading, and the number of observations in the time series for each share may therefore differ significantly. The number of observations in each time series is inversely related to the amount of thin trading observed in the underlying stock. It should be noted that thinly-traded observations are removed from the time series on the basis of zero volume traded, rather than zero returns. This ensures that genuine zero returns, where a trade has taken place, are not incorrectly excluded from the analysis.

The logarithm of changes in price should be used to take into account the fact that changes in the price of a security, in monetary terms, are to some extent dependent on the magnitude of that security’s price (Affleck-Graves and Money 1975). This is done by taking the natural logarithm of the difference in daily stocks prices, including dividends paid during the period, as shown in Eq. 1,

$$\begin{aligned} R_t =\ln \left( {\frac{P_t +D_t }{P_{t-1} }} \right) \end{aligned}$$
(1)

where \(P_t \) is the closing share price on day \(t\),

\(D_t \) is the dividend received on day \(t\), and

\(P_{t-1} \) is the closing price on the previous day of trade,

Taking thin-trading adjustments into account requires the modification of Eq. 1, resulting in the following equation:

$$\begin{aligned} \widetilde{{R}_t} =\frac{1}{(\tau +1)}\cdot \ln \left( {\frac{P_t +D_t }{P_{t-(\tau +1)} }} \right) \end{aligned}$$
(2)

where \(\tau \) is the number of days in which no trade has occurred,

\(P_{t-(\tau +1)} \) is the closing price on the last day the share traded before thin trading period, and

\(\widetilde{{R}_t} \) is the return for a period of thin trading, with \(\tau \) being equal to zero if there was no thin trading period before calculating the return on day \(t\), making Eqs. 1 and 2 identical.

3.2.2 The overlapping serial test

Once the logarithmic returns had been calculated these returns were then transformed into a sequence of bits by coding returns to either 1s or 0s, using the median return to code the sample into binary. This will result in the number of 1s and 0s in the sample being equal and will make for statistical efficiency in addition to removing heteroskedasticity from the return series (Doyle and Chen 2013). The assumption that 1 and 0 have an equal probability of occurring was made as the median was used to recode returns into binary, as shown below.

$$\begin{aligned}&\hbox { If } \widetilde{{R}_t} >m \quad then \quad B_t =1\\&\hbox {If } \widetilde{{R}_t}\le m \quad then \quad B_t =0 \end{aligned}$$

where \(m\) is the median of logarithmic returns, \(\widetilde{{R}_{t}}\).

The number of possible permutations, with repetition, was calculated using \(h=2^{f}\), where \(h\) represents the number of permutations and \(f\) represents the window length in days. This provides the total number of ways that the string of bits could be arranged for a given window length, allowing for the repetition of 1s and 0s sequentially. For example, if a window length of four is chosen, there are \(h=2\cdot 2\cdot 2\cdot 2=2^{4}=16\) different possible permutations of 1s and 0s that may arise in the bit sequence.

Each of the \(h\) possible permutations that could occur are determined using a computerised model. This results in permutations including 0000, 1111, 1000, 1010, 1100, 0011 and so on until all possibilities are exhausted, for a window length of 4 days. The model then runs through the time series of bits by shifting the window across all observations and counting how many times each possible permutation actually occurs within the observed data. This is done by displacing the window by one observation to the right each time.

The number of times each permutation is expected to occur in the dataset, \(\lambda \), was calculated using Eq. 3.

$$\begin{aligned} \lambda =\frac{N-f+1}{h} \end{aligned}$$
(3)

where \(N\) is the number of return observations and \(N-f+1\) represents the number of positions that a window of length \(f\) can occupy in a time series of a given length, \(N\). A rule of thumb is suggested by Marsaglia (2005), which states that the expected number of times that each permutation occurs should be greater than or equal to 10, i.e. \(\lambda \ge 10\). This limit on the expected occurrences ensures that hypothesis testing is accurate and that the distribution of statistics is close enough to the chi-square distribution. The expected number of occurrences increases as the number of observations in the sample increases and decreases as window length increases. This will limit the maximum window length that may be used for a given time series with \(N\) observations. This maximum permitted window length may vary depending on the time series used and after thin trading adjustments the window length may vary for each share analysed, depending on the extent of thin trading observed.

The psi-square statistic was calculated using the expected number of occurrences of each permutation, \(\lambda ,\) and the actual number of occurrences of each permutation, \(C_i \), in the time series of binary. The psi-squared formula is shown below in Eq. (4).

$$\begin{aligned} \psi _f^2 =\mathop \sum \limits _{i=1}^h \frac{\left( {C_i -\lambda } \right) ^{2}}{\lambda } \end{aligned}$$
(4)

where \(C_i \) is the count of the number of times the \(i\)th pattern occurs.

The psi-square statistic is an adaptation of the chi-square test, although it is important to note that this statistic does not follow a chi-square distribution (Good and Gover 1967). Doyle and Chen (2013) suggest that this is due to the fact that overlapping windows are used in calculating the test statistic, which cause the counts of patterns to violate the assumption of independence. The first difference of the psi-square statistics may be used in order to overcome this issue of distribution, as the first differences of psi-square statistics are asymptotically chi-square.

$$\begin{aligned} \hbox {First Difference}: \nabla \psi _f^2 =\psi _f^2 -\psi _{f-1}^2 \end{aligned}$$

However, it is further recommended by Good and Gover (1967) that the second difference of the psi-squared statistics should be used in testing for randomness, as the first differences are not independent. This is because the second differences of psi-square statistics approximate a chi-square distribution and are asymptotically independent, therefore forming superior test statistics to test for randomness. The formula for the second difference psi-square statistic is shown in Eq. 5.

$$\begin{aligned}&\hbox {Second Difference}: \nabla ^{2}\psi _f^2 =\nabla \psi _f^2 -\nabla \psi _{f-1}^2\nonumber \\&\qquad \nabla ^{2}\psi _f^2 =\psi _f^2 -2\cdot \psi _{f-1}^2 +\psi _{f-2}^2 \end{aligned}$$
(5)

with degrees of freedom for the second difference statistic being, \(df=2^{v-2}\).

4 Results and analysis

Prior to the analysis of results, it should be noted that shares which had window lengths exceeding 5 days were restricted to a length of 5 days to ensure comparability between all shares and between stable and unstable periods. A window length of 5 days is the maximum length that could be reached by most shares in the sample. The rule of thumb suggested by Marsaglia (2005) (see Sect. 3.2.2) where expected occurrences of permutations greater than or equal to 10 was relaxed to 9.7 to allow the psi-square statistics of two shares, for a window length of five, to be calculated. Relaxing this assumption had no material impact on the results, as these statistics were not significant at a 10 % level.Footnote 4 Univariate statistics and the full names of companies are presented in Tables 6, 7 and 8 in the “Appendix”.

Thin trading was prevalent among small cap shares with all but three of the shares having at least one zero-trade day during the full sample period. During the stable period 81 % of small cap shares had zero-trading days. For small cap stocks 65 % had more than 1 % of their observations being zero trading days. During the unstable period 87 % of small cap stocks had zero-trading days, with 77 % of shares experiencing thin trading counting for more than 1 % of observations.

Thin trading was less common in mid cap stocks with 34 % of the shares experiencing thin trading during the stable period, and only 18 % of mid cap stocks had thin trading which consisted of more than 1 % of observations. During the unstable period 41 % of mid cap stocks exhibit thin trading with 21 % of mid cap shares having thin trading which consisted of more than 1 % of observations.

Large cap stocks experienced the least thin trading of the three categories, with 6 % of shares exhibiting thin trading to some extent, and 3 % of large cap shares having thin trading contributing to more than 1 % of observations during the stable period. For the unstable period only 3 % of large cap stocks, which was one share, displayed thin trading and this constituted 13 % of that specific stock’s daily price observations.

It can be seen that thin trading mostly affected small cap stocks during the sample period, affecting mid cap stocks somewhat less, and had minimal effect on most of the large cap stocks. Therefore it may be erroneous not to make adjustments for thin trading, considering that all three categories of shares are affected to some extent.

Tables 1 and 2 aggregate the results of the second difference psi-square statistics for constituents of the Top 40, Small and Large Cap Indices. These statistics are contained in Tables 9, 10 and 11 which are included in the “Appendix”. This aggregation is done by showing the percentage of total shares, from each category, that reject the null hypothesis of randomness at a 5 % significance level. At this level of significance there is a 5 % probability of a type I error, which is rejecting a true null hypothesis. The higher the percentage of rejections for each window length, for a given cap size, would imply that the test is indicating greater inefficiency in the respective share cap category. This is because rejections for a specific window length are a result of patterns of that window length occurring more frequently than others and therefore not adhering to randomness. In addition, if there are many rejections of shares in a given cap category for several window lengths, this could suggest that these shares may display inefficiencies for different lengths of patterns and therefore may display some predictability in price changes.

Table 1 Aggregated share level data over the stable period
Table 2 Aggregated share level data over the unstable period

During the stable period for a window length of two, the majority of small cap shares exhibited signs of inefficiency in stocks returns, with 51.61 % of the small cap constituents rejecting the null hypothesis at a 5 % significance level (see Table 1). Window lengths of 3 and 4 days both had 25.81 % of the constituents rejecting the null hypothesis. For a window length of 5 days, a lower amount of small cap shares showed signs of non-randomness in price movements, this amount is 16.67 %. For mid cap shares, 45.45 % of the constituents displayed non-random behaviour at a window length of 2 days, rejecting the null hypothesis. For all other window lengths observed there were substantially fewer rejections. The percentage of mid cap shares rejecting the null hypothesis for window lengths of 3, 4 and 5 days are 9.09, 4.55 and 9.09 % respectively. As would be expected, large cap stocks in general exhibit the least amount of non-random behaviour during the stable period, with the majority of shares failing to reject the null hypothesis that price changes are random. The window length of 2 days has the most rejections of randomness for large cap shares, with 25 % of shares displaying non-randomness in the patterns of their returns. A window length of 3 days resulted in 5.56 % of the shares rejecting randomness. The rest of the window lengths observed for large cap stocks resulted in 0 % of shares rejecting randomness, indicating a high level of randomness in price change patterns for window lengths of 4 and 5 days.

The results in Table 1 suggest that during the stable period the window length at which the most non-random behaviour, in the occurrence of patterns, appears to be at a length of 2 days. For a window length of 2 days, small, mid and large cap shares are consistent in each having their highest number of significant shares for this window length. A possible explanation is that many share price adjustments may take place over 2 days and therefore show a delayed adjustment in the share price. In this case, it would appear that smaller cap shares take longer, in days, to fully reflect price adjustments; this may be a result of smaller cap shares having less news and information available. It is also noticeable that during the stable period, as window length increases, the number of significant shares decreases for each category, with an exception being the 5 day window for mid cap shares. However, this is an observation and does not necessarily suggest that any relationship exists in this regard. Comparing small, mid and large cap results, it is clear that, in general, small cap stocks display more signs of inefficiency than do mid and large cap stocks, with mid cap stocks lying between small and large caps in terms of efficiency. Large cap stocks have the lowest percentage of null hypothesis rejections at a 5 % significance level for all window lengths during the stable period, suggesting that out of the three categories of stocks large caps are the most efficient.

Table 2 displays the aggregated results for the unstable period. During this period more than half of the small cap stocks were significant at a 5 % significance level and therefore rejected the null hypothesis for a window lengths of 2 and 5 days, where 67.74 and 51.61 % of shares displayed signs of inefficiencies respectively. Window lengths of 3 and 4 days resulted in the rejection of randomness for 48.39 and 38.71 % of small cap shares. For mid cap shares 34.09 % did not exhibit randomness in price changes for the window length of 2 days, with window lengths of 3, 4 and 5 days having 13.64, 18.18 and 9.09 % rejections respectively. The large cap shares category had a quarter or less of shares rejected at a 5 % level, with the most rejections, 25 %, occurring for a window length of 3 days. For the unstable period, the observation made for the stable period—that percentage of rejections decreases as window length increases—does not hold, except for mid cap shares.

Comparing Tables 1 and 2, it appears that in general, there are more rejections of randomness during the period containing the financial crisis, especially for small cap shares which had more rejections for each observed window length. However, mid and large cap shares had less rejections for a window length of 2 days in the unstable period than it did in the stable period. The percentage of thin trading in each share category also increased during the unstable period for small and mid cap shares but decreased for large caps, as mentioned at the beginning of this section. This may be due to investors having an increased preference for shares with greater liquidity during the crisis, than generally found among small and mid cap shares. There may be more rejections of randomness present in the unstable period as a result of investors acting irrationally during times of financial instability and crisis. It is possible that emotion has a greater impact on investors during crisis periods, when greater downside risk is prevalent. To make any significant conclusions regarding the relationship between market efficiency and the financial crisis, further testing would be required. During both periods small cap shares were consistently less efficient than mid cap and large cap shares. This suggests that small cap stocks are less efficient than their larger counterparts and therefore there may be some predictability in these stocks, especially during the unstable period. It can also be noted that the most randomness for small cap stocks was detected by a pattern length of 2 days. In order to develop a trading strategy that attempts to exploit any dependencies in small cap shares, it would need to be determined which specific patterns occur more frequently than others for each window length for which strong non-randomness is detected.

The total second difference psi-square statistics can be found in Tables 9, 10 and 11 in the “Appendix”, along with their respective degrees of freedom. Following methods used by Doyle and Chen (2013), these total statistics are calculated using the additive property of the chi-square distribution, and give an indication as to the overall significance of each window length (or pattern length) within each market capitalisation category.

Tables 3 and 4 display the second difference psi-square statistics for Small, Mid and Large Cap as well as All Share (ALSI) indices for window lengths of 2–5 days. As such, this section of the analysis was conducted using index level data and not the constituent shares as done with the previous analysis in this study.

Table 3 Results for indices over the stable period
Table 4 Results for indices over the unstable period

In Table 3, it can be seen that for the stable period the second difference psi-square statistic for the Small Cap Index is significant at a 1 % significance level for a window length of 2 days; the statistic being 14.69. Window lengths of three, four and five were not significant at a 5 % level. The Mid Cap Index only rejected the null hypothesis at a 5 % level for a window length of 2 days, with the statistic being 5.6. These significant statistics imply that there is evidence of non-random price movements in the Small Cap Index and to a lesser extent in the Mid Cap Index. The Large Cap and ALSI Indices both reject the null hypothesis for a window length of 4 days, with the Large Cap Index rejecting at a 5 % level and ALSI rejecting at a 10 % level. It may be expected that the ALSI and Large Cap Indices display similar results due to the high levels of concentration on the JSE, where large cap companies constitute the majority of the ALSI’s market capitalisation value. This results in a higher weighting being assigned to large cap shares in the ALSI Index, therefore having significant influence over its price movements relative to Small Cap stocks.

In Table 4 it can be seen that the test statistics for the Small Cap Index are all significant at a 5 % level for all window lengths observed during the unstable period, showing that the Small Cap Index displays signs of inefficiencies for these windows. The Mid Cap Index again only displays significant evidence for non-random price changes for a window length of 2 days, however this time significant at a 1 % level. For the Large Cap Index all statistics for the window lengths observed do not reject the null hypothesis and therefore suggest efficiency and random price changes for this index over the unstable period. The ALSI rejects randomness for a window length of 4 days at a 10 % level.

After observing results at a share level as well as an index level, several inferences may be made. Firstly, in every analysis conducted in this study, smaller cap stocks exhibit the strongest and most consistent evidence against the null hypothesis of random stock price movements. This provides evidence against weak form efficiency in small cap stocks and the Small Cap Index. Common attributes of small cap stocks, such as the large extent of thin trading and illiquidity, may provide indications of inefficiency. Secondly, large cap stocks and the Large Cap Index in general appear to be mostly efficient, with the majority of results proving a lack of evidence to support major dependencies in stock price movements. However, there were some constituent shares of the Large Cap Index that displayed non-random price behaviour and possible predictability, though these were few. Efficiency may be share specific or possibly a generalisation about a small group of shares that are similar in terms of some characteristics. However, to make a statement that an exchange or an all share index as a whole is efficient without observing share level data and smaller indices is perhaps too bold a statement to make. This is also due to the fact that large cap shares tend to dominate the All Share Index and may therefore veil possible inefficiencies of smaller stocks.

5 Conclusions

After using a stringent random number generator test to assess the efficiency of the JSE, evidence is mixed as to whether the exchange is efficient or not. At an individual share level it is found that the majority of small cap stocks present signs of non-randomness in price movements, and the majority of large cap stocks failing to reject randomness. Mid and large cap stocks appear to be more efficient than small caps, with efficiency seeming to be positively related to cap size. These findings are in agreement with the results obtained for the associated indices, tested using index level data. In general many stocks on the JSE appeared to present more evidence against efficiency during the period containing the financial crisis, when compared to the stable period. A possible explanation is that investors may behave more irrationally and be influenced by emotion during in times of increased uncertainty. The results also suggest that market efficiency may be a phenomenon which is isolated to specific stocks or groups of stocks with some similar attributes on the JSE. It may not be accurate to generalise about the efficiency of a stock exchange as a whole, especially on concentrated markets, such as the JSE.

Future studies could potentially use longer sample periods to enable the observation of larger window lengths and therefore longer patterns of possible dependencies. However, there is a trade-off between a large sample size and the ability to detect period specific characteristics. If too large a sample is used it may include multiple structural breaks or economic changes, and as such the results may not be a true reflection of the distribution of returns during the period, especially if returns are distributed differently during different periods. Other possible research could investigate which patterns of share returns occur more frequently for certain categories of stocks and develop trading strategies based on these findings.