The Random Walk (weak form efficient market) hypothesis is of vital importance in economics and finance to explain the behaviour of asset prices. Several authors have examined the validity and conditions under which the hypothesis holds. Most of the techniques and models used, rely on runs and serial correlation tests, however test using Markov chains are rare. Most Markov chains applications perform an stratification of returns defining the structure of the state space. The aim of this research is to detect the presence of random walk in stock market returns using Markov chains. The chain states are defined as the run lengths the process can develop. The concept of cycles is also introduced modelling the process in a more concretely. Conclusions are drawn analysing stationarity of the steady state probability distributions under diverse scenarios. The Mexican stock market daily closing prices index is analysed, covering a 16year period, finding that the random walk is not present. This result is corroborated applying conventional random walk hypothesis tests.
La hipótesis de caminata aleatoria (forma débil de mercado eficiente) es de vital importancia en economía y finanzas para explicar el comportamiento de precios bursátiles. Una gran cantidad de artículos han examinado la validez y condiciones bajo las cuales se cumple la hipótesis. La gran mayoría de las técnicas y modelos que se han aplicado para confirmar la hipótesis se han basado en pruebas de corridas y de correlación serial, siendo raro encontrar la aplicación de Cadenas de Markov. En la mayoría de las aplicaciones de Cadenas de Markov se ha realizado la estratificación del rendimiento para estructurar el espacio de estados de la cadena. El objetivo de esta investigación, es el detectar la existencia de caminata aleatoria en los rendimientos bursátiles, mediante la aplicación de cadenas de Markov. Se definen los estados de la cadena como la longitud de la corrida que el proceso pueda generar. Se introduce además el concepto de ciclos, con el propósito de modelar el proceso de forma más concreta. Se obtienen conclusiones, analizando la estacionariedad en las distribuciones de probabilidad en condiciones de estado estable, observadas en escenarios diversos. Como ejemplo de aplicación de esta técnica de análisis se toma el caso del índice de Precios y Cotizaciones (IPC) del mercado de valores mexicano, considerado un período de estudio de 16 años. Se concluye la ausencia de caminata aleatoria, y se corrobora este resultado con la aplicación de pruebas de hipótesis convencionales.
The random walk is known in stochastic processes theory to have the memoryless property or Markov property. The Markov property is fundamental in time series analysis and its validity has important implications in economics and finance.
The simple timehomogeneous Markov model is one the most popular models specifying the stochastic process by transition probabilities (
Following this line of inquiry, this paper tests the Markov property using long length as stochastic variable, it also introduces the idea of working with cycles, where a cycle is formed by the sequence of two runs of different signs. Cycles offer a simple indicator that is relatively easy to study. The transition probability matrices of runs and cycles are analysed separately, drawing conclusions from their steadystate probability distributions. This method is used to analyse the Mexican stock market prices index (IPC) covering the time period from February 2002 to January 2018, divided into two parts of equal length, obtaining three sample periods overall, period 1, period 2 and a combined period. All results indicate that the Markov property is not present, these results are corroborated with those obtained using conventional random walk hypothesis tests.
The paper is organized as follows. Section 1 presents important definitions. Section 2 introduces and performs an exploratory data analysis of the Mexican stock price dataset. Markov chain modelling is undertaken in Section 3. In section 4 random walk tests are used to corroborate results. Followed by conclusions.
The main concern of this research is to test the hypothesis that successive stock market price changes are independent, by applying the Markov chains technique, focusing on the analysis of runs. A run is a sequence of price changes of the same sign (
where
To explain these definitions a simple example is considered. Let the sequence of returns (i.e. changes) be: 1.48, 2.08, 0.04, 0.79, 1.13, 0.45, 0.83, 0.25, 0.58 (Note: it is a common practice for returns to be referred to in terms of percentages, but we omit writing % here). Considering only the signs of the variable, the following sequence is observed: +, +, . +. , . , +, +. Defining a positive run as a sequence of positive returns, a negative run as a sequence of negative returns and run length as the number of observations in a run. In this example there are three positive runs with lengths 2, 1, 2, and two negative runs with lengths 1, 3.
A
A stochastic process X =
the
Condition (2), called the
Condition (3) simply says that the transition probabilities do not depend on the time parameter n; the Markov chain is therefore "timehomogeneous". If the transition probabilities were functions of time, the process
A timehomogeneous Markov chain is entirely defined by the transition probability matrix and the initial distribution P
A Markov chain
The Mexican stock market index IPC is used to illustrate the application of this technique. The data correspond to the daily closing price observations covering a 16year period (February 2002 to January 2018) and were obtained from
Sample
Data
Returns ()
Returns (+)
Returns total
1^{st} period
2011
902
1108
2010
2^{nd} period
1999
951
1047
1998
Whole period
4010
1853
2156
4009
Source: Prepared by author
Length
Run
1
2
3
4
5
6
7
8
9
10
Total
1^{st} period
Negative
234
115
36
22
18
8
4
0
1

458
Positive
188
115
60
37
24
18
6
5
2
3
458
2^{nd} period
Negative
253
119
71
28
13
6
3
0
0
1
494
Positive
235
117
62
42
22
8
6
1
1

494
Whole.
Negative
489
234
127
50
31
14
7
0
1
1
954
Period
Positive
424
233
122
79
46
26
12
6
3
3
954
Source: Prepared by author
Length
Sample
2
3
4
5
6
7
8
9
10
11
12
13
Total
1 st period
93
105
87
60
41
26
19
13
6
4
3
1
458
2nd period
125
122
88
59
36
30
19
6
7
1
1

494
Whole period
219
228
175
119
77
56
38
19
13
5
4
1
954
Source: Prepared by author
The aim of modelling a stock market index as a Markov chain is to find out if the market may be viewed as holding the Markov property, i.e., the future is conditionally independent of the past given the present state of the process, and that the probability distribution is time homogeneous.
Investigation of the time series of returns focuses on the stochastic variable run length, in contrast to other Markov chains applications where the state space of the chain is defined by stratification of the return s level see
Let
Next run length
Previous run length
1
2
3
4
5
6
7
9
1
118
67
25
9
8
5
1
1
2
57
30
16
4
6
1
1
3
32
10
6
3
3
0
2
4
12
3
3
2
1
1

5
9
3
3
3



6
4
1
2
1



7
2
1
1




9
1






Source: Prepared by author
Next run length
1
2
3
4
5
6
7
8
9
10
Previous run length
1
74
41
28
14
11
13
2
2
1
2
2
46
33
14
13
5
2
1
0
1

3
26
15
7
4
3
1
2
1
0
1
4
18
8
4
2
2
1
0
2


5
11
8
2
1
2





6
7
4
4
2
1





7
3
1
0
0
0
1
1



8
3
1
0
1






9
1
1








10
0
3








Source: Prepared by author
Next run length
1
2
3
4
5
6
7
10
Previous run length
1
129
60
40
14
4
4
1
1
2
57
30
19
6
5
1
1

3
39
18
5
5
2
1
1

4
15
5
4
2
2



5
7
4
2





6
3
1
1
1




7
2
1






10
1







Source: Prepared by author
Next run length
1
2
3
4
5
6
7
8
9
Previous run length
1
107
59
30
17
14
5
1
1
1
2
62
23
16
9
4
2
1


3
30
12
8
9
1
1
1


4
21
12
3
4
2




5
8
7
1
3
1
0
2


6
5
2
0
0
1




7
1
1
3
0
0
0
1


8
0
1







9
1








Source: Prepared by author
Next run length
1
2
3
4
5
6
7
9
10
Previous run length
1
249
127
65
23
12
9
2
1
1
2
114
60
35
10
11
2
2


3
71
28
11
8
5
1
3


4
27
8
7
4
3
1



5
16
7
5
3





6
7
2
3
2





7
4
2
1






9
1








10
1








Source: Prepared by author
Next run length
1
2
3
4
5
6
7
8
9
10
Previous run length
1
181
101
58
31
25
18
3
3
2
2
2
108
56
31
22
9
4
2
0
1

3
56
27
15
13
4
2
3
1
0
1
4
39
20
7
6
4
1
0
2


5
19
15
3
4
3
0
2



6
12
6
4
2
2





7
4
2
3
0
0
1
2



8
3
2
0
1






9
2
1








10
0
3








Source: Prepared by author
It is assumed that all these chains are aperiodic and irreducible, so that the steady state probability vector
the
A summary of statistical measures of these steadystate distribution is shown on
1 st period
2nd period
Whole period
Negative
Positive
Negative
Positive
Negative
Positive
Mean
1.9430
2.4064
1.9190
2.1103
1.9286
2.2526
Variance
1.7485
3.1533
1.5886.
2.0848
1.6640
2.6139
Source: Prepared by author
Taking into account that the first and second periods are partition elements of the whole period with same length, an evaluation is carried out about the variation of the second central moment, so that, dividing the negative run length variance of the second period by the negative run length variance of the first period results in a decrement of about 9.14%. A similar evaluation for the positive run length variance results a decrement of about 34%. These results strongly indicate that the steadystate run length distribution does not remain stationary, concluding that the Markovian property is not held on runs.
Let
Next cycle length
2
3
4
5
6
7
8
9
11
12
13
Previous cycle length
2
14
22
20
15
7
4
7
1
0
2
0
1
3
16
19
17
14
16
9
2
7
4
0
1

4
16
26
20
9
6
2
6
1
0
1


5
21
12
10
7
4
3
1
0
1
1


6
6
10
8
5
4
5
0
1
1
0
1

7
8
5
4
2
3
2
2




8
4
6
3
3
0
0
0
2
0
0
1

9
4
1
4
3
0
0
1





10
2
0
0
2
1
1






11
2
1
1









12
1
2










13
0
1










Source: Prepared by author
Next cycle length
2
3
4
5
6
7
8
9
10
11
12
Previous cycle length
2
29
31
20
15
9
10
5
2
3
1

3
37
33
18
15
6
8
3
0
2


4
18
19
22
11
5
6
5
1



5
16
13
10
5
9
3
3




6
7
10
2
7
4
1
2
2
1


7
10
7
5
4
2
2





8
6
7
3
0
1
0
1
0
1


9
1
0
3
0
1
0
0
1



10
0
2
3
2







11
0
0
1








12
1










Source: Prepared by author
Next cycle length
2
3
4
5
6
7
8
9
10
11
12
13
Previous cycle length
2
43
54
40
30
16
14
12
3
3
3
0
1
3
53
52
36
29
22
17
5
7
6
0
1

4
34
45
42
20
11
8
11
2
0
1
1

5
37
25
20
12
13
6
4
0
1
1


6
13
20
10
12
8
6
2
3
2
0
1

7
18
12
9
6
5
4
2





8
10
13
6
3
1
0
1
2
1
0
1

9
5
1
7
3
1
0
1
1




10
2
2
3
4
1
1






11
2
1
2









12
2
2










13
0
1










Source: Prepared by author
1st. Period
2nd period
Whole period
Mean
4.3510
4.0291
4.1818
Variance
4.7469
3.8845
4.3157
Source: Prepared by author
A summary of statistical measures for these steadystate distribution is shown in
As can be seen on
In order to highlight that the cycle length distributions do not preserve timehomogeneity, the two elements of the periods analysed are taken under consideration, since they are the ones suitable for comparison because they have the same length. It is enough to observe the change in variance is about 18% from the first period to the second period, providing strong evidence that the Markov property is not present, consequently, the random walk assumption does not hold.
In order to corroborate the previous results the application of runs test and correlation tests will provide evidence about whether or not the random walk hypothesis is fulfilled.
The efficient market hypothesis (EMH) in its weakform, postulates that successive oneperiod stock returns are independently and identically distributed (IID),
Three random conventional tests are applied to the time series under study: difference sign, individual autocorrelation and joint autocorrelation.
Kendall (1976) proposed a method to detect randomness by counting the number of positive first differences of the series, which are reflected by returns (see equation 1). Let X represent the number of positive returns of a series having n1 returns. For a random series the distribution of X tends to be Normal ((nl)/2, (n+l)/12), see
Sample period
Positive
Expected
Stddev.
Confidence Interval (95%)
Decision
1^{st}. period
1108
1004.5
12.95
[979,1029]
Reject Ho
2^{nd}. Period
1047
998.5
12.91
[973,1024]
Reject Ho
Whole period
2156
2004
18.28
[1968,2039]
Reject Ho
Source: Prepared by author
For a given positive integer / the tratio is statistic defined as
where
In
The Ljung and Box statistic
where
Sample
Q(m=16)
Q(m=24)
1^{st}. period
27.66
47.92
57.58
2^{nd}. Period
30.93
45.86
54.35
Whole period
45.67
67.72
77.92
14.07
26.30
36.42
Decision
Reject Ho
Reject Ho
Reject Ho
Source: Prepared by author
All these conventional tests provide strong evidence that the null hypothesis of randomness is not held in the IPC index over the study period.
The results obtained with the application of these three methods testing randomness, build upon the first difference of the IPC time series and provide strong evidence that the random walk hypothesis is not present in the time series during the study period. The difference sign test focussing on the number of positive returns and assuming normality (Ho), rejects Ho, since the results fail within the 95% confidence interval. The other two methods used are based on individually and jointly autocorrelation tests and also provide evidence that the random walk hypothesis does not hold for the IPC time series at 5% significance level.
In this paper a new approach is introduced for the search of randomness in stock market returns. This approach involves the application of Markov chains using run length as the stochastic variable. In this analysis the concept of
Finally, we conclude that the random walk hypothesis does not hold in the IPC time series among the three periods.