You are on page 1of 15

APPLICATION OF MARKOV CHAIN TO MODEL AND PREDICT

STOCK MARKET TREND: THE CASE OF BAMBURI CEMENT SHARES


IN NSE,KENYA.
GROUP MEMBERS

 NAME REGISTRATION NUMBER



1. Jackline Waithera Ngugi SC281-6573/2014

 2. Mercy Wafula SC281-6565/2014

 3. Peris Anita Nafula SCM212-5826/2015

 4. Stacy Siteiya SCM212-1082/2015

 5. Kennedy Odhiambo SCM221-0552/2017


ABSTRACT
 The stock market has happened to be an important research topic due to its immense significance for every
profitable industry, shareholders and investors to embrace a self-assured decision for a good investment.
Nairobi Security Exchange being an emerging market, foreign and local investors will seize the opportunity
and invest on the stock market. Little application has been applied in predicting a single stock, therefore, the
general objective is to apply Markov chain to model and predict stock market trend: the case of Bamburi
Cement shares in NSE, Kenya.
BACKGROUND INFROMATION
 A number of studies have been conducted to predict the stock market trend of financial markets and not
many empirical have been done to forecast stock market trend of emerging markets such as NSE in Kenya.
This is illustrated in the Bamburi Cement company due to the speedy growth in the past decade driven by a
huge demand for housing and the governments mega infrastructures projects.

 Bamburi Cement Company being the leading cement manufacturer in Kenya has sold its shares as high as
187 shillings but since August (2019), the share price has been a downward trend in its average monthly
price. Bamburi performance, which is in sharp contrast to losses and profit, drops in the covid-19 pandemic
era due to major reduction of costs.

 The ultimate aim is to earn high profit using a well-defined trading strategy therefore, determining more
effective ways of stock market price is important for a stock market investor in order to make more
informed and accurate investment decisions.
PROBLEM STATEMENT
 Since the stock market is influenced by random factors, analysing of the stock market trend is also not a
simple task. Volatility and randomness of stock prices makes them risky investments and investors need
a lot of information to make capital gains on their investments, therefore, investors try to understand the
behaviour of stock market by making use of market and other relevant information and various stock
analysis methods to make predictions about stock price movements in order to device optimum
investment strategies.

 Models which capture volatility would be expected to inform good predictions, Therefore, Markov chain
model expresses the trend of the stock market price in a probabilistic way which has some significance
in the economy that will help the future investors and shareholders.
RESEARCH QUESTION

 The study seeks to solve the problem by answering the following questions ;

1. Owing to the fact that prediction of the stock market trend is a challengeable one: How
can an investor expecting higher returns from the NSE, utilize historical data on Bamburi
Cement PLC share prices to give meaningful prediction on the future behaviour of stock
market?

2. Potential investors are interested in market trends, this makes the Markov chain popular in
forecasting the behaviour of stock prices: will applying Markov chain to forecast
behaviour of share prices be accurate in predicting the trend?
OBJECTIVES OF THE STUDY
 GENERAL OBJECTIVE

To apply Markov chain to model and predict stock market trend of Bamburi Cement shares in NSE, Kenya.

 SPECIFIC OBJECTIVES

I. To determine Markov Model using transitional probability matrix and an initial state vector for forecasting Bamburi
Cement share prices in the Nairobi

II. To determine the expected short and long run steady state behaviour of Bamburi Cement shares using the state
probabilities.

III. To find the mean recurrence time of Bamburi Cement share prices.

IV. To validate the accuracy of the model in forecasting Bamburi’s cement share price movement.
LITERATURE REVIEW
 Many studies have been carried out to improve decision making in the stock market using a lot of models. Davou et al. (2013);
Eseoghene (2011); Maruf and Patrick (2016) all made recent contributions into using the Markov chain model to predict stock
price behaviour’s in the stock market.

 Simeyo et al (2015) applied Markov chain model and forecast the trend of Safaricom share trading in Nairobi, Securities
Exchange of Kenya. They derive the initial state vector and the transition probability matrix and used them to predict states of
share price accurately in which they found a long-term behaviour of the share price.

 Okonta et al. (2017) in their Markovian analysis of the Nigerian stock market weekly index, used a two state Markov chain,
with returns place into states with regards to it being positive or negative. The study assumes that stock price fluctuations
exhibit Markov’s dependency and time-homogeneity and specifies a three state Markov process and advance the methodology
for determining the mean return time for equity price increases and their respective limiting distributions using the generated
state transition matrices.

 From the literature review, Markov Chain model has been widely applied in predicting a group of stock market trend but little
has been done for a single stock. This study therefore, sought to apply Markov Chain model to study the trend of Bamburi
shares trading in Nairobi Securities Exchange in the Kenya as an emerging market.
METHODOLOGY

RESEARCH DESIGN

The study uses a descriptive research design which according to C.R Kothari(2019) are those studies
concerned with describing the characteristics of a particular individual or of a group. This study
narrates facts and characteristics about the Bamburi PLC historical share prices i.e. the probability of
it being in a certain state at a certain time hence the transition matrix and the initial state vector are
uses this to make predictions about the probabity of the prices being in the classified states.

DATA
The basis of this study will be Bamburi cement daily closing prices for the period 1st June, 2018 to
31st May, 2021. Secondary data collection techniques will be employed. The prices will be obtained
from dataservices@nse.co.ke
DATA ANALYSIS

STOCHASTIC PROCESS
 A stochastic process 𝑋𝑡, 𝑡 ∈ 𝑇 is a family of random variables T defined on a given probability space, indexed
by the time variable t, where t varies over an index set T. ( Ryan, T,1973. The set is called the index set of the
process, might be countable set or an interval of the real line.
 A state space S is the set of states that a stochastic process can be in. The states can be finite or countable
hence the state space S is discrete, that is S=1, 2, 3…, N. Otherwise the space S is continuous (Doubleday,
Kevin and Julius Esunge, 2013). The opening and closing prices of Stock trading in Nairobi Securities
exchange varies or fluctuates in a random manner due to influence of various factors from the market.
 Define 𝑋𝑡 is the Closing share price on the tth day, and 𝑍𝑡 is the change of the share price from the previous
day on the day such that 𝑍𝑡 = 𝑋𝑡 − 𝑋𝑡−1 . The probability model that describes the evolution of a stock market
behavior evolving randomly on a particular day is defined as follows,
1, 𝑖𝑓 |𝑍𝑡 (𝑖𝑛𝑐𝑟𝑒𝑎𝑠𝑒𝑠)|
𝑌𝑡 = 2, 𝑖𝑓|𝑍𝑡 (𝑑𝑒𝑐𝑟𝑒𝑎𝑠𝑒𝑠)|
3,𝑖𝑓|𝑍𝑡 (𝑢𝑛𝑐ℎ𝑎𝑛𝑔𝑒𝑑)|
𝑌𝑡 is a stochastic process that may have a value from 1 to 3 on t
th day. That is 𝑌𝑡 ,𝑡 = 1,2,3 is a discrete time stochastic process
that can take finite non-negative integer values and the state
space{𝑌𝑡 ,𝑡 ≥ 0}, 𝑖𝑠 {1,2,3} . The study aims to find a
probability model for the sequence of successive values 𝑌1 ,
𝑌2,𝑌3 and it assumes that 𝑌𝑡are independent random variables
This type of the stochastic process is known as a discrete time
Markov Chain(Ross 2010)
[15],

𝑃𝑖𝑗 = 𝑃{𝑌𝑡+1 = 𝑗|𝑌𝑡 = 𝑖, 𝑌𝑡−1 = 𝑖𝑡−1 , … , 𝑌1 = 𝑖1 ,𝑌0 = 𝑖0 }


= 𝑃{𝑌𝑡+1 = 𝑗|𝑌𝑡 = 𝑖} Where 𝑃𝑖𝑗 ≥ 0,𝑖 𝑗 ≥ 0; ∑ 𝑃𝑖𝑗 = 1, 𝑖,𝑗 =
0,1,2 … ∞ 𝑗=𝑜 (1) 18

the equation (1) can be interpreted that, conditional distribution


of future state , given the past states and the present state is
independent of the past states and just depends only on present
state, known as discrete time Markov Chain
DISCUSSION
Transition Probability and Transition Matrix
The transition probability is called transition or jump probability from state i to state j.
𝑃{𝑋𝑛+1 = 𝑗|𝑋𝑛 = 𝑖} = 𝑃𝑖𝑗
This is also termed as one-step transition probability. If the transition probabilities defined above are
independent of time (n), then such assumption is called homogenous or stationary Markov chain. Thus,
𝑃{𝑋𝑛+𝑖 = 𝑗|𝑋𝑛 = 𝑖} = 𝑃{𝑋1 = 𝑗|𝑋0 = 𝑖} = 𝑃𝑖𝑗
The transition probabilities 𝑃𝑖𝑗 ′ 𝑠 can be written or arranged in a matrix form as,
𝑄 = [𝑃𝑖𝑗 ] = 𝑃11 𝑃12 … 𝑃1𝑚 𝑃21 𝑃22 … 𝑃2𝑚 𝑃𝑚1 𝑃𝑚2 … 𝑃𝑚𝑚
Here, the matrix Q is called transition probability matrix (tpm) or stochastic matrix. The matrix Q insists
non-negative elements with row sum unity. Hence:
0 ≤ 𝑃𝑖𝑗 ≤ 1 𝑎𝑛𝑑 ∑ 𝑃𝑖𝑗 𝑛 𝑗=1 √𝑖 ∈ 𝐼 The probability 𝑃𝑖𝑗(𝑛) = 𝑃{𝑋𝑛 = 𝑗|𝑋0 = 𝑖}
Is the n-step transition probability from state 𝑖 to 𝑗 in 𝑛 steps.This can be explicitly explained
by the Chapman-Kolmogorov as follows
𝑃𝑖𝑗 𝑛+𝑚 = ∑ 𝑃𝑖𝑘 𝑛 𝑃𝑘𝑗 𝑚 ∞ 𝑘=0 ∀𝑛,𝑚 ≥ 0, ∀ 𝑖,�
Where , 𝑃𝑖𝑘 𝑛 𝑃𝑘𝑗 𝑚 represents the probability that the state
will go to state𝑗 in 𝑛 + 𝑚 transitions starting from 𝑖 through a
path which take it into state 𝑘 at the 𝑛 𝑡ℎ transition.Then the
equation asserts that 𝑃 (𝑛+𝑚) = 𝑃 𝑛𝑃 𝑚 and by induction 𝑃
(𝑛) = 𝑃 𝑛−1 .𝑃 = 𝑃 𝑛 , For 𝑛 ≥ 1, where dot represents matrix
multiplication.

Properties of Markov Chains and Classification of States

• Reducibility

• Periodicity

• Recurrence

• Recurrence

• Absorbing state

• State Probability Matrix

• Limiting distributions
REFERENCES
 Mills, T., & Jordanov, J. (2003). The size effect and the random walk hypothesis: Evidence
from the London stock exchange using Markov chains. Applied Financial Economics,
13(11), 807-815. https://doi.org/10.1080/0960310032000116224
 De Jong, P., & Heller, G. Z. (2008). Generalized linear models for insurance data.
https://doi.org/10.1017/cbo9780511755408
 De Jong, P., & Heller, G. Z. (n.d.). Generalized linear models. Generalized Linear Models
for Insurance Data, 64-80. https://doi.org/10.1017/cbo9780511755408.006
 Goh, H. H., Chong, L. L., & Lai, M. M. (2018). Sentiment-augmented asset pricing in Bursa
Malaysia: A time-varying Markov regime-switching model. Malaysian Journal of Economic
Studies, 55(2), 285-300. https://doi.org/10.22452/mjes.vol55no2.8
WORKPLAN
ACTIVITY 15th-29th 30th June- 16th July- 10th 21st Sep- 6th 1st Nov- 15 16th 10th-15th
June 2021 July 15th 18th September- 5th Oct 2021 October- TH Nov November - Decemb
2021 August 20th 30TH Oct 2021 5th er 2021
2021 September 2021 December
2021 2021
Conceptualization the of
proposal

Development of
proposal and
presentation
Data collection

Data Management

Data analysis

Data interpretation

Project presentation
BUDGET
ACTIVITY Amount (Kshs)

Buying Data at NSE 1500

Printing, photocopying and binding 800

Refreshments 500

Stationary 300

Transport 350

Internet and phone call fee 800

TOTAL 4,250

You might also like