UNIVERSITY OF THE WITWATERSRAND, JOHANNESBURG DOCTORAL THESIS Stock Price Prediction in Sub-Saharan Africa Author: Dennis MUREKACHIRO Supervisor: Dr. Thabang-Mokoaleli MOKOTELI & Dr.Hima VADAPALLI A thesis submitted in fulfillment of the requirements for the degree of Doctor of Philosophy in the Finance Wits Business School November 29, 2020 http://www.university.com http://www.university.com http://www.johnsmith.com http://www.jamessmith.com http://www.jamessmith.com http://www.jamessmith.com http://researchgroup.university.com http://department.university.com iii Declaration of Authorship I, Dennis MUREKACHIRO, declare that this thesis titled, “Stock Price Prediction in Sub-Saharan Africa” and the work presented in it are my own. I confirm that: • This work was done wholly or mainly while in candidature for a research de- gree at this University. • Where any part of this thesis has previously been submitted for a degree or any other qualification at this University or any other institution, this has been clearly stated. • Where I have consulted the published work of others, this is always clearly attributed. • Where I have quoted from the work of others, the source is always given. With the exception of such quotations, this thesis is entirely my own work. • I have acknowledged all main sources of help. • Where the thesis is based on work done by myself jointly with others, I have made clear exactly what was done by others and what I have contributed my- self. Signed: D.Murekachiro Date:29.11.2020 v “The greatest challenge to any thinker is stating the problem in a way that will allow a solution.” Bertrand Russell vii UNIVERSITY OF THE WITWATERSRAND, JOHANNESBURG Abstract Faculty of Commerce, Law and Management Wits Business School Doctor of Philosophy Stock Price Prediction in Sub-Saharan Africa by Dennis MUREKACHIRO Investors, researchers and practitioners are continuously exploring various ways to understanding stock market price movements and the development of techniques that can assist them in accurately predicting the stock markets and improve on in- vestment decision making and policy making. This study sought out to develop a prediction model for stock markets, determine which factors move stock prices and investigate the inefficiency of 11 selected stock markets. In order to predict the stock markets, this study made use of deep learning prediction models (LSTM, RNN, GRU, BLSTM, BRNN, BGRU) and statistical GAM in ten sub-Saharan African coun- tries (Botswana, Egypt, Kenya, Mauritius, Morocco, Nigeria, South Africa, Tunisia, Zambia, Zimbabwe) and the S&P500 (USA). Stock markets are predictable with inef- ficiencies found for the African stock markets as evidenced through calendar anoma- lies and high prediction accuracies whilst the lower prediction results for the S&P500 indicate market efficiency. The prediction model greatly improved prediction accu- racy. However, there is no remarkable difference between unidirectional and bidirec- tional prediction models accuracy results for the eleven countries concerned. GAM statistical approach outperformed compared to all deep neural networks architec- tures in this study. The varying results for each country point to the uniqueness of each market confirming the varying market ecologies. In addition, this study also investigated the effect of macroeconomic variables (inflation, money supply, inter- est rates, exchange rates) on stock prices. Time series analyses were implemented through Johansen cointegration and Granger causality tests for short and long run relationships between macroeconomic variables and each stock market. Overall, em- pirical results for the African stock markets reveal a negative association between closing price and exchange rates, a positive relationship between money supply and closing stock prices for all countries. Mixed results for the other variables for each country attest to the fact that stock markets are unique and are influenced differently by these macroeconomic variables. Notably, African stock markets relate differently to macroeconomic variables as compared to developed stock markets. Stock mar- ket predictions were run on a python 3.5 environment using deep learning libraries Theano, Tensorflow, and Keras and Scikit learn and the time series analysis was an- alyzed using stata13 and R 3.6 software. Keywords Stock prices, African stock markets, Prediction, Deep neural networks, Macro-economic variables, decision making, GAM. . HTTP://WWW.UNIVERSITY.COM http://faculty.university.com http://department.university.com ix Acknowledgements It is my sincere gratitude to the Almighty Lord for giving me the power to success- fully complete this research work. I also express my sincere gratitude to my supervisors, Dr Thabang Mokoaleli-Mokoteli and Dr Hima Vadapalli for their outstanding support in this PhD journey. Without them, this could have not been an easy journey to travel. Special thanks go to my family who supported me entirely throughout the research journey. Your ability to understand and absorb the work pressures from this research work is greatly appreciated. I would like to express my sincere gratitude to fellow WBS colleagues and work colleagues who supported me with ideas and suggestions during the compilation of this research work. Finally, I also convey my gratitude to all input from colloquiums and research conferences where insights were drawn to perfect this research work. May all those that made this research a reality be richly blessed by the Almighty God. xi Contents Declaration of Authorship iii Acknowledgements ix 1 Introduction 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Research Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 Research Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4 Research Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.5 Contribution to the Body of Knowledge . . . . . . . . . . . . . . . . . . 12 1.6 Benefits of Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.7 Structure of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.8 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2 Theoretical Underpinning of the Study 17 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2 Efficient Market Hypothesis . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.3 The Adaptive Market Hypothesis (AMH) . . . . . . . . . . . . . . . . . 19 2.3.1 Calendar Anomalies . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.4 Complex Adaptive Systems Theory . . . . . . . . . . . . . . . . . . . . 24 2.5 The Arbitrage Pricing Theory (APT) . . . . . . . . . . . . . . . . . . . . 25 2.6 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3 Literature Review 27 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.2 Role of Stock Market . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.2.1 Role of Stock Market in National Economic Growth . . . . . . . 27 3.2.2 Role of Stock Market in Investor Wealth Maximization . . . . . 28 3.3 Stock Markets Characteristics and their Prediction Challenges . . . . . 29 3.4 Factors that Influence the Stock Market Performance . . . . . . . . . . 29 3.4.1 Macroeconomic Factors in Share Price Movements . . . . . . . 29 3.4.2 Microstructure Structure Variables Influencing Stock Price Move- ments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.5 Stock Market Prediction Models and their Performance in Nonlinear Dynamic Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.5.1 Statistical Approaches to Stock Price Prediction . . . . . . . . . 37 3.5.2 Artificial Neural Networks for stock Price Prediction . . . . . . 38 3.5.3 Predicting using Machine Learning Techniques . . . . . . . . . 38 Closing Stock Price Prediction . . . . . . . . . . . . . . . . . . . 38 Market Direction Prediction . . . . . . . . . . . . . . . . . . . . 42 Trading Strategy Models for Stock Prediction . . . . . . . . . . . 45 Sentiment Analysis in Stock Price Prediction Initiatives . . . . . 47 Time-series, regression and other models for stock prediction . 48 xii Deep Learning models for stock price prediction . . . . . . . . . 50 3.6 Conceptual Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.7 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4 Stock Price Prediction Models 57 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 4.2 Statistical Approaches to Stock Price Prediction . . . . . . . . . . . . . . 57 4.3 Artificial Neural Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4.4 Deep Learning Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 4.4.1 Motivation for use of Deep Learning Architectures . . . . . . . 58 4.4.2 Recurrent Neural Networks . . . . . . . . . . . . . . . . . . . . . 58 4.4.3 LSTM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.4.4 GRU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 4.5 Bidirectional Prediction Architectures . . . . . . . . . . . . . . . . . . . 63 4.5.1 Bidirectional RNN . . . . . . . . . . . . . . . . . . . . . . . . . . 63 4.5.2 Bidirectional LSTM and BGRU . . . . . . . . . . . . . . . . . . . 64 4.6 Evaluation Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.7 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 5 Research Methodology 67 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.2 Prediction Framework using Machine Learning Techniques . . . . . . . 67 5.3 Data and Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.4 Predicting African Stock Markets Using Different Algorithms . . . . . 69 5.4.1 Statistical Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 5.4.2 Machine Learning Prediction Algorithms . . . . . . . . . . . . . 71 Deep Neural Networks . . . . . . . . . . . . . . . . . . . . . . . 71 5.5 Training Results for DNN Architectures . . . . . . . . . . . . . . . . . . 81 5.6 Econometric Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 5.6.1 Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 5.6.2 Unit root testing . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 5.6.3 Order of Integration . . . . . . . . . . . . . . . . . . . . . . . . . 85 5.6.4 Johansen Cointegration Test . . . . . . . . . . . . . . . . . . . . . 85 5.6.5 Granger Causality . . . . . . . . . . . . . . . . . . . . . . . . . . 86 5.7 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 6 Research Findings 87 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 6.2 Performance of DNN Models in Predicting Stock Market Index Price . 87 6.3 Performance of GAM in Predicting Stock Market Price Index . . . . . . 97 6.3.1 Graphical Representation of Botswana Prediction Results . . . . 98 6.3.2 Seasonal Components of the Forecast Time Series for Botswana Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 6.4 Prediction Results for Egypt . . . . . . . . . . . . . . . . . . . . . . . . . 100 Graphical Representation of Egypt Stock Exchange Results . . . 100 6.4.1 Seasonal Components of the Forecast Time Series for Egypt Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 6.5 Prediction Results for Mauritius . . . . . . . . . . . . . . . . . . . . . . . 101 6.5.1 Graphical Representation of Mauritius Prediction Results . . . 101 6.5.2 Seasonal Components of the Forecast Time Series for the Stock Exchange of Mauritius . . . . . . . . . . . . . . . . . . . . . . . . 101 xiii 6.6 Prediction Results for Morocco . . . . . . . . . . . . . . . . . . . . . . . 101 6.6.1 Graphical Representation of Morocco Prediction Results . . . . 101 6.6.2 Seasonal Components of the Forecast Time Series for the Stock Exchange of Morocco . . . . . . . . . . . . . . . . . . . . . . . . . 102 6.7 Prediction Results for Nigeria . . . . . . . . . . . . . . . . . . . . . . . . 103 6.7.1 Graphical Representation of Nigeria Prediction Results . . . . . 103 6.7.2 Seasonal Components of the Forecast Time Series for Nigeria Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 6.8 Prediction Results for South Africa . . . . . . . . . . . . . . . . . . . . . 103 6.8.1 Graphical Representation of South Africa Prediction Results . . 103 6.8.2 Seasonal Components of the Forecast Time Series for Johan- nesburg Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . 104 6.9 Prediction Results for Tunisia . . . . . . . . . . . . . . . . . . . . . . . . 104 6.9.1 Graphical Representation of Tunisia Prediction Results . . . . . 104 6.9.2 Seasonal Components of the Forecast Time Series for Tunisian Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 6.10 Prediction Results for Zimbabwe . . . . . . . . . . . . . . . . . . . . . . 105 6.10.1 Graphical Representation of Zimbabwe Prediction Results . . . 105 6.10.2 Seasonal Components of the Forecast Time Series for Zimbabwe Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 6.11 Prediction Results for Zambia . . . . . . . . . . . . . . . . . . . . . . . . 106 6.11.1 Graphical Representation of Zambian Prediction Results . . . . 106 6.11.2 Seasonal Components of the Forecast Time Series for Lusaka Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 6.12 Prediction Results for Kenya . . . . . . . . . . . . . . . . . . . . . . . . . 107 6.12.1 Graphical Representation of Kenya Prediction Results . . . . . 107 6.12.2 Seasonal Components of the Forecast Time Series for Nairobi Stock Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 6.13 Prediction Results for S&P 500 . . . . . . . . . . . . . . . . . . . . . . . . 107 6.13.1 Graphical Representation of S&P 500 Prediction Results . . . . 107 6.13.2 Seasonal Components of the Forecast Time Series for S& P500 . 108 6.14 Prediction Summary on GAM . . . . . . . . . . . . . . . . . . . . . . . . 108 6.15 Time Series results for sub Saharan African stock market indices . . . . 113 6.15.1 Unit root testing . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 6.15.2 Multivariate Regression Results . . . . . . . . . . . . . . . . . . 113 6.16 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 7 Summary and Conclusions 125 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 7.2 Summary and Conclussion . . . . . . . . . . . . . . . . . . . . . . . . . 125 7.3 Future Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 A PUBLICATIONS 1 129 B PUBLICATIONS 2 131 xv List of Figures 3.1 Conceptual Framework 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.2 Conceptual Framework 2 . . . . . . . . . . . . . . . . . . . . . . . . . . 56 4.1 Recurrent Neural Networks . . . . . . . . . . . . . . . . . . . . . . . . . 59 4.2 LSTM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.3 GRU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 4.4 Bidirectional RNN Architecture . . . . . . . . . . . . . . . . . . . . . . . 63 4.5 BLSTM Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.6 Bidirectional GRU Architecture . . . . . . . . . . . . . . . . . . . . . . . 65 5.1 Prediction Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 5.2 Volatility of Selected African Markets and S& P500 . . . . . . . . . . . . 69 5.3 Histograms for Botswana Input Variables . . . . . . . . . . . . . . . . . 73 5.4 Density Plots for Botswana Input Variables . . . . . . . . . . . . . . . . 74 5.5 Box and Whisker Plots for Botswana Input Variables . . . . . . . . . . . 74 5.6 Scatter Plots for Botswana Input Variables . . . . . . . . . . . . . . . . . 75 5.7 Correlation HeatMap for Botswana Input Variables . . . . . . . . . . . 75 5.8 Prediction Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 5.9 RNN and BRNN Architecture in Explaining Window Size . . . . . . . 80 6.1 Critical Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 6.2 Graphical Representation of GAM Results for Botswana Stock Exchange100 6.3 Seasonal Components of the Time Series for Botswana Stock Exchange 101 6.4 Graphical Representation of GAM Results for Egypt Stock Exchange . 102 6.5 Seasonal Components of the Time series for Egypt Stock Exchange . . 103 6.6 Graphical Representation of GAM Results for Stock Exchange of Mau- ritius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 6.7 Seasonal Components of the Time Series for Stock Exchange of Mau- ritius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 6.8 Graphical Representation of GAM Results for Morocco Stock Exchange 106 6.9 Seasonal Components of the Time Series for Morocco Stock Exchange . 107 6.10 Graphical Representation of GAM Results for Nigeria Stock Exchange 108 6.11 Seasonal Components of the Time Series for Nigeria Stock Exchange . 109 6.12 Graphical Representation of GAM Results for Johannesburg Stock Ex- change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 6.13 Seasonal Components of the Time Series for Johannesburg Stock Ex- change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 6.14 Graphical Representation of GAM Results for Tunisian Stock Exchange 112 6.15 Seasonal Components of the Time Series for Tunisian Stock Exchange . 113 6.16 Graphical Representation of GAM Results for Zimbabwe Stock Ex- change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 6.17 Seasonal Components of the Time Series for Zimbabwe Stock Exchange115 6.18 Graphical Representation of GAM Results for Lusaka Stock Exchange 116 xvi 6.19 Seasonal Components of the Time Series for Lusaka Stock Exchange . 117 6.20 Graphical Representation of GAM Results for Nairobi Stock Exchange 118 6.21 Seasonal Components of the Time Series for Nairobi Stock Exchange . 119 6.22 Graphical Representation of GAM Results for S&P 500 . . . . . . . . . 119 6.23 Seasonal Components of the Time Series for S&P 500 . . . . . . . . . . 120 A.1 Publication 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 B.1 Publication 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 xvii List of Tables 3.1 Expected Stock Price and Macroeconomic Variable Relationships for African Stock Markets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.1 African Stock markets’ Characteristics . . . . . . . . . . . . . . . . . . . 68 5.2 Six Steps in Designing a GAM Forecasting Model . . . . . . . . . . . . 70 5.3 Six Steps in Designing a Deep Neural Network Forecasting Model . . . 72 5.4 Normalized Data for Botswana Stock Exchange . . . . . . . . . . . . . . 76 5.5 Stock Market Application Period and Sample Splits . . . . . . . . . . . 76 5.6 RNN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.7 LSTM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.8 GRU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.9 BRNN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 5.10 BLSTM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 5.11 BGRU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 5.12 Summary of Training Results for Botswana . . . . . . . . . . . . . . . . 81 5.13 Summary of Training Results for Egypt . . . . . . . . . . . . . . . . . . 81 5.14 Summary of Training Results for Kenya . . . . . . . . . . . . . . . . . . 82 5.15 Summary of Training Results for Mauritius . . . . . . . . . . . . . . . . 82 5.16 Summary of Training Results for Morocco . . . . . . . . . . . . . . . . . 82 5.17 Summary of Training Results for Nigeria . . . . . . . . . . . . . . . . . 82 5.18 Summary of Training Results for South Africa . . . . . . . . . . . . . . 83 5.19 Summary of Training Results for Tunisia . . . . . . . . . . . . . . . . . . 83 5.20 Summary of Training Results for Zambia . . . . . . . . . . . . . . . . . 83 5.21 Summary of Training Results for Zimbabwe . . . . . . . . . . . . . . . . 83 5.22 Summary of Training Results for S&P500 . . . . . . . . . . . . . . . . . 84 5.23 Lagged Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 6.1 Summary of Prediction Accuracy Results . . . . . . . . . . . . . . . . . 88 6.2 Stock Market Predictions . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 6.3 Summary of Prediction Results for Botswana . . . . . . . . . . . . . . . 91 6.4 Summary of Prediction Results for Egypt . . . . . . . . . . . . . . . . . 91 6.5 Summary of Prediction Results for Kenya . . . . . . . . . . . . . . . . . 92 6.6 Summary of Prediction Results for Mauritius . . . . . . . . . . . . . . . 92 6.7 Summary of Prediction Results for Morocco . . . . . . . . . . . . . . . . 92 6.8 Summary of Prediction Results for Nigeria . . . . . . . . . . . . . . . . 92 6.9 Summary of Prediction Results for South Africa . . . . . . . . . . . . . 93 6.10 Summary of Prediction Results for Tunisia . . . . . . . . . . . . . . . . 93 6.11 Summary of Prediction Results for Zambia . . . . . . . . . . . . . . . . 93 6.12 Summary of Prediction Results for Zimbabwe . . . . . . . . . . . . . . 93 6.13 Summary of Prediction Results for S& P500 . . . . . . . . . . . . . . . . 94 6.14 Summary Prediction Results for Botswana Stock Exchange- LSTM . . . 94 6.15 Summary Prediction Results for Egypt Stock Exchange- LSTMM . . . . 94 6.16 Summary Prediction Results for Nairobi Stock Exchange -BGRU . . . . 95 xviii 6.17 Summary Prediction Results for Stock Exchange of Mauritius – BGRU 95 6.18 Summary Prediction Results for Stock Exchange of Morocco – BGRU . 95 6.19 Summary Prediction Results for Nigerian Stock Exchange- LSTM . . . 96 6.20 Summary Prediction Results for Johannesburg Stock Exchange- BRNN 96 6.21 Summary Prediction Results for Tunisia Stock Exchange- LSTM . . . . 96 6.22 Summary Prediction Results for Lusaka Stock Exchange- LSTM . . . . 97 6.23 Summary Prediction Results for Zimbabwe Stock Exchange- RNN . . 97 6.24 Sample of Empirical Results for GAM Predictions . . . . . . . . . . . . 99 6.25 Sample of Botswana GAM Prediction Results for Contrarian Strategies 99 6.26 Summary of Weekly and Monthly Highs and Lows . . . . . . . . . . . 109 6.27 Augmented Dickey Fuller Unit root tests results . . . . . . . . . . . . . 121 6.28 Multivariate Regression results . . . . . . . . . . . . . . . . . . . . . . . 122 6.29 Summary of Closing price to macroeconomic variables relationships . 122 6.30 Previous Studies on Closing Price and Macroeconomic Relationships . 122 xix List of Abbreviations ADF Augmented Dickey Fuller AMH Adaptive Markets Hypothesis ANN Artificial Neural Networks APT Arbitrage Pricing Theory ARCH Autoregressive Conditional Heteroscedasticity ARIMA Autoregressive Integrated Moving Average ARMA Autoregressive Moving Average BGRU Bidirectional Gated Recurrent Unit BLSTM Bidirectional Long Short Term Memory BRNN Bidirectional Recurrent Neural Network CAS Complex Adaptive Systems Theory CNN Convolutional Neural Network CPI Consumer Price Index DNN Deep Neural Networks EMH Efficient Market Hypothesis GAM Generalized Additive Models GARCH Generalized Autoregressive Conditional Heteroscedasticity GRU Gated Recurrent Unit IFS International Financial Statistics LSTM Long Short Term Memory MAD Mean Absolute Deviation MAE Mean Absolute Error MAPE Mean Absolute Percentage Error MSE Mean Square Error PEH Proxy Effect Hypothesis POCID Point of Change in Direction RMSE Root Mean Square Error RNN Recurrent Neural Network RWT Random Walk Theory SVM Support Vector Machine xxi Dedicated To my wife, Joyline and my Children; Anochengetaishe, Anodaishe and Anoshamisaishe 1 Chapter 1 Introduction 1.1 Introduction The accurate prediction of stock price movements enables investors to make de- cisions on whether to take long or short-positions on the stock and thereby make profit (Chai et al., 2015). Predicting the stock market movement requires a model that can accurately predict future prices (Taran et al., 2015). The aim of this research is to determine the extent to which deep neural network architectures and gener- alized additive models can accurately predict the stock market movement to aid in financial and investment decision making and to determine the factors that underlie such movement. 1.2 Research Background The role of stock market in the economy is to provide liquidity to financial asset own- ers (Almomen, 2016; Masoud, 2013), capital formation for economic growth (Sulong et al., 2018; Ngare and Nyamongo, 2014; Enisan and Olufisayo, 2009), hence acting as a barometer of economic performance (Dagar, 2014), and risk reduction by offering opportunities for risk diversification (Ezeoha et al., 2009). The presence of a well, efficient functioning stock market system aid in mobilisation of limited resources from the surplus units to deficit units, hence promoting the efficient allocation of resources and leading other economic sectors in their growth process. Previous studies (eg. (Pasquale, 2006)) document a positive relationship between stock market and economic growth and argue that when stock market rises, in- vestors have the motivation to spend more because they feel wealthier and as a result the economy expands. On the other side, if the stock prices go down, in- vestors tend to spend less, so the economic growth decreases. The stock market can be regarded as a good measure to forecast future economic growth and explain some applications of financial literatures. (Levine and Zervos, 1996)in their research on the linkages between stock mar- kets and long-run economic growth using 41 countries from 1976 to 1993, provided evidence that stock market is positively and significantly correlated to future eco- nomic growth and capital accumulation. On the other hand, critics to these find- ings based their arguments on the evidences that positive correlation between stock market and economic growth could be easily captured in some emerging countries which are characterized by their boom stock markets and catching-up growth, but when it comes to developed countries, hardly does this relationship exist. Stock market is not only important for economic development, but reasonably accurate prediction of stock market is important to investors for developing trading strategies and for hedging against potential market risks which enable speculators 2 Chapter 1. Introduction and arbitrageurs to profit by trading in stock index (Leung et al., 2000). In addi- tion, successful forecasting of stock prices generates substantial monetary rewards (Wei, 2016; Gocken et al., 2016; Nayak et al., 2015) and is a very large and profitable area to pursue (Kim and Han, 2016). These economic rewards motivate researchers, investment professionals and average investors to continuously pursue such accom- plishments (Oztekin et al., 2016; Wang et al., 2016; Reid et al., 2014; Hsu, 2013; Liang et al., 2011; Lawrence, 1997). However, the task of predicting stock market is challenging because of multiple, non-predictable factors that impact on the stock market such as natural disasters, political instabilities, varying economic climates, etc. In addition, the prediction of the stock market is made even more difficult by the fact that stock markets are complex, evolutionary and nonlinear dynamical systems. Furthermore, the fore- casting of stock market is characterized by data intensity, noise, non-stationarity, high uncertainty, hidden relationships, deterministically chaotic data, randomness, volatility, irregularity and seasonality (Shan et al., 2015; Sanjeev, 2015; Liu and Hu, 2013; Kazem et al., 2013; Lu, 2013; Hsu, 2013; Wong and Versace, 2012; Araujo, 2012; Mohapatra et al., 2012; Araujo, 2010; Mostafa and Atiya, 1996; Hall, 1994). All the aforementioned characteristics of the stock market make its prediction challenging for most investors, asset managers and academia (Zhong and Enke, 2017; Anish and Majhi, 2016; Shan et al., 2015). An attempt to predicting the stock market contradicts the long standing finance theories of Efficient Market Hypothesis (EMH) and Random Walk Theory (RWT). EMH states that stocks are informationally efficient, implying that it is impossible to predict the direction of the stock market based on the trading data. EMH can be explained by weak form, semi-strong form and strong form. The weak form market efficiency states that no one can utilize public information to acquire higher returns other than the return that is adjusted via market risk. This argument implies that no one can beat the market (Zhang et al., 2017b) and there is no possibility of economic profits (Plastun et al., 2020). In general, EMH argues that no amount of information would be useful in helping one to make predictions about an asset’s returns (Chu et al., 2019). The RWH is directly consistent with the EMH in that it assumes that stock prices resemble a random walk process where innovation to the prices is permanent. This implies that stock prices change randomly and that market prediction based on past return history of prices is difficult (Lawal et al., 2017; Oztekin et al., 2016). Stock prices move entirely in a random and unpredictable manner with every price change happening without any influence from past prices (Patel and Marwala, 2006) but only through new information or news (Gyamerah et al., 2019; Cavalcante et al., 2016). In other words, successive price changes are independent and identically distributed (Oztekin et al., 2016). Stock prices are independent of one another and this assumption is valid as long as information of the past behaviour of price series changes cannot be used to increase expected gains (Agwuegbo et al., 2010). RWT therefore purports that price changes have no memory and the past cannot be used to predict future prices effectively (Cavalcante et al., 2016). In contrast to EMH and RWH, there is also a large body of literature that demon- strate that the stock market is actually inefficient and with appropriate tools and tim- ing of the stock market, investors can predict the stock market and yield abnormal returns Patel et al. (2015b). Market inefficiency is exhibited through the existence of calendar anomalies in stock markets (Al-Khazali and Mirzaei, 2017). Investors and traders, who generate their trading strategies based on the identified calendar anomalies in a pursuit to increase returns, attain abnormal profits (Norvaisiene et al., 1.2. Research Background 3 2015). In other words, calendar effects or anomalies are amongst prominent reasons for the occurrences of abnormal returns (Zhang et al., 2017b). Evidence from the US market which was tested for the January effect, Decem- ber effect and Mark Twain effect inefficiencies revealed that the January effect was the most outstanding one and produced opportunities for market participants to profit (Plastun et al., 2020). It was also found that US stock market short sellers use well-known equity anomalies in their shorting strategies by using short arbitraging strategy to exploit potential overpricing and short avoidance strategy to stay away from underpriced firms (Wu and Zhang, 2019). Focusing on the Islamic markets, (Wasiuzzaman, 2018) discovered that religious sentiment is important in influenc- ing return and volatility of the Saudi stock market during the Hajj pilgrimage with low returns and high volatility during this cultural/religious anomaly. The presence of calendar anomalies in the Gulf Cooperation Council affords money managers with a chance to optimally time their trades based on daily and monthly price fluctuations (Ariss et al., 2011). In another study, it was found out that 27 out of 167 equity anomalies studied for Islamic stocks were found to prof- itable (Zaremba et al., 2018). Further evidence of exploitable day of the week calen- dar anomalies for maximising investment return are noticed in 28 indices of stock markets in 25 countries studied by Zhang et al. (2017b). In addition to empirical evi- dence from use of the calendar anomalies to evidence stock market inefficiency, there is also a vast body of literature that defies the EMH and RWT by revealing different useful prediction initiatives to gain substantial gains. These are performed either through fundamental analysis, technical analysis, time series and machine learning methods or a combination of the four categories (Gocken et al., 2016; Ghezelbash and Keynia, 2014). Fundamental analysis is useful for long term prediction (Sreelekshmy et al., 2017) by using global economic, industrial and business indicators to determine intrinsic value of a company’s stock (Cervello-Royo et al., 2015). It is based on the princi- pal that the market value of a stock tends to move towards its real value or intrinsic value (Qian and Gao, 2017). Thus, fundamental analysis mainly focuses on the listed firm operations, conditions and financial status in an effort to determine the intrin- sic value of a firm’s stock and forecast the future profits (Chen and Wang, 2015). In other words, fundamental analysis attempts to make predictions based on data regarding the structure of the economy i.e. inflation rates, trading volumes, inter- est rates, unemployment percentages, demands for the company products (Gunduz and Cataltepe, 2015) or simply it studies the economic factors that may influence market movements (Cavalcante et al., 2016). Though macroeconomics data has significant influence on stock returns by pos- sessing a significant impact on the growth and earnings prospects of the underly- ing firms (Tsai and Hsiao, 2010), fundamental analysis has a limitation in that the macroeconomic data or factors used are subjective (Cavalcante et al., 2016). Choos- ing economic factors that can be used as indicators of other variables future be- haviour requires understanding of the delayed influences of relationships between many variables since many factors interact with the stock market. Thus attempts to pick the most influencing economic factors are not easy for fundamentalists (Oliveira et al., 2013). To avoid such subjectivity, this current work will focus more on machine learning algorithms that can mine data for key influencing variables. On the other hand, technical analysis which is founded on the principles of the Dow Theory is useful for short term predictions (daily, weekly or monthly) by us- ing historical prices to predict the future prices (Gunduz and Cataltepe, 2015) un- der the assumption that past behaviours have an effect on the future evolution of 4 Chapter 1. Introduction prices (Cervello-Royo et al., 2015). Technicians often model the historical behaviour of a financial asset as a time series with the belief that history tends to repeat itself (Cavalcante et al., 2016). Technical analysis, also known as charting believes that trends and patterns of an investment instrument’s price, volume, breadth and trad- ing activities reflect most of the relevant market information that a decision maker can utilise to determine its value (Tsai and Hsiao, 2010). It has been found to be more profitable to take trading decision using a combination of technical analysis with computational intelligence tools (Dash and Dash, 2016; Hu et al., 2015; Hsu, 2013; Dai et al., 2012; Texeira and Oloveira, 2010). With great computational power, researchers can use computational intelligent systems alone to make useful predic- tions, such as is implemented in this current research. Smarter intelligent systems that require less human intervention in choice of technical variables but can pick on its own the relevant prediction factor inputs are needed. The prediction of time series models with traditional methods is an attempt to design linear prediction models (univariate models and multivariate regression models) to track patterns in historical data (Oliveira et al., 2013). Vast linear models such as autoregressive moving average (ARMA), autoregressive integrated moving average model (ARIMA) and nonlinear traditional time series models such as au- toregressive conditional heteroscedasticity model (ARCH) and generalised ARCH (GARCH) have been proposed and applied to economic forecasting (Wei, 2016). Al- though these models have been vastly used, if data is from economic or financial factors, it is difficult to expect reasonable prediction performance because of recip- rocal and complex influences among the factors (Park and Shin, 2016). Financial time series are essentially complex, highly noisy, dynamic, nonlinear, nonparamet- ric and chaotic in nature (Cavalcante et al., 2016). It is on this premise that this cur- rent research will adopt machine learning models in order to capture the complex dynamics of stock markets. Machine learning is a vibrant subfield of computer science that draws on models and methods from statistics, algorithms, computational complexity, artificial intel- ligence, control theory, and a variety of other disciplines. Its primary focus is on computationally and informationally efficient algorithms for inferring good predic- tive models from large data sets, and thus is a natural candidate for application to problems arising in high frequency trading, both for trade execution and the gener- ation of alpha or excess returns (Kearns and Nevmyvaka, 2013). Machine learning methods use a set of data samples to draw (linear or nonlinear) patterns so as to ap- proximate the underlying function which generates the data (Oliveira et al., 2013). Machine learning techniques have been applied with relative success in modelling and predicting financial time series (Cavalcante et al., 2016). It is the intent of this research to design a prediction model that increases prediction accuracy of machine learning techniques. There are different machine learning techniques that have been applied for stock market predictions such as support vector machines (SVM)- (Kumar, 2016; Zhang et al., 2016; Chen and Lee, 2015; Fenghua et al., 2014; Luo and Chen, 2013; Lee, 2009); artificial neural networks (Persio and Honchar, 2016; Bisoi and Dash, 2014; Ruxanda and Badea, 2014; Liang et al., 2011); ensemble methods (Mabu et al., 2015; Ma et al., 2015; Kourentzes et al., 2014)and genetic programming (Hsu, 2011; Chen et al., 2009). The most used amongst these are SVMs and ANNs or their combina- tion with other algorithms.In most cases, the machine learning approaches to stock prediction attempt to address portfolio optimization, investment strategy determi- nation and market risk analysis initiatives(Liang et al., 2011). To this end, a number of different stock price prediction initiatives has been noted. 1.2. Research Background 5 Founded on the structural risk minimisation principle and statistical learning theory, the SVM is one of the most effective machine learning algorithms for classi- fication problems (Zhang et al., 2016). The basic idea of SVM is data transformation into a higher dimensional space and finds a classification hyper-plane that separates the data with the maximum margin. (Kumar et al., 2016) apply a proximal SVM to 12 market indices1 and found out that the highest testing accuracy for 9 out of 12 stock indices considered in this study were achieved by the Random Forest- proxi- mal SVM model. The highest accuracy was 62.72% for CNX Nifty. In another experiment, (Luo and Chen, 2013) integrated a piecewise linear rep- resentation and weighted SVM (PLR-WSVM) for stock trading signal prediction for the Shanghai stock exchange in China. In comparison to other models, the PLR- WSVM performed better with highest accuracies for downtrend, steady trend and uptrend being 44.50%, 39.04% and 44.56% respectively. By combining SVM to a hy- brid feature selection tool named F-score and supported sequential forward search (F_SSFS). (Lee, 2009) attained an average accuracy ranging from 85.5% to 88.5% for the NASDAQ stock market whilst (Fenghua et al., 2014) achieved a 67.98% direc- tional symmetry for the Shanghai Stock exchange using singular spectrum analysis- SVM hybrid model. All these experiments are focusing on stock market trend classi- fication. A consideration of stock market trend direction together with the absolute price prediction is ideal, a gap this current research focuses on with the intention to increase prediction accuracy from the low accuracies achieved by SVM related models. Artificial neural networks (ANNs) and their variants have largely been used for stock price prediction (Persio and Honchar, 2016; Peace et al., 2015; Ruxanda and Badea, 2014; Xi et al., 2014; Bisoi and Dash, 2014; Liang et al., 2011). Artificial Neural networks mimic the human brain, its nervous system and the human’s brain ability to classify patterns to make predictions based on past experiences (Karymshakov and Abdykaparov, 2012). In other words, neural networks are massively parallel systems comprising highly interconnected, interacting processing elements (neu- rons) that are based on neurological models. A key limitation of neural networks is that knowledge is not stored within individual processing units but is represented by the weight between units (Lu, 2010). A procedural artificial neural network (PNN) was compared to back propaga- tion neural networks, hidden markov model and SVM for yahoo stocks and it was found out that the space first PNN outperformed other model and attained a hit rate or accuracy of 68.9% (Liang et al., 2011) in correctly predicting the next day’s actual price. ANNs were also used to forecast the Istanbul stock exchange and attained av- erage accuracies of 70% (Karymshakov and Abdykaparov, 2012). (Ghezelbash and Keynia, 2014) designed an ANN to predict the Tehran stock exchange and attained 58.02% prediction accuracy. If simple ANN models could attain such prediction ac- curacy levels, a noble task to focus on would be to determine if prediction accuracy increases with the use of knowledge or memory retention models for stock predic- tion, a gap this current research attempted to address. Notably, there is a growing consensus that model combination has advantages over selecting a single model in terms of accuracy and error variability (Kourentzes et al., 2014). An ensemble is a pool of base learners whose outputs are mediated by a pre-defined rule (Joao et al., 2014). In other words, ensemble learning is where several classifiers are created and the overall classification is done by combining 1S&P BSE Sensex (India), DAX (Germany), Hang Seng (Hong Kong), Jakarta Composite (Jakarta), KLSE Composite (Korea), Euronext 100 (Europe), CNX Nifty (India), Nikkei 225(Japan), NYA Com- posite (USA), Russell 3000(USA), Straits Times (Singapore) and Taiwan Weighted (Taiwan). 6 Chapter 1. Introduction results generated by the classifiers (Mabu et al., 2015). The combination is able to complement the errors made by the individual classifiers on different parts of the input space (Tsai et al., 2011). (Chen et al., 2007) implemented flexible neural tree ensembles to NASDAQ and S&P CNX Nifty while (Tsai et al., 2011)predicted stock returns by classifier ensembles for the Taiwan stock market.The aim of (Tsai et al., 2011) study was to investigate the prediction performance that utilizes the classi- fier ensembles to analyse stock returns. Average accuracy for homogenous MLP classifier ensembles and heterogeneous classifier ensembles was 65.8% and 66.63% respectively for Taiwan stock market. Single classifiers attained average accuracy of 61.58%. From theses results, it is shown that classifier ensembles perform better than single classifiers do. In addition, (Ma et al., 2015) used tank based ensemble pruning for financial time series using the Dow Jones Industrial Average, Glaxo- Smithkline, Hangsen Index and Johnson Outdoors indices with point of change in direction (POCID) accuracies of 58.73%, 54.81%,69.02% and 59.34% respectively. De- spite combining classifiers as one of the prediction models , relative success was achieved by the ensemble methods. Therefore, a search for other models that can increase prediction accuracy is essential. In a study by (Nayak et al., 2016), a stock prediction model that combines histor- ical prices and financial news sentiments was implemented to predict stock market trend and attained a prediction accuracy of 70% in the Indian stock market. In con- sideration of the work by (Bhardwaj et al., 2015) in using sentiment analysis for the Indian stock markets of Sensex and Nifty, the study demonstrated that sentiment analysis can be used for stock price prediction,analysing stock market conditions and for investment strategy determination. However, the paper does not report on accuracy levels or performance as measured by error metrics. (Smailovic et al., 2014) implemented a stream bases active learning for sentiment analysis in the financial domain which was combined to a SVM sentiment classifier. Owing to the fact that there are no publicly available large hand-labeled data for sentiment analysis of twit- ter data, the authors resorted to a Stanford university tweets database. In another study, (Nguyen et al., 2015) performed sentiment analysis for 18 US market stocks from Yahoo finance and achieved a best result of 54.41 % accuracy level. The goal of (Nguyen et al., 2015) study was building a prediction model to predict the stock price movements (up or down) using the sentiment from social media. (Li et al., 2014) performed sentiment analysis on the Hong Kong stock ex- change and attained prediction accuracies ranging from 18% to 69% for the utility stocks predicted. Two key issues regards sentiment analysis are availability of tweets which are beyond the reach of many, hence very few applications have been done in this area. Secondly, for studies on sentiment analysis for stock price prediction, relative success has been achieved with highest accuracy of 70%. The inclusion of news as input variables has not yielded better results as compared to other historical prices based models. A more recent technique of machine learning in stock price prediction is deep learning. (Minh et al., 2018) implemented a deep learning approach for stock trend prediction based on a two stream gated recurrent unit work using both financial news and sentiment dictionary and attained a prediction accuracy of 66.32% for the S&P500. The TGRU stock trend prediction model used in this study outperformed GRU and LSTM models.Focusing on the same market, the S&P500, prediction accu- racies based on alpha values and beta values of 62.27% and 65.08% were achieved re- spectively (Oncharoen and Vateekul, 2018). Focusing on the Taiwan stock exchange, (Gao et al., 2018) implemented a share price trend prediction model using convolu- tional recurrent neural networks combined with the long term short memory model 1.2. Research Background 7 (ConvLSTM) and achieved an average error rate of 3.449 RMSE. Results were bet- ter as compared to the LSTM alone. In another experiment for the Taiwan stock exchange, the least RMSE error rate of 0.76 for Iron and Steel stock was achieved through use of LSTM in comparison to 8 other stocks in the same market. An accuracy of 59% was achieved using the LSTM for the Ibovespa index from the BM&F Bovespa stock exchange. In addition, three learning architectures namely recurrent neural network (RNN), LSTM and CNN were compared against the ARIMA for stocks from the Nifty index in India. Results revealed that deep learning models outperformed the ARIMA model in stock prediction for the Indian stock market. A need to ascertain if deep learning models superiority over statistical models holds for African emerging and frontier markets is crucial, a gap that this current research focused on. (Chen et al., 2015) also implemented the LSTM model for Shangai and Shenzen indices in China and managed to improve prediction accuracy from 14.3% to 27.2% from the alternative methods compared to the LSTM. Most of DNN imple- mentations took a comparative approach of models for the same market and failed to explain why the models perform differently in their discussion of results. In ad- dition, only a few DNN models i.e. RNN, LSTM, CNN and GRU were implemented for stock price prediction. The bidirectional architectures of these models were not explored in stock price prediction, a dimension that this current study focuses on. African stock markets have also been predicted using various techniques includ- ing some of the previously mentioned models. Traditional time series models such as ARIMA and GARCH have been extensively applied for the Nigerian stock mar- ket. (Adebiyi et al., 2014)implemented stock price prediction using the ARIMA model for the Nigerian stock exchange and New York stock exchange. After sev- eral experiments, the best ARIMA model for zenith bank index was 1, 0, 1 and for nokia was (2, 1, 0) with adjusted R² of 0.9972 and 0.0033 respectively. The Nigerian stock exchange was inefficient whilst the US market proved to be efficient. Though the R² of Zenith bank was high, an increasing deviation of predicted values from ac- tual values was noticeable over the one month-ahead prediction, hence making the results questionable. In another study, (Olayiwola et al., 2016) determined that an ARIMA (1, 1, 2) was successful in predicting stock returns of the All share index of the Nigeria stock exchange. Contrasting results on ARIMA’s ability to estimate the Nigerian all share index were found by (Isenah and Olubusoye, 2014) who implemented two artificial neural network based models (tech 4-3-1 and tech 3-3-1) and compared them to a baseline ARIMA (3,0,1) model in predicting the Nigerian stock exchange. The neu- ral networks and ARIMA had directional accuracies of 45.45%, 45.45% and 27.27% respectively. A need to develop a better prediction model(s) is essential as results show that both ANNs and ARIMA failed to predict the Nigerian All share index. (Ajao and Wemambu, 2012) implemented an ARCH to estimate return and volatil- ity prediction for the Nigerian stock market. Experimental results showed that about 67%, 77%, 56% and 65% of the systematic variations in Mobil, First Bank, Nigeria brewery and Nestle stock prices respectively are explained by past stock prices and stock price volatility. (Ibrahim, 2017)also found ARCH models ((ARCH (1); GARCH (1,1);TARCH (1,1); EGARCH(1,1) and PGARCH(1,1)) to be efficient whilst ARIMA was not efficient in developing volatility models for the Nigerian stock exchange. ARIMA models (3,1,3; 1,1,3 and 3,1,1) implemented in the experiment suffered from autocorrelation and ARIMA models (3,1,3; 1,1,3; 3,1,1; 2,1,2; 2,1,3 and 3,1,2) suffered from heteroscedasticity and were not normally distributed, rendering all the ARIMA models implemented unreliable and not efficient to estimate the forecast of the Nige- rian All share index. EGARCH (1,1) was found to be most efficient method out of all 8 Chapter 1. Introduction the estimated ARCH family models as it has the least Akaike information criterion (AIC) and Schwarz information criterion (SIC). In another study, the GARCH (1,1) model was determined to be the best model to explain stock return volatility in Nige- ria (Emenike, 2010). The ARCH family models are better predictors of the Nigerian All share index. However, there exists a need to compare ARCH prediction perfor- mance with other prediction models, especially intelligent machine learning models due to their better learning and adaption ability. Taking a different approach, (Okoro, 2017)implemented fundamental analysis by investigating the effect of macroeconomic factors on the Nigerian stock exchange performance. An R² of 27.8 was attained implying that the macroeconomic factors used (gross domestic products, money supply, interest rate, inflation rate and ex- change rate) cannot be used to predict performance of the Nigerian stock exchange. In another study by (Ajekwe and Ibiamke, 2018) used financial statement analysis to predict stock returns of listed consumer goods in Nigeria. About 34.4% to 46.7% variations in the equity returns according to the R² were found predictable through a combination of 14 accounting ratios using a univariate logit regression model. When using a multivariate logit equity returns regression model, financial statement anal- ysis was able to predict accurately stock returns by 76.6%. The key limitation of this study was use of a small sample of 111 observations only in contrast to other studies that used more than 11 000 observations (Ou and Penman, 1989). With regards to technical analysis prediction of African stock markets, (Dotti, 2016) focused on the profitability of technical trading rules based on ANN for the Kenyan stock market. The Nairobi stock exchange 20 index was used for this study owing to data availability. The percentage of correctly predicted signs for the bear market, stable market and bull market were 50%, 60% and 42% respectively. A need to develop better prediction models is essential. In addition, comparative studies using the same technical trading rules based on ANN for other African stock ex- changes are necessary in order to test usefulness of the model. Notably, the bulk of prediction initiatives for African markets are implemented through various machine learning models. (Berradi and Lazaar, 2019)implemented an integration of principal component analysis with recurrent neural networks to forecast the stock price of Casablanca stock exchange. The mean square error of the test data was 0.00596 compared to 0.011835 without use of principal component analysis. Using a fuzzy-neural intelligent trading model for stock price prediction, (Umoh and Inyang, 2009) obtained a 78% certainty that there will be a rise in stock prices for the Nigerian stock exchange. An MSE of 0.222 was attained for this ex- periment. In another experiment that used a rough set theory predictive model for Johannesburg stock exchange, (Khoza and Marwala, 2011) achieved an accuracy of 80.4% using a standard voting classifier. (Quahilal et al., 2016) optimised stock market prediction for the Moroccan stock exchange by using a hybrid approach based on Hodrick-Prescott filter and support vector regression. The Maroc Telecom financial time series was used and results show that the SVR-HP model had the best mean absolute percentage error. In an- other study, (Akinwale et al., 2009) implemented error back propagation ANNs for predicting the Nigerian stock exchange and attained prediction accuracies of 11.3% and 2.7% on translated and untranslated Nigerian stock market prices. Also focusing on the Nigerian stock exchange, (Kareem and Adeoti, 2016) used discriminant analysis and ANN to predicting the Nigerian stock market. Discrimi- nant analysis was able to classify with 29.6% classification accuracy while the ANN posted a 72.2% accuracy level. In another experiment, (Patel and Marwala, 2006) attempted to forecast the Dow Jones Industrial Average (DJIA), Johannesburg Stock 1.2. Research Background 9 Exchange All Share, NASDAQ 100 and the Nikkei 225 Stock Average indices using neural networks. The highest prediction for JSE All Share was 67.5%. In addition, the use of GARCH family models with ANNs has also been extended to the Moroc- can stock market (Elbousty et al., 2019). The results point to the efficiency of neural networks in enhancing the performance of GARCH models. (Mohamudally-Boolaky et al., 2019) implemented a support vector machine for predicting the Stock Exchange of Mauritius. The results obtained for this study showed that percentage accuracy ranged in between 60% and 70%. In another ex- periment for the Moroccan stock market, (Labiad et al., 2016), developed a short term prediction framework to forecast the Moroccan stock market. Up and down future trends of the market on a 10 to 60 minutes ahead basis were done using MLP and LSTM. The MLP had an average precision of 65% whilst the LSTM had an av- erage 74% precision. In another experiment, (Gyamerah et al., 2019) implemented a stock price model using stacking ensemble learning method on the Nairobi stock exchange. The stacking ensemble learning method which used two base learners (Adaptive boosting and KNearest neighbours) and a gradient boosting machine as the meta-classifier outperformed the two individual classifiers. Accuracy levels were at 78.1% and had a kappa of 55.16%. From the preceding cited studies, it can be concluded that African markets are inefficient and predictable though there are inconclusive author perspectives on the matter for certain African stock exchanges. For example, (Lawal et al., 2017) found the Nigerian stock exchange to be inefficient as shown from results of the Morlet’s wavelet analysis which reject the random walk for all Nigerian All share stock ex- change index. Thus arbitrage opportunities exist in the Nigerian stock exchange. However for the same market, (Agwuegbo et al., 2010) found out that the Nigerian stock exchange follows a random walk. Investment strategies based on past infor- mation were found not to yield to higher returns as price formation is believed to be a stochastic process. This study shows that stock price changes have no memory of the past history and purport that stock prices in Nigeria is a martingale. In other words, knowledge about the past is of no use in predicting future stock prices owing to the fact that prices are random. In consideration of the afore-mentioned literature, first,it can be noted that sev- eral prediction approaches have been implemented for portfolio optimization, in- vestment strategy determination and stock market risk analysis. However, most of the initiatives were directed towards trend prediction and a need to come up with absolute stock price prediction models remains a necessity. Second,other key ques- tions still need to be addressed. Are African markets inefficient and predictable? Is there potential of increasing prediction accuracy for African stock exchanges? Can better prediction models be developed for emerging and frontier African stock ex- changes in spite of the fact that most markets are illiquid, volatile, inefficient, are faced with narrowness of the markets (Mustapha and Ahmed, 2019; Mohamudally- Boolaky et al., 2019; Lawal et al., 2017). 10 Chapter 1. Introduction 1.3 Research Problem Ideally, stock price prediction models should simulate real stock markets and aid portfolio holders to effectively manage their financial resources and maximize re- turns. Successful prediction of the stock market addresses a key challenge of finan- cial decision making under uncertainty in modern finance and leads to the attain- ment of substantial monetary rewards (Nayak et al., 2015). Successful prediction ini- tiatives with prediction accuracies closer to or equal to 100% are the most desirable. They provide pathways for investors to take proactive and knowledge driven deci- sions in order to achieve successful gain with less investment risk (Dash and Dash, 2016). Investment risk is reduced by selecting the type of securities for investment, the amount for investment and the timing of the investment using information from the prediction process (Zahedi and Rounaghi, 2015). However, ongoing attempts to predict stock market prices have been made difficult by the problem of increasing complexity of stock markets marked by increasing nonlinearity and evolutionary dynamism (Lo, 2004). Although there is a vast amount of literature on ARIMA and ARCH models in the prediction of African stock markets, a heavy concentration is on the Nigerian stock exchange with the following studies (Adebiyi et al., 2014; Isenah and Olubu- soye, 2014; Ajao and Wemambu, 2012)amongst many. Results generalisations cannot be done for other African stock exchanges. Statistical or time series prediction mod- els such as ARIMA have failed to accurately predict stock markets and support max- imization of investor returns due to two reasons. One, ARIMA models are limited in time series prediction because of their linearity characteristic which fails to predict most real-world problems which are nonlinear in nature (Araujo, 2010) like the stock market and for lack of long term temporal dependencies in their prediction. Two, ARIMA models and their variants are infrequently used for prediction initiatives be- cause of their high computation costs. These models are unlikely to predict the best returns for investors as they cannot model relationships between hidden layer states efficiently, learn from them, and forecast into the future as evidenced by low predic- tion accuracies of 27% in a study by (Isenah and Olubusoye, 2014) for the Nigerian all share index. In addition different ARCH models results for the Nigerian stock exchange were also noted without any consensus on which is the best model. Research on the value of computational finance intelligent systems to predict stock price movements in emerging and frontier markets is fewer in number al- though it is now growing. There is evidence that emerging and frontier stock mar- kets are inefficient and this provides greater incentives to forecast returns (Lawal et al., 2017). However, a few concerns arise from the African stock market pre- dictions initiatives. Firstly, most of the studies conducted make use of the Nige- rian stock exchange dataset for statistical, fundamental, machine learning and deep learning models. Model generalizations cannot be done to other stock exchanges, hence instituting a need to conduct more prediction initiatives in other stock mar- kets. Concerns have also been raised regards to the size of the datasets used being regarded as small like in the use of financial ratios for predicting the Nigerian stock exchange by (Ajekwe and Ibiamke, 2018). A need to make use of large datasets for developing prediction models is necessary. Secondly, a lack of cross stock market analysis is noticeable in most studies giv- ing rise of a need to do comparative studies for various stock market indices using the same prediction models. Where comparisons were done, there were for the same market. In addition, no adequate explanations were proffered for the difference in performance of the proposed algorithms. To date, there is no clear understanding of 1.4. Research Objectives 11 how African emerging and frontier markets behave and there are no explanations on the major drivers of stock price movements through computational financial in- telligence. Thirdly, past African stock market predictions are mainly classification problems focusing on up and down trends of stock prices. Few studies focused on the regres- sion of time series using machine learning models. In addition, very few studies also focused on a combination of classification, regression and market direction pre- dictions in one study, a gap that this study will implement as it contributes to the computational finance domain. In other words, this research is a combination of fundamental, technical and computational intelligent systems in predicting selected African stock markets. Fourthly, few deep neural networks have been implemented in African stock ex- changes. Where there have been implemented, consideration was on unidirectional architectures for a few stock exchanges. There are no bidirectional deep neural net- works that have been applied to African stock exchanges. In addition, not much is known about the importance of deep neural networks to stock market predictions, either at African or international levels. Despite the fact that deep neural networks have been extensively used for other predictions, their application to financial time series is still scanty. A need to assess the usefulness of deep neural networks in fron- tier, emerging and developed financial markets is a necessity. Therefore, a study on the usefulness of deep neural networks to African stock markets is essential and should be benchmarked to developed stock exchange predictions. The majority of predictions done in African stock exchanges have not been benchmarked to devel- oped stock markets. Overall, African stock markets are small in size, illiquid, volatile, face issues on lack of trading transparency with the exception of the Johannesburg stock exchange and Egyptian stock exchange. The existence of persistent volatility swings in African stock markets demand prediction models with memory states to learn subsequent behaviour shaped by previous responses. Existing predictive models (including sta- tistical and other machine learning models) are devoid of memory and sequential learning capability. Hence, a model which supports data driven decisions learn- ing from its past and future states to aid investor decision making and improve on prediction accuracy is required. Furthermore, for different African stock markets, there is a need to understand the factors that influence the predicted stock market movement and why different stock markets react differently to various prediction models. 1.4 Research Objectives The research study aims at addressing the following research objectives; • To develop a model that can accurately and significantly predict the future stock price movements of African stock markets. • To establish the factors that influence stock market movement in Sub-Saharan Africa. • To investigate whether the factors that influence share prices differ amongst African markets. • To investigate stock market inefficiency in African markets. 12 Chapter 1. Introduction 1.5 Contribution to the Body of Knowledge Several share prediction models have been investigated in the literature to solve the financial time series forecasting problem and increase prediction accuracy (Araujo et al., 2015). Most stock market prediction initiatives in developing countries have been for Asian markets2 and a few applications in African stock markets3have been noted, a gap that this research closed up by developing a stock price prediction model for African stock markets. African stock markets are mostly frontier markets except for South Africa and Egypt which are emerging markets (MSCI World Index, 2018). Also, African stock markets are largely perceived as high risk investment zones faced with political, economic, regulatory and structural instability in addition to being thin and illiquid with the exception of South Africa and Egypt. Thus, the viability of African stock markets as investment zones depend on their potential to improve risk return trade- offs to global investors (Allen et al., 2011). African stock markets may offer global investors the opportunity to diversify their portfolios and increase return potential. The ability of this research to develop prediction models that can enhance investor decision making by reducing perceived risk and increasing return in African stock markets is a great contribution to African and global investment domains and in turn may attract more global investment to Africa. In addition to the afore-mentioned, this study is important for a number of rea- sons. First, the study contributes to the limited literature on stock price prediction in Africa. The key discussion in this study answers to the return predictability possi- bility in African stock markets using ANNs and their variants even though African stock markets are considered very volatile, inefficient and illiquid. Development of stock price prediction models for African stock markets will add on to empirical evidence on the return predictability debates of African stock markets. Second, this thesis is a major contribution to the knowledge of deep learning in stock price prediction initiatives. Most importantly, the deep learning models adopted in this study amount to a significant advancement in the prediction of stock markets and mostly in Africa. The deep learning models in this study have largely been used for speech-to-gesture generation, learning fashion compatibility, video description, image captioning, handwriting recognition, sequence-based problems, 2The application of ANNs for stock price prediction includes but not limited to the following stock markets; China Stock Exchange – (Chai et al., 2015; Cao et al., 2011); Bombay Stock Exchange – (Sundar and Satyanayarana, 2015); Frankfurter Stock Exchange- (Jarrett and Schilling, 2008) ; Nigerian Stock Exchange- (Akinwale et al., 2009; Isenah and Olubusoye, 2014; ); DJIA and S&P 500 – (Anish and Majhi, 2016); NASDAQ – (Araujo, 2010; Wang and Zhu, 2010); Tehran Stock Exchange- (Zahedi and Rounaghi, 2015; Abbasi et al., 2014; Ghezelbash and Keynia, 2014; ); Bucharest Stock Exchange –(Trifan, 2010); Petrobas –(Oliveira et al., 2013); Taiwan Stock Exchange – (Hsu, 2013); Karachi Stock Exchange – (Kiani, 2006); German Stock Exchange, Tokyo Stock Exchange and New York Stock Exchange – (Mandziuk and Jaruszewicz, 2011); Latin American Stock Markets –Argentina, Brazil, Chile, Mexico and USA- (Carvalhal and Ribeiro, 2007); Taiwan Stock Exchannge – (Lu, 2010); Nikkei 225 –(Lu, 2010; Lu et al., 2009) ; Saudi Stock Exchange- (Olatunji et al., 2013); Amman Stock Exchange- (Qasem et al., 2013); Istabul Stock Exchange – (Karymshakov and Abdykaparov, 2012); San Paulo Stock Exchange- (Luna and Ballini, 2012); Romanian BET Index –(Ruxanda and Badea, 2014); Johannesburg Stock Exchange – (Patel and Marwala, 2006); Indian Stock Market – (Mohapatra et al., 2012) and Asian Stock Markets – (Dai et al., 2012) 3(Berradi and Lazaar, 2019; Mohamudally-Boolaky et al., 2019; Gyamerah et al., 2019; Ajekwe and Ibiamke, 2018; Okoro, 2017; Lawal et al., 2017; Olayiwola et al., 2016; Kareem and Adeoti, 2016; Isenah and Olubusoye, 2014; Adebiyi et al., 2014; Ajao and Wemambu, 2012; Agwuegbo et al., 2010; Akinwale et al., 2009; Patel and Marwala, 2006) 1.5. Contribution to the Body of Knowledge 13 automatic speech recognition acoustic models4 and their deployment to financial time series is a key contribution in prediction pursuits. To the best knowledge of the researcher, this is the first study of undertaking a comprehensive comparison of DNNs in the field of stock market predictions. In addition, this is the first study to make an extensive comparison between unidi- rectional and bidirectional DNNs in stock market predictions with a cross market analysis perspective. Also, the application of deep neural networks in African stock markets has been scanty as evidenced through past African stock markets predic- tion initiatives5 . This research extends the literature on stock price prediction using DNNs to the African context by looking at 10 Sub Saharan African stock markets6 which were selected on the basis of market capitalization and this current study proffers explanations for why different stock exchanges react differently to the same prediction models. Third, a growing body of literature outlines the better performance of ANNs in comparison to statistical models for time series prediction7 . This study extends lit- erature on the prediction capabilities of machine learning GAM nonlinear statistical approaches to stock market predictions. The better prediction capability of GAM compared to DNNs brings new theoretical insights into the field of stock price fore- casting. Fourth, new empirical evidence exhibiting that stock markets are not all the time efficient is generated in this study. This is exemplified by inconsistencies of the EMH and existence of calendar anomalies in African stock markets which can be exploited by investors for profitable gain. Therefore, this is in support of the AMH and CAS. Unlike most research studies that resorted to use of regression models with dummies to test for calendar anomalies, this current research introduces a machine learning technique, namely GAM for calendar anomaly detection. To the best knowledge of the researcher, this is the first research to use GAM for stock market calendar anomaly detection. In addition, the fifth contribution is that through the use of a macroeconomic variable model, this research results bring substantial evidence to further support the arbitrage pricing. The study also extends empirical literature on key stock price drivers for African stock markets. The identified stock price drivers in African mar- kets will help in the modification of asset pricing theory relevant for African markets by understanding the link between each macroeconomic variable and stock prices. New insights were found on the relationship between macroeconomic variables and closing price for the selected African countries. Amongst these insights include the fact that African stock markets under consideration react differently to macroeco- nomic variables in each country. However, unlike developed nations, African stock markets closing price indices in this study are negatively influenced by exchange rate. In a nutshell, this thesis contributes empirically and methodically to computa- tional finance literature especially in the price discovery, asset pricing and prediction 4(Wang et al., 2016; Khandelwal et al., 2017; Chung et al., 2014) 5(Berradi and Lazaar, 2019; Mohamudally-Boolaky et al., 2019; Gyamerah et al., 2019; Ajekwe and Ibiamke, 2018; Okoro, 2017; Lawal et al., 2017; Olayiwola et al., 2016; Kareem and Adeoti, 2016; Isenah and Olubusoye, 2014; Adebiyi et al., 2014; Ajao and Wemambu, 2012; Agwuegbo et al., 2010; Akinwale et al., 2009; Patel and Marwala, 2006) 6Botswana, Egypt, Kenya, Mauritius, Morocco, Nigeria, South Africa, Tunisia, Zambia and. Zim- babwe 7(Reid et al., 2014; Araujo, 2010; Kumar and Thenmozhi, 2009; Senol and Ozturan, 2008; Abdel- mouez et al., 2007; Avci, 2007; Altay and Satman, 2005; Egeli et al., 2003; Desai and Bharati, 1998; Hill et al., 1994) 14 Chapter 1. Introduction debates. New methodologies inclusive of deep neural networks and generalized ad- ditive models to asset pricing in an African stock markets are the key contributions of this research. 1.6 Benefits of Study The everyday stock market trader or investor as well as financial analysts will greatly benefit from the discovery of an optimal prediction model for stock price prediction. The investors’ trading decision making process will be enhanced with the use of such prediction models and be in a position to achieve maximum financial gain from trading at less risk. As part of knowledge discovery in databases, this study made use of intelligent data analysis tools to extract potentially useful information from data in order to make knowledge driven decisions. Hence stock market trading and investing are done from a scientifically informed position contributing immensely to investment risk management and return maximization. Investors can form an un- derstanding of the price formation process which is fundamental to achieving higher returns and lowering risks. In addition, the use of algorithmic finance tools for price discovery, asset pricing and prediction therefore results in improved price discovery for fast traders and high frequency traders. The research findings have vast implications for policy makers. From a policy perspective, policymakers can use stock price predictions, a leading economic in- dicator (Mitchell and Burns, 1938) to identify turning points in an economy, hence determine if a recession is likely to occur and take appropriate actions. An under- standing of the relationship between stock prices and macroeconomic variables is critical. If policy makers understand such relationships, they can formulate either expansionary or contractionary policies to stabilize markets. Therefore, this study is a useful guide to traders, investors, and asset managers in making trading and investment decisions and for policy formulation by financial market regulators as they maintain and monitor the order of African stock markets. 1.7 Structure of the Thesis This thesis is divided into different chapters as follows; • Chapter 1: Introduction to the thesis topic • Chapter 2: Theoretical Underpinnings of the Study • Chapter 3: Literature Review • Chapter 4: Stock Price Prediction Models • Chapter 5: Research Methodology • Chapter 6: Research Findings and Discussions • Chapter 7: Summary and Conclusions 1.8 Chapter Summary This chapter was an introduction highlighting the importance of the study and the knowledge gaps it intended to address with the use of different prediction models 1.8. Chapter Summary 15 in stock price forecasting. Following up on this chapter is a systematic review of theories underpinning stock price prediction. 17 Chapter 2 Theoretical Underpinning of the Study 2.1 Introduction This chapter presents various theoretical underpinnings that guide this study on stock price prediction. The chapter is organised as follows: section 2.2 surveys lit- erature on the Efficient Market Hypothesis (EMH) whilst section 2.3 discusses the Adaptive Market Hypothesis (AMH). Section 2.4 looks at the Complex Adaptive System (CAS) Theory and section 2.5 focuses on the Arbitrage Pricing Theory (APT). A chapter summary concludes the chapter. 2.2 Efficient Market Hypothesis Efficient markets are markets with enormous numbers of rational, profit maximizers actively competing with each other trying to predict future market values of individ- ual securities, and where current important information is almost freely available to all participants. Alternatively, the expression “market efficiency” refers to the infor- mational efficiency of financial markets. Efficient markets are explained through the EMH which asserts that asset prices fully and instantaneously reflect all available and relevant information (Fama, 1970). In that regard, stock prices reflect all the available information about the value of a firm, and therefore there is no possibility of economic profits (Plastun et al., 2020). In other words, the reaction of the market is spontaneous for information, no one can utilize the public information to acquire higher returns other than the return that is adjusted via market risk and no one can beat the market (Zhang et al., 2017b). None of the market participants can systematically get a return above the market (Al-Khazali and Mirzaei, 2017). It is argued that financial asset returns should follow a memory-less stochastic process since the EMH assumes that past price movements have no predictive power of future prices and returns of financial assets (Chu et al., 2019). The EMH is explained through the weak, semi-strong and strong forms of effi- ciency. Under the weak form efficiency, there are no possibilities of identification of any deterministic patterns in time series behaviour. Thus, the EMH from an arbi- trage perspective entails no obtaining of systematic abnormal profits by using past information (Ferreira and Dionisio, 2016). This means even uninformed investors buying a diversified portfolio at the tableau of prices given by the market will ob- tain a rate of return as generous as that achieved by the experts (Malkiel, 2003). In other words, it means that according to EMH, traders cannot predict and beat the market in order to make abnormal profits (Plastun et al., 2019a). The only way a 18 Chapter 2. Theoretical Underpinning of the Study trader or investor can attain an outsized profit is by investing in higher risk assets (Titan, 2015). Concurring with the above view is (Charles et al., 2017) who postulates that un- der the weak form efficiency, the information set is made up of past prices and re- turns. Future prices and their returns are purely unpredictable based on past infor- mation, and thus arbitrage opportunities are competed away. The authors state that asset prices follow a martingale process and its increments (returns) are character- ized by a martingale difference sequence (MDS), where the returns are independent and uncorrelated with past events. In other words, when the market is considered to be in the weak form, the asset returns are simply unpredictable from previous data (Ghazani and Araghi, 2014). The weak-form efficiency usually involves testing of two hypotheses; the ran- dom walk hypothesis (RWH) and the martingale difference hypothesis (MDH). The RWH is directly consistent with the EMH in that it assumes that asset prices resem- ble a random walk process, thus prices change randomly and cannot be predicted. The MDH undertakes that the best predictor of a time series given an information set is simply its unconditional mean. The applicatory part of the EMH to asset pricing has one implication which is that no amount of information would be useful in help- ing one to make predictions about an asset’s returns (Chu et al., 2019). Achievable returns by an investor are dependent on the degree of risk undertaken. The other EMH forms are the semi strong and strong form efficiencies. Infor- mation, precisely public information, is efficiently echoed in stock prices under the semi-strong form (Al-Shboul and Alsharari, 2019). The semi-strong assumes that financial assets’ prices mirror, at any moment, all the information existent in the market, including historical prices information (Titan, 2015). Prices under the semi- strong form change rapidly and without biases to incorporate any new or any other new public information. In cases where the so- called semi strong of the EMH is present on capital markets, use of technical or fundamental analysis cannot deter- mine the way an investor should split his funds so as to obtain profitability higher than that achieved by investors. The strong form efficiency assumes that asset prices incorporate all the avail- able information which include historical financial information (weak form), all new public information (semi-strong) and private information regarding a financial asset. All the relevant information, such as private information, which is accessed monop- olistically by an individual or group of investors, is reflected by the stock prices. Therefore, there is no scope for making abnormal profits since investors are equally informed (Al-Shboul and Alsharari, 2019). Overall, EMH proponents argue that financial markets are perfectly capable of aggregating information of all investors, which in turn leads to efficient markets and that financial markets cannot be predicted (Titan, 2015). The key notion of the EMH is that prediction of future prices is not possible and cannot be forecast due to the random walk behaviour of prices. EMH assumes that financial markets react immediately to new information making it impossible to beat the market using that information. In other words, the EMH does not allow for any variation in the degree of efficiency over time or for the efficiency of the market to be influenced by other market factors (Chu et al., 2019). In reaction to the afore-mentioned assertion of no variability in market efficiency, the validity of the EMH has being increasingly contested and this has become a long standing debate in the field of finance. Inconsistencies with the EMH have been noted owing to the growing evidence of the existence of financial anomalies in the 2.3. The Adaptive Market Hypothesis (AMH) 19 financial markets around the world which point to the fact that return predictability in financial markets is possible (Wasiuzzaman, 2018). It is on this premise that this current research tests the tenets of EMH by investi- gating whether the share price can be predicted, especially in African stock markets. The key issue is to assess if African stock markets are efficient or not through return predictability; to assess if the EMH evolves to other factors other than information which can influence the stock market performance, and thus contribute to the ongo- ing scholarly and professional debates on the EMH. 2.3 The Adaptive Market Hypothesis (AMH) There is a long standing debate between EMH and behavioural finance on whether financial markets are informationally efficient. Against the background of this de- bate, (Lo, 2005) contended that the informational efficiency of a market is time vary- ing and driven by the fundamental rules of economic selection, known as the Adap- tive Markets Hypothesis (AMH). Resultantly, it is increasingly accepted that the in- formational efficiency of a market is fluctuating over time (Yang et al., 2019). The AMH is an adjusted framework to the EMH and is centered on the con- cept of bounded rationality and the evolutionary principle (Kim et al., 2011). A bounded rational investor is said to display satiating rather than optimal behavior. The belief is that optimization can be costly and market participants with restricted access to information or capabilities to process the information are purely engaged in achieving a satisfying outcome. (Lo, 2004) argues that this satisfying outcome is attained through a trial and error and natural selection. Thus market participants adjust to the continually varying environment and rely on heuristics to make invest- ment choices. A need for prediction tools that do not rely on heuristics is paramount, a gap that this current research aims at achieving. It is also believed that the efficiency of the market is conditional upon changing market conditions (Ghazani and Araghi, 2014). Increasing evidence of the applica- tion of the AMH is noticeable with many studies on the subject (Zhou and Lee, 2013; Urquhart and Hudson, 2013; Lim et al., 2013; Kim et al., 2011; Lo, 2004, 2005). The six key concepts of the AMH are that individuals take action based on their own self- interest; they make mistakes; learn and adapt; competition drives adaptation and innovation; natural selection shapes the market and evolution determines market dynamics (Lo, 2004) . Viewed as an evolutionary alternative to market efficiency, the AMH under which the EMH and calendar anomalies can co-exist in an intellectually consistent manner has several implications .The key implications of the AMH are that the risk premium fluctuates over time according to the stock market environment and demograph- ics of investors. Second, arbitrage opportunities do occur from time to time as do profit opportunities connected to market timing. However, as they are exploited they vanish, and new opportunities are persistently being created. Rather than a di- rect movement to a higher degree of efficiency, the AMH implies that complex mar- ket dynamics such as trends, panics, bubbles and crashes are continually witnessed in the market ecology (Urquhart and McGroarty, 2014). Therefore the implication is that return predictability can arise from time to time due to altering market con- ditions (e.g. cycles, bubbles, crises etc.) and institutional factors (Kim et al., 2011; Charles et al., 2017; Ghazani and Araghi, 2014). Third, the performance of investment strategies either as successful or not varies over time depending on the particular market environment. Strategies considered 20 Chapter 2. Theoretical Underpinning of the Study to exploiting arbitrage opportunities may weaken for a while, and then return to profitability when environmental conditions become more favorable (Charles et al., 2017). A result of this matter is that market efficiency is not an all or nothing condi- tion and changes over time as calendar anomalies induce new profit opportunities continually (Kumar, 2016). Thus convergence to market efficiency is neither guar- anteed nor likely to occur since new profit making opportunities are continually created. Fourth, as a result of the ever changing market condition, innovation is the key to survival (Yang et al., 2019; Urquhart and McGroarty, 2014). In agreement to this changing market efficiency viewpoint are (Al-Shboul and Alsharari, 2019) who argue that as the degree of information flow varies over time, one can anticipate that stock prices may behave differently over time, causing mod- ifications in the level of market efficiency from one form efficiency to another. In addition, adaptation to these changing market conditions can make one can achieve a consistent level of expected returns (Chu et al., 2019). In consideration of African stock markets, (Alagidede, 2011) provides evidence of return predictability in six African indices1 . The presence of long term memory in the selected African stock market prices provided further evidence that contra- dicts the weak form market efficiency. With this in mind, it is therefore possible to predict returns over the range of dependence. Individual time varying returns are predictable and empirical stylized facts such as leverage effect and leptokurto- sis were found to be prevalent in the selected African stock market returns. These results are consistent with the AMH. Further evidence of stock market return pre- dictability for African stock markets was shown in a study by (Dyakova and Smith, 2013) by examining the Bulgarian stock exchange. Stock price indices (SOFIX and BG40) were found to deviate from the martingale in some periods and were consis- tent with the AMH. This current study looks at eleven stock markets, ten African stock markets and one United States stock market to find further evidence of the return predictability through use of machine learning techniques. The AMH was able to explain varying stock market returns in the following markets; US, UK, Japan, Canada, France, Switzerland, Germany and Italy (Plastun et al., 2019b); US and China (Yang et al., 2019); Islamic Stock Indices (Al-Khazali and Mirzaei, 2017); S&P 500, FTSE100, NIKKEI225 and EURO STOXX50 (Urquhart and McGroarty, 2016);Tehran Stock Exchange (Ghazani and Araghi, 2014; US stock mar- ket (Urquhart and McGroarty, 2014) and Dow Jones Industrial Average in US (Kim et al., 2011). The AMH is receiving growing attention in academic literature as researches study the implications of the AMH in stock markets (Plastun et al., 2020; Yang et al., 2019; Al-Khazali and Mirzaei, 2017; Kumar, 2016; Urquhart and McGroarty, 2014; Dyakova and Smith, 2013; Ghazani and Araghi, 2014; Kim et al., 2011) The existence of calendar anomalies in stock markets attests to the fact that markets are not effi- cient all the time. Evidence of AMH through calendar anomalies acts a proxy for market inefficiency. 2.3.1 Calendar Anomalies Investors search for opportunities to increase returns continually and make use of varying trade strategies. Amongst these strategies is the use of calendar anomalies in the stock markets to attain abnormal profits. Investors and traders generate their trading strategies based on the identified calendar anomalies (Norvaisiene et al., 1Kenya, Egypt, Tunisia, Morocco, South Africa and Nigeria 2.3. The Adaptive Market Hypothesis (AMH) 21 2015). Calendar effects are amongst the prominent reasons for the occurrences of abnormal returns (Zhang et al., 2017b). Calendar effects include time of the day effects, day of the week effects, week of the month effects, month of the year effects, turn of the month effects, Halloween effect and Mark Twain effect. Day of the week effect results in a different return for each day of the week with the lowest and negative returns cited to occur on Mondays and highest returns at- tained on a Friday. Studies on the day of the week just like any other effect are con- tinually producing varied results. (Diaconasu et al., 2012) examined the presence of the day of the week and the month of the year effects in the Romanian equity mar- ket using Bucharest stock exchange returns. They found the presence of a Thursday effect and did not find any Monday or January effect since Monday returns are pos- itive though not statistically significant and coefficients of the month of the year are negative though not statistically significant. The two indices, BET and BET-C both document a Thursday effect and a lower return on Fridays in the case of BET-C. Analysis of the entire period provides evidence of higher returns in April and July and the absence of January effect in both indices. Experiments were done through a regression with dummies model. The January effect is evidenced by higher stock returns in January as compared to the other months of the year. Using a regression with dummies model, (Nor- vaisiene et al., 2015) investigated seasonality in the Baltic stock exchanges (Nasdaq OMX Tallinn, Nasdaq OMX Riga and Nasdaq OMX Vilnius). Evidence from these studies revealed presence of the Halloween effect in Estonia and Month effect in Es- tonia and Lithuania. Daily return in January averaged 0.25% and 0.17% for Estonia and Lithuania respectively. Investors in Estonia may use the Halloween effect and earn a higher return during the ‘winter’ period as compared with the return on in- vestment during the ‘summer’ period. (Alagidede, 2013) found the presence of the January effect for Egypt, Nigeria and South Africa, a February effect for Morocco, Kenya, Nigeria and South Africa. However, no monthly seasonalities were found for Tunisia. (Plastun et al., 2019a) examine the evolution of the Halloween effect in the devel- oped stock markets of the US, UK, French, Canadian, German and Japanese. The Halloween effect indicates that returns between November and April are higher than in the other months of the year. The key findings of (Plastun et al., 2019a) were that the Halloween effect only became detectable in the middle of the 20th century and is still present in these developed markets. This provides investors an opportunity to develop trading strategy to beat the market. It is also noted that the Halloween effect in the US and the other developed markets is consistent with the AMH. In another study by (Plastun et al., 2019b), they investigated calendar anomaly evolution of the US stock market using the Dow Jones Industrial Average to test for the week effect, turn of the month effect, turn of the year effect and the holiday ef- fect. Results from this study show that the ‘golden age’ of calendar anomalies was in the middle of the 20th century. However, since the 1980s all calendar anomalies vanished, which is consistent with the EMH. Therefore, the study results provide re- sounding evidence that the US market evolved from being inefficient with a number of calendar anomalies to being efficient such that it is difficult to find ‘holes’ in price dynamics that can produce exploitable profits. Contrastingly, (Zhang et al., 2017b)found out that in the US markets, the Monday effects are most prominent. (Urquhart and McGroarty, 2014) also find evidence of the Monday effect, January effect, turn of the month effect and Halloween effect in the USA markets. Whilst evidence from (Plastun et al., 2019a) is consistent with 22 Chapter 2. Theoretical Underpinning of the Study the EMH, studies by (Zhang et al., 2017b) and (Urquhart and McGroarty, 2014) are consistent with the AMH. Additionally (Zhang et al., 2017b) also found out the presence of Monday Effects in the Chinese Markets and in Argentina, Poland, Italy and Singapore. Wednes- day effects were found in stock markets in Mexico, Indonesia, Germany, Switzer- land, Australia, Japan and New Zealand. They also found out Thursday anomalies in stock markets in Czech Republic and Philippines whilst Friday anomalies were identified for stock markets in Brazil, Chile, Russia, Turkey, India, Malaysia, Spain and Hong Kong. Investors can use such information to predict the stock markets by utilizing calendar anomalies to maximize their returns on investment. This attests to the fact that different days of the week are increasingly being noticed for different stock markets as the respective markets continue to adapt and change. (Agrawal and Tandon, 1994) conducted a study of five calendar anomalies (week- end effect, Friday-the-thirteenth effect, the turn-of-the-month effect, the end-of-December effect and the January effect) for 19 countries2 . Monday returns were found to be the lowest and negative for nine out of the 18 countries, which was consistent with findings in the USA. In eight of the other countries, lowest returns were found on a Tuesday. Friday return is significantly positive in all the countries, except Luxem- bourg. The Friday the-thirteenth effect was not found in all countries. The January effect was established in 14 country indices and a significant monthly seasonality in many countries was also noted. Large returns were also found during pre-December holidays in eleven countries and during the inter-holiday period in fourteen coun- tries. Unlike the USA, pre-Christmas returns were positive and significant in seven countries. In contrast, only South Africa, an emerging market was found to have pre-holiday effects (Alagidede, 2013). (Chen and Daves, 2018) focus their study on investigating the January sentiment effect in the US market. Notably, the authors argue that individual investors’ eco- nomic outlook in the month of January may impact their asset allocation decisions and demand for risky assets for the remainder of the year. The empirical results of this study are consistent with the aforementioned in that results reveal that the degree and direction of the January index of consumer sentiment changes are posi- tively related to subsequent monthly returns from February to December. Another study by (Cao et al., 2019) investigated the existence of five investment related anomalies in the Australian stock market. It was found out that cross sec- tional stock returns were negatively related to asset growth, net operating assets, inventory growth and investment- to- assets whilst positively related to asset tangi- bility. The authors identified that the use of the q-theory to explain these anomalies was not persuasive. Similarly, (Nayaran and Zheng, 2010) conducted a study to find out the role of market liquidity risk in determining cross sectional stock market returns. The objec- tive of the study was to find out if financial anomalies with or without the inclusion of market liquidity risk in the Chinese stock market can explain cross-sectional stock market returns. Size, the book-to-market ratio and turnover rate were responsible to explaining cross-sectional stock market returns when the market liquidity risk is imposed on the Chinese market. Hence, investors can make use of such anomalies for stock return prediction. In another novel study, (Cao and Wei, 2005) looked at stock market returns and the temperature anomaly. Working with eight international stock indices3 , it was 2Australia, Belgium, Brazil, Canada, Denmark, France, Germany, Hong Kong, Italy, Japan, Luxem- bourg, Mexico, Netherlands, New Zealand, Singapore, Sweden, Switzerland, UK and USA. 3US, Canada, Britain, Germany, Sweden, Australia, Japan and Taiwan. 2.3. The Adaptive Market Hypothesis (AMH) 23 established that feelings and emotions affected people’s decision making