{'fraction_non_alphanumeric': 0.02444508922094879, 'fraction_numerical': 0.007725228492673727, 'mean_word_length': 4.752764448153557, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Cointegration Analysis of Major African Stock Markets

Globalization, technological advancements and financial liberalization have made it possible for stock markets in different countries to interact and affect and/or influence each other both in the short-run and in the long-run. This study uses the Dickey-Fuller, Engle-Granger method and the Johansen method to test for cointegration using a pair wise analysis between the stock markets in five African countries. These countries are Nigeria, Egypt, South Africa, Morocco, and Mauritius. The Granger causality test is equally used to understand the short-run linkages between the stock markets. All statistical tests are carried out using the R statistical software. Weekly stock indices from January 2010 to December 2015 are employed, with each stock price expressed in local currency. Correlation between the stock markets is very low, with the strongest correlation coefficient being just 31% between the stock Exchange of Mauritius and the Johannesburg Stock Exchange. Cointegration analyses reveal long-run associationship between twelve, out of the twenty-one pairs of stock markets. Granger causality tests reveal bidirectional causality between the South African and Mauritian stock markets and the South African and Nigerian stock markets. Unidirectional causality was also found from the Nigerian stock market to the Moroccan stock market and from the Nigerian stock market to the Mauritian stock market. This research will help investors to invest wisely in the stock markets examined. It will equally aid economic experts and policy makers in these countries to understand the impact of a shock on economic variables on the economy.


Introduction
Stock markets play a pivotal role in the growth of industries and commercial activities in a country which eventually affects the economy of the country and the entire continent to a great extent. If there exists a stationary linear combination of non-stationary random variables, the variables combined are said to be cointegrated [1]. Globalization has made stock markets around the world not to be as independent as they used to be. Even in Africa, it may be possible to find stock markets that are interdependent and having similar trends. The existence of a single common stochastic trend among a group of stock markets implies high long-run correlations and integration among the markets [11]. This makes stock indices to be closely linked such that changes in the stock prices in one market can possibly affect the stock prices in the other markets [2]. Understanding the interaction between stock markets could have a significant impact on the formulation and implementation of market policies. This understanding will also go a long way to guide investors in the possible gains from portfolio diversification. It is therefore important to examine the degree of interdependence between stock markets especially in Africa. Several studies have been done on examining the level of cointegration between stock markets. Some of them have to do with stock markets in developed countries [3,5]. Some of those that involve developing countries either select only the main stock markets in Africa such as in South Africa and Nigeria, or simply seek to analyze the degree of cointegration between stock markets in Africa in comparison to other major stock markets in developed countries like USA and UK [4]. Even then, no research, to the best of our knowledge has been done on cointegration analysis between stock markets in these seven African countries. Hence this study is the first in investigating the degree of interdependence in the long-run between some major stock markets in Africa using the cointegration framework. These include the Nigerian, Egyptian, South African, Moroccan and Mauritian stock markets.
The objective of this research therefore, is to analyze the nature of interdependence and possible existence of a long-run cointegration relationship between pairs of the stock markets of the five African countries using their national stock price indices. The idea is to know if pairs of the stock markets of these seven African countries are cointegrated. Specifically, this research examines: 1. Whether there is evidence of bivariate cointegration between pairs of the stock markets of the five African countries (long-run relationship).
2. Whether there is evidence of Granger causality (short-run predictive ability) between pairs of the stock markets of these five African countries 3. Whether any correlation exists between pairs of the stock markets of the five African countries.
Several studies have been carried out on cointegration in international stock markets with a focus on stock markets in developed countries such as the American and European stock markets. Examples include: [5] who examined the bilateral and multilateral cointegration properties between the German and Central European Equity markets and [6] who carried out an analytical analysis of cointegration between the European Union and selected global markets following the sovereign debt crisis.
However, fewer research papers have been written on cointegration between stock markets in developing countries in general and Africa in particular. The work in [7] posits that African stock markets are not well integrated with each other and this raises important questions about the quest for a pan-African exchange. In his research paper on African stock market integration, he indicates the presence of weak stochastic trends between African stock markets and the rest of the world. Although the weak trends uncovered present an opportunity to diversify portfolio into African markets, he however argues that risk perception and institutional underdevelopment remain obstacles to the development of Africa's emerging equity markets. [7,8] carried out an empirical analysis of ten national stock markets in Africa using the cointegration technique for the period February 1997 to october 2011. These stock markets were found in the following countries; Botswana, Cote D 'Ivoire, Egypt, Ghana, Kenya, Mauritius, Morocco, Nigeria, South Africa and Tunisia. The results of their research indicated that African stock markets are not fully integrated and that big African stock market indices tend to influence fluctuations of small African stock market indices. Generally, these imply that in the African stock markets, limited benefits accrue from portfolio diversification.
[9] carried out a research on stock market integration in Africa: the case of the Johannesburg stock exchange and selected African countries. Monthly data for the period 2000-2008 was used and they employed the Johansen and Juselius cointegration method to determine the long-run relationship between the five selected African stock markets. These countries were South Africa, Botswana, Namibia, Mauritius and Nigeria. Results from that study show that African stock markets are segmented and are constantly being affected by developments in the international markets.
These findings are similar to those of [4] in his research on stock market integration in Africa. He analyzed the monthly returns of S&P/IFC return indices for ten African countries over the period 1998-2007. These countries are; Botswana, Ivory Coast, Ghana, Kenya, Mauritius, Tunisia, Egypt, Morocco, Nigeria and South Africa. He found that in spite of recent structural adjustments, African stock markets are still segmented from their global counterparts. He equally found that for each of these stock markets, the local index volatility is largely country-specific giving room for cross-country diversification.
From these findings it can be concluded that portfolio diversification opportunities exist in African markets and investors should also consider investing in African markets with the numerous opportunities African markets offer rather than investing solely in markets in developed countries.
To support these results, authors in [9] recently carried out a study on cointegration, dynamic linkage and portfolio diversification on six selected stock markets in and out of Africa over the period 2004-2016.These stock markets were in Nigeria, South Africa, Morocco, Tunisia, the New York Stock Exchange NYSE and Financial Times Stock Exchange FTSE (UK). The results were almost similar to that of [7,8,11] and showed that no cointegrated existed between Nigeria and any of the other five selected stock markets. The non -existence of a cointegrating relationship between the Nigeria market and the other markets that were considered in the research implies that these markets offer potential for pairwise portfolio diversification for a Nigerian portfolio manager.
The presence of cointegration means there is a common force which brings the market together in the long run. Greater integration among stock markets imply stronger co-movement between markets, therefore reducing the opportunities for regional diversification [10,16]. On the other hand, when stock markets are not cointegrated, it is possible for investors to diversify their investments taking advantage of arbitrage benefits. This seems to be the case with the stock market situation in Africa going by the results of past research. We will also like to extend and update the results on the nature of interdependence between some of these African stock markets between 2010 and 2015 using the cointegration framework.

Data
This study uses the closing value of weekly stock indices from stock markets in five African countries between January 2010 and December 2015. These include: EGX 30 of the Egyptian Stock Exchange, FTSE/JSE All Share Index of the Johannesburg Stock Exchange, the Morocco All Share Index (MASI) of the Moroccan Stock Exchange, the Mauritius Stock Exchange General Index (SEMDEX) and NGSE of the Nigerian Stock Exchange. All the data are sourced from www.investing.com, and are expressed in local currencies. To make the data smooth and stabilize its variance, all the stock indices are converted into its natural logarithms.

Methodology
In this section, the data are tested to determine whether they are stationary or not. This is because only non-stationary data have the possibility of being cointegrated.

Test for Non-Stationarity (Unit Root)
A (weakly) stationary time series is one whose statistical properties such as mean, variance and autocovariance are all constant over time [11,15]. Time series data points are said to be non-stationary when they have means, variances and autocovariances that change over time. Most statistical forecasting methods are based on the assumption that the time series is stationary. Meanwhile, a greater majority of time series in the social, economic and biomedical sciences are non-stationary. The Augmented Dickey-Fuller (ADF) test will be used to test for the presence of a unit root in the data.

Dickey-Fuller Test
Consider the time series where t ε is the error term (white noise) with mean zero and constant variance . If α = 1, the series has a unit root and hence is non-stationary and is stationary if α < 1. Unfortunately, it is not possible to simply regress t Y on 1 t Y − and find out if the estimated α is equal to 1 or not because in estimation by the Ordinary Least Squares (OLS) technique, the hypothesis that α = 1 by the usual t-test is biased in the presence of a unit root. Subtracting

Augmented Dickey-Fuller (ADF) Test
The Dicker-Fuller test is based on the assumption that the error term t ε is white noise. However, in most time series data, t ε usually show signs of serial correlation when there is autocorrelation in the dependent variable of the regression ( t Y ∆ ). When this happens, the test becomes 'oversized. In order to solve this problem, Dickey and Fuller developed a test known as the Augmented Dickey-Fuller (ADF) test in which the Dickey-Fuller test was 'augmented' using p lags of the dependent variable. As a result the regression equation is presented as; 1 1 .
Sometimes an intercept (constant) may be included as well as a trend such that the model becomes; The parameter of interest in the ADF test is β .
If 0 β = , then t Y contains a unit root and hence is non-stationary. The number of lags to use is determined using various information criteria. In this study, the Akaike Information Criterion (AIC) will be used. Determine the test statistic given by; Test statistic = the test statistic with the critical value from the Dickey-Fuller table. If the test statistic is less than the critical value, the null hypothesis that there exists a unit root is rejected and the conclusion is that the series is stationary. The decision to reject or not to reject the null hypothesis of 0 β = is based on the Dickey-Fuller critical values of the τ (tau) statistic.

Engle-Granger Method of Cointegration.
Let t Z be a 1 k × vector of variables. The components of the vector t Z are said to be cointegrated of order a vector α (≠0) exists so that ' The vector α is called the cointegrating vector (see for example [11,12,13]). Taking the case in which 1 d = and 1 b = , that is the components in the vector t z are all integrated of order one, if a linear combination α of these components exist, then the resultant series t z is stationary. The Engle-Granger method is a single equation technique that is used to test for cointegration between two variables; an independent and a dependent variable. The procedure to perform this test is as follows; Pre-test each variable to ensure that they are both non-stationary and I (1) using the ADF test.
Run the OLS equation where t u is the error term (residuals), t Y is the dependent variable and t X is the explanatory variable. If cointegration holds, the OLS estimator in the equation above is said to be super-consistent (β converges in probability to its true value β at a rate proportional to the inverse of the sample size).
The residual t u  are stored and subjected to a unit root analysis to determine whether they are stationary or not using the ADF test. The hypotheses for the Engle-Granger test are as follows; Ho: t u ~I (1) that is t u  contains a unit root and hence is non-stationary (Null Hypothesis) Ha: t u ~I (0) that is t u  does not contain a unit root and hence is stationary (Alternative Hypothesis) If the null hypothesis is rejected, the variables are cointegrated. Finally, the residuals are then used as one of the variables to form and estimate an error correction model to analyze the cointegration relationship between the cointegrated variables.

Error Correction Model (ECM)
Error correction models are a class of models that allow long-run components of variables to obey equilibrium constraints while short-run components have a flexible dynamic specification [14,16]. The idea behind error correction is simply that a proportion of the disequilibrium from one period is corrected in the next period. According to the Granger Representation Theorem, if variables are cointgerated, then there always exists an ECM.
Consider the dynamic autoregressive distributed lag (ARDL) model describing the behaviour of Y in terms of X as follows; Through reparameterisation, this can be written as  (8), current changes in Y have been expressed as a function of current changes in X and the degree to which the two series are outside of their equilibrium in the previous time period ( 1 ). In the model above, 1 b measures the immediate impact a change in t X will have on a change in t Y and Π shows the rate at which any disequilibrium in the previous period is adjusted in the present period. The Π should be negative and significant [14] and [15]

The Johansen Method of Cointegration.
One of the drawbacks of the Engle-Granger test is that it can only identify one cointegrating vector even when there are many variables in the equation. An alternative for testing whether or not cointegration exists among time series variables is called the Johansen test [12]. This is a procedure for testing cointegration between several (1) I variables. The Johansen test method is able to identify all cointegration vectors in a system of variables [13].
Consider the vector autoregression (VAR) of order p given by Where t X is an 1 n × vector of variables of order one and t ε is an nx1 vector of innovations which is iid (0, ∑ ) and 1 ,......., p Π Π are n n × matrices of coefficients.
This can be written as The matrix Π can be defined as; Where β gives the cointegrating vectors the elements of α are called the adjustment parameters in the VECM.
To carry out the Johansen test, two likelihood ratio tests are performed to detect cointegration and the number of cointegration vectors (Enders, 2015): The trace test with test statistics given by: The Trace test is a joint test and tests the null hypothesis that the number of cointegrating vectors is less than or equal to r against the alternative hypothesis of more than r cointegrating vectors.
The maximum eigenvalue test with test statistic given by: The maximum Eigenvalue test conducts separate tests on each Eigenvalue and tests the null hypothesis of r cointegrating vectors against the alternative hypothesis of r+1 cointegrating vectors.
T is the sample size (number of observations) and i λ  is the estimated Eigenvalue of order i from the ∏ matrix.

Granger Causality Test
While the concept of cointegration is used to verify whether there exists a long-run equilibrium relationship between variables, Granger causality is used to investigate the existence of short-run causality relationships among the variables.
A stationary time series t X is said to granger cause another stationary time series t Y if it can be shown, usually through a series of t-tests and F-tests on lagged values of t X (and with lagged values of t Y also included) that those t X values provide statistically significant information about future values of t Y [14]. Let t X and t Y be two stationary time series with zero means. Using a simple causal model, t X and t Y can be written using the vector VAR model as: 1 1 .
In eq (14) t X is the dependent variable and has been expressed in terms of its lagged values and the lagged values of t Y (dependent variables). In the above equation (15) t Y is the dependent variable and has been expressed in terms of its lagged values and those of t X . t ε and t η are two non-correlated white noise series. If 0 i b ≠ in equation (14), then t Y is said to Granger cause t X . Similarly, if 0 i c ≠ in eq (15) then t X is said to Granger cause t Y . If however, both 0 i b ≠ and 0 i c ≠ , then there exists bidirectional causality between t X and t Y [12,13]. To carry out a Granger causality test to determine whether t Y granger causes t X , the following hypotheses are tested.
Null Hypothesis The test statistics follow a 2 χ distribution with p degrees of freedom (df) under the null hypothesis, where p is the optimal lag length.

Results and Discussion
The graphs of the natural logs of the stock indices are shown in Figure 1. The impact of the August 8, 2011 global stock market fall (popularly called Black Monday) can be seen with a sharp drop in national stock prices for the Egyptian Stock Market EGX 30 and the Nigerian stock market NGSE. The graphs in Figure 1 also indicate that the data may be non-stationary since the mean and variance are changing with time.
The graphs of the returns are equally shown in Figure 2. The graphs seem to be moving back and forth around the zero point. This is known as mean reversion which is a characteristic of stationary time series. Since the time series showed non-stationary behaviour, taking the first difference seems to make the time series to be stationary. This gives an indication that stock market indices could possibly be I (1) processes. This needs to be confirmed with formal statistics tests. Table 1 contains the descriptive statistics for the returns. Descriptive statistics are used to describe the basic features of the data. These include the Mean, Median, Maximum, Minimum, Standard Deviation, Skewness, and Kurtosis. The average returns for the South African and Morroccan stock markets are all the same (1%) and 0% for the rest of the stock markets. The Nigerian stock market has the highest volatility of 73% followed by the Moroccan stock market with a volatility of 69%. The Egyptian and Mauritian stock markets have very low volatility of 28% and 24% respectively. All the stock indices are negatively skewed with the Mauritian stock market having the highest negative skew value. The weekly returns for all the stock markets have positive excess kurtosis values that is far above that for a normal distribution which is around three.

Correlation.
Correlation measures the strength and direction of a linear relationship between two variables. Table 2 shows the correlation matrix for pairs of stock returns. The strength of the correlation relationship is very low with the strongest being just 31% between the Stock Exchange of Mauritius and the Johannesburg Stock Exchange and the weakest being almost no correlation at all between the Moroccan and South African Stock markets and the Mauritian and Egyptian stock markets. Generally, there exists very little mutual interdependence between the stock markets. However, correlation merely, gives short run insights into the linear relationship between variables.
In order to know about the long run equilibrium relationship, further empirical tests still need to be carried out.

Non-Stationarity Test Results
With the ADF test, the Null hypothesis says the time series is non stationary while the Alternative hypothesis says the time series is stationary. If the test statistic is less than the critical value, the null hypothesis is rejected in favour of the alternative hypothesis. The result obtained using the software package R is shown on Table 3. The critical values for the ADF tests extracted from the software R are -2.58, -1.95 and -1.62 at 1%, 5% and 10% levels of significance respectively. The values of the test statistic for the log levels of the stock indices are greater than the critical values at all the levels of significance. Therefore, the null hypothesis cannot be rejected and the conclusion is that the stock market indices contain a unit root and are therefore non stationary at all the levels of significance.
Meanwhile, the test statistic for the first stock returns are all less than the critical values at all the levels of significance. This means that the null hypothesis is rejected and hence, the first difference is stationary. Since the first difference of the stock market indices are stationary (I (0)), this means the stock market indices are integrated of order one (I (1)). Given that the stock market indices are all integrated of order one, it is possible that there exists cointegration between them. This will now be verified using statistical tests for cointegration, the first being the Engle-Granger test.

Engle-Granger Cointegration Test Result
The Engle-Granger cointegration test will be used to determine whether or not any pairs of the five stock markets are cointegrated. This will be done by verifying whether a linear combination of any of the two stock market indices is stationary. Since there are five stock markets, the test will be applied to ten pairs to see if each pair is cointegrated. When the test statistic is more negative than the critical value (that is, less than the critical value), the null hypothesis of no cointegration is rejected is rejected in favour of the alternative hypothesis at the appropriate level of significance. Otherwise, we fail to reject the null hypothesis. The result for the Engle-Granger test is shown on Table 4.

Johansen Cointegration Test Result
Although the Johansen test is best known to test for cointegration in a multivariate situation, it can equally be used for a bivariate approach [12] to test for cointegration between pairs of stock indices. The Akaike Information Criteria (AIC) is used to select the optimal lag length. The results are displayed in Table 6.

Granger Causality Test Result
The Granger causality test is used to test the Null hypothesis of no Granger causality against the Alternative hypothesis of Granger causality using the weekly stock market indices for the seven selected African countries. If there exists Granger causality between two stock markets, then it means the history of the stock prices of one market contributes to the prediction of the stock prices of the other stock market. This test is applied between pairs of stock markets. The Granger causality test is applied to stationary data. Therefore, the first difference of the weekly returns of the stock prices is used in this study. The Granger causality test is very sensitive to lag lengths; as such different lag lengths will give different results. This study has employed the Akaike Information Criteria (AIC) to select the optimal lag-length for the Granger test. When the p-value is less than 5%, the null hypothesis of no Granger causality is rejected in favour of the alternative hypothesis. The result is displayed in Table 7.

Estimates of Error Correction Model
So far, it has been shown, through the Engle-Granger method and Johansen method that some of the stock markets are cointegrated. However, these methods say nothing about the dynamics of the re-equilibrium processes. Research in [16] have suggested that this process can be specified in a so-called Error Correction Model (ECM) for the cointegrated stock markets. The estimated ECM between the cointegrated variables are as shown in Table 8.   Note: *, **, *** means cointegrated at the 10%, 5% and 1% levels of significance respectively.

Conclusion
The objective of this paper was to investigate whether pairs of stock markets from five selected African countries are cointegrated in the long-run and whether any causal relationship exist between them in the short-run . All the five stock market indices are found to I (1). Correlation between pairs of the stock indices is weakly positive for some pairs of stock markets and weakly negative for others. Bidirectional Granger causality exists between the South African and Mauritian stock markets and the South African and Nigerian stock markets. Equally, the Nigerian stock market Granger causes both the Moroccan and Mauritian stock markets. It can be seen here that, in the short-run, the Nigerian stock market is very influential in the chosen sample. This means that whatever happens in the Nigerian stock market influences what will happen, in the future to the South African, Moroccan and Mauritian stock markets. Investors in the South African, Moroccan and Mauritian stock markets therefore should watch out on what is happening in the Nigerian stock market. The Engle-Granger and Johansen methods indicate that out of the ten pairs of stock markets, three pairs are not cointegrated while the rest are cointegrated in the long run. The ECM confirms the long run cointegrated relationship between the seven stock markets with the coefficient of the error correction term being negative. Investors can therefore invest simultaneously in the Egyptian and South African, Egyptian and Mauritian, and South African and Mauritian stock markets since they are not cointegrated. The cointegrated stock markets however do not offer any opportunity for portfolio diversification since what happens in one stock market will, in the long run affect the other stock market to which it is cointegrated.