Professional Documents
Culture Documents
Times Series Modeling of Monthly Share Prices of Nigerian Stock Market
Times Series Modeling of Monthly Share Prices of Nigerian Stock Market
Abstract
This study aimed to develop suitable Keywords: Share Prices, ARIMA Models,
ARIMA model which can be used to Stationarity, Stock Market
forecast series. The study collected
secondary data from 1.0 Introduction
http://ng.investing.com/equities/dangcem on A Stock market, also referred to as a stock
monthly share prices of Dangote cement for exchange, is an avenue to trade securities,
the period of ten (10) years (2013 – 2022) such as bonds and shares. Stock market
covering a total of 120 data points. We use began as physical location where financial
Augmented Dickey Fuller test for unit root traders gather to and shares. It functions as a
on the data as to assess for stationarity of the crucial function in the economy by enabling
data. The data series of the variables were investors to raise resources and companies
stationary at the 1st differencing at to expand their operation using funding from
significance level of 0.05. Consequently, the market. It is also one of the mainly
several ARIMA(p,q,d) models were applied crucial avenues of financial system as it
to the series as to select the ARIMA (p, d, q) offers companies an entrance to assets by
that best fits the data series using the Mean permitting the shareholders to buy shares of
Squared Error (MSE) and the result revealed ownership in companies. Through buying
that ARIMA(3,1,3) model best fitted the shares, shareholders have piece of rights in
data with minimum MSE. Furthermore, the the company and they have potentials to
model adequacy of ARIMA(3,1,3) was make gains in their assets based on the
evaluated using the Ljung-Box Q Statistic company's future performance. However,
test on residuals, partial autocorrelation millions are to be gained by buying and
function (PACF) and autocorrelation selling shares for profit, but not every
function (ACF) of the residuals as well. The investor would be successful in gaining
Ljung-Box Q Statistic test on residuals from profit on their investment or asset. This
ARIMA (3,1,3) at different lags showed the happens as a result of stock price swings.
residual values were not significantly Stock market is basically a free-economy
different from zero. Therefore, the residuals market where companies can have access to
are white noise. The spikes of PACF and capital by giving part rights or ownership to
ACF were within the 5% significance limit interested shareholders who are essentially
showing equally that the residuals are white outsiders. This is valuable for both
noise. Therefore, we forecasted the monthly shareholder and underlying companies. For
share prices of Dangote cement with shareholders, the stock market gives an
ARIMA(3, 1, 3) indicated an upward exceptional prospect to be part of an
movement in the monthly share prices of established or already running business and
Dangote cement, hence, the share prices of to garner any of their resulting rewards
Dangote cement will increase in the long- without the high risk of investing in a new
run. and unproven business, which has to
IJMSRT23JUL047 www.ijmsrt.co 19
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
compete with the associated start-up costs, the model was projected a good model for
overheads and other running costs and the stock market predictions.
management. For the underlying companies, With the fast growing number of researches
the stock market gives them the access for a on the prediction of share prices, it has
suitable source of capital to fund their became more obvious in different literatures
growth or expansion of activities. Given that that no single model or method was suitable
the prices of any stock are time dependent, to use in all types of situation, see for
therefore, studying the share prices involves example, Chatfield, (1988) and Zhang,
the study of time series data, which are, for (2003); rather, opined that it was more
quite a few purposes, such as, forecasting suitable to combine different individual
the future based on knowledge of the past, models for better results, also, see for
understanding of the phenomenon. example ; Uri,( 1977), Jenkins,(1982) and
Predicting future prices of a time series data Etuk, et al. (2012). Other current
plays a significant role in nearly every field researchers that used a variety of models to
including sciences, Engineering, Finance, predict share prices include; Cao, et al.
Business Intelligence, Economics, (2010); Chen and Ge (2019); Fischers, et al.
Meteorology, Telecommunication and (2002); Teng, et al. (2022) ; Kim, et al ,
others. As the share prices of any stock is (2018); Feng, et al. (2019), Chen, et al.
time dependent, hence, the study of share (2021) and Based on the brief literature
prices involves also the study of time series reviewed, we would fit a suitable time series
data. Over the years, numerous researchers model to share prices of Dangote Cement
have applied different time series models in and also applied the Box and Jekins method
order to predict the shares of different stock to analyze and predict the future value of
markets, see for example; Mohamed and share prices of Dangote Cement PlC.
Senthamaria, (2017) used the Box and
Jenkins approach to estimate and predict the 2.0 Materials and Methods
upcoming days of Nifty 50 stock market 2.1 Data Description
prices. From the results, the uncertain The data used in this study was a monthly
ARIMA model with the lowest normalize data on the share prices of Dangote Cement,
BIC was used to find ARIMA (0,1,1) as an over a period of ten years (January 2013 to
adequate model and it was observed that the December, 2022); obtained from
influence of R-Square value was (94%) high http://ng.investing.com/equities/dangcem,Th
and the Mean Absolute Percentage Error e method of data collection for this study
(MAPE) was very small which made the was therefore, of secondary type.
prediction accuracy more appropriate for the
Nifty 50 closing stock price. It fulfilled that 2.2 METHOD OF DATA ANALYSIS
closing stock price of Nifty 50 taken in the The Box-Jenkins methodology for
present study showed slow decreasing Autoregressive Integrated Moving Averages
fluctuation trend for upcoming trading days. (ARIMA) models was adopted for this
Ariyo, et al (2014) in their study predicted study. This Time series model was used to
New York Stock exchange using the explain the series and make forecasts.
ARIMA model, and the result showed that However, we made use of MINITAB
the ARIMA model had a dynamic statistical packages for the data analysis.
predictability for short-term forecasting. See
also, Banerjee,(2014); Devi, et al (2013) 2.2.1 BOX-JENKINS METHODOLOGY
applied ARIMA Model in their study and Box-Jenkins method is known to be a
systematic method which helps in
IJMSRT23JUL047 www.ijmsrt.co 20
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
X t i X t1 , t 1, 2,..., p
t 1 (1)
where, is the pth autoregressive parameter
Xt is the actually observed value at a time, The order of the model is determined by p.
t. The thought that lead to Moving Average
Models (MA models) is because that the
IJMSRT23JUL047 www.ijmsrt.co 21
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
time series data could be expressed as being estimation Xt and the actually observed
dependent on the prior estimation errors. value X t is denoted by t.
Past estimation or predicting errors were
taken into account when evaluating the next The general description of MAq models is
time series data. The disparity between the given by:
q
X t i t 1 t 1,2,..., q
t 1 (2)
where, When AR model and MA models are
Xt is the actual observed data at a time, t. combined the ARMA models would be
obtained.
is the qth moving average parameter
Generally, predicting or forecasting with an
t is the difference between the estimated ARIMA (p,q) model is described as,
Xt and the actually observed value Xt
p q
X t i X t 1 i t 1
t1 t1 (3)
Therefore, ARIMA models are sometimes be useful to some cases where data show a
confirmation of non-stationarity, where the first differencing step (equivalent to the integrated
area of the model) would be used to reduce the non-stationarity of the data series.
Non-seasonal ARIMA models usually denoted ARIMA (p,d,q), where the parameters of p,d and
q are positive integers; hence, P represents the order of the autoregressive model where d is
referred to as the amount of differencing, and q stand for the order of the moving average model
Suppose Xt is a non–stationary data, the plan is to build an ARIMA model on the series Yt ,
defined as the result of the operation of differencing the series d times
Generally, d 1: Yt d X t
(4)
2.2.5 The ARIMA (p,q,d) forecasting (ii) Lags of the forecast errors are known as
Model: moving average terms.
A random variable Xt is said to be a (iii) A time series that desires to be
stationary time series if its statistical differenced to be made stationary is said to
properties remain constant over time. be an integrated version of a stationary
(i) Lags of the stationary series in the series.
forecasting equation are known as The forecasting equation is constructed as
autoregressive terms. follows:
First, let X denote the d th difference of Y,
which means:
If d 0 : Xt Yt
(5)
If d 1: Xt Yt Yt 1 (6)
If d 1: X t Yt Yt1 Yt1 Yt2 Yt 2Yt1 Yt2 (7)
Note that the second difference of Y
(d=2 case) does not necessarily the
IJMSRT23JUL047 www.ijmsrt.co 22
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
mean the difference from 2 years ago. In terms of X, the general forecasting
Rather, it’s the first-difference-of-the- equation is:
first difference.
X t c 1 Xt 1 ... p Xt p t 1t 1 ... q t q
(8)
300
STOCK PRICE OF DANGOTE CEMENT
250
200
150
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
year
IJMSRT23JUL047 www.ijmsrt.co 23
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
From Table 1, we observed that the P-value 3.2.1 The Time Series of Differenced Data
(0.310701>0.05), we do not reject the null of Dangote Cement Share Prices
hypothesis and, hence, we conclude that from 2012 to 2022
there is presence of unit root in the series. The plots in Fig 2 which used the
This means that Dangote share prices for the differenced data also showed up and down
period under study does prove stationarity. movements of the share prices of Dangote
Therefore, we differenced the data in order Cement Company. The plots revealed that
to check for its stationarity. share prices in this company were not also
3.2 The Augmented Dickey-Fuller unit steady even when the data were differenced.
root test of the differenced data.
25
Differenced data
-25
-50
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
year
Fig. 2 Time Series plot of the differenced data of share prices of Dangote cement
IJMSRT23JUL047 www.ijmsrt.co 24
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
The ARIMA (1,1,0) parameter, AR(1) P-values, indicating that the residuals
has a P-value of 0.580 which indicates were not correlated, but other models
that it is not significant. Though, the shall be fitted so as to compare the MSE
Ljung-Box statistics gives insignificant for the best model.
1.0
0.8
0.6
Partial Autocorrelation
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
1.0
0.8
0.6
0.4
Autocorrelation
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
IJMSRT23JUL047 www.ijmsrt.co 25
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
The PACF and ACF in Figures 3(a) and 3(b) result of random events. Hence, the
respectively of the residuals confirm the ARIMA (1,1,0) model is not a good fit and
explanation made above. From the plots we so, we cannot make forecasts using this
still observed some spikes in the ACF and model, hence, another mode.
PACF that do not disappeared rapidly as a
The output showed that ARIMA (1,1,1) Though, the Ljung-Box statistics gave non-
parameters (AR(1), MA(1) ) have P-values significant P-values, showing that the
> 0.05, meaning that they are not significant. residuals appeared to be uncorrelated.
However, other models would be check
.
PACF of Residuals for STOCK PRICE OF DANGOTE CEMENT
(with 5% significance limits for the partial autocorrelations)
1.0
0.8
0.6
Partial Autocorrelation
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
IJMSRT23JUL047 www.ijmsrt.co 26
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
1.0
0.8
0.6
0.4
Autocorrelation
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
The plots PACF and ACF in Figures 4(a) down rapidly as a result of random events.
and 4(b) of the residuals confirmed the The ARIMA (1,1,1) model is not a good fit,
interpretation made above. There are still so ,we cannot make forecasts using this
spikes in the ACF and PACF that did not die model, hence other model would be
checked.
Table 5 The output Final Estimates of Parameters of ARIMA (2,1,1) model
Type
coefficient SE Coeff T-value P-value
AR.1 0.1224 8.4735 0.01 0.989
AR.2 0.0198 0.4261 0.05 0.963
MA. 1 0.1731 8.4747 0.02 0.984
Constant 0.876 1.290 0.68 0.498
Differencing: 1 regular difference
Number of observations: Original series 120, after differencing 119
Residuals: SS = 33268.5 (backforecasts excluded)
MS = 289.3 DF = 115
Modified Box-Pierce (Ljung-Box) Chi-Square statistic
Lag 12 24 36 48
Chi-Square 4.8 12.2 24.9 36.8
DF 8 20 32 44
P-Value 0.777 0.908 0.808 0.771
The ARIMA (2,1,1) parameters (AR(1), significant P-values which revealed that the
AR(2), AM(1)) had P-values > 0.05 which residuals appeared to be uncorrelated.
indicated that they are not significant. Hence, we check other models.
However the Ljung-Box statistics give non-
IJMSRT23JUL047 www.ijmsrt.co 27
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
1.0
0.8
0.6
Partial Autocorrelation
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
1.0
0.8
0.6
0.4
Autocorrelation
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
The PACF and ACF in figures 5(a) and 5(b) spikes in the PACF and ACF that did not
respectively of the residuals confirmed the disappeared quickly as an effect of random
explanation made above. There are still events.
IJMSRT23JUL047 www.ijmsrt.co 28
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
The ARIMA (2,1,2) parameters (AR(2), indicating that the residuals appeared to be
AM(2)) had P-values > 0.05, indicates that uncorrelated. However, we shall check other
they are not significant. However the Ljung- models.
Box statistics give non-significant P-values
1.0
0.8
0.6
Partial Autocorrelation
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
1.0
0.8
0.6
0.4
Autocorrelation
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
The PACF and ACF of the residuals support disappeared quickly as an effect of random
the interpretation made above. There are still events.
spikes in the PACF and ACF that did not
IJMSRT23JUL047 www.ijmsrt.co 29
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
1.0
0.8
0.6
Partial Autocorrelation
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
1.0
0.8
0.6
0.4
Autocorrelation
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
The PACF and ACF of the residuals model appears not to fit well so we
confirmed the above interpretation. There cannot make forecasts using this model.
still exits spikes in the ACF and PACF We therefore, try a different model.
that did not die down rapidly as a result
of random events. The ARIMA(3,1,2)
IJMSRT23JUL047 www.ijmsrt.co 30
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
1.0
0.8
0.6
Partial Autocorrelation
0.4
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
IJMSRT23JUL047 www.ijmsrt.co 31
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
1.0
0.8
0.6
0.4
Autocorrelation
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Lag
The ACF and PACF and ACF of the appears to fit well so we shall make
residuals confirmed the explanation made forecasts using this model if its MSE is
above. The ARIMA (3,1,3) model the least when compared to the MSE of
ARIMA models .
MODELS MSE
ARIMA(1,1,0) 284.4
ARIMA(1,1,1) 286.8
ARIMA(2,1,1) 289.3
ARIMA(2,1,2) 286.4
ARIMA(3,1,2) 279.0
ARIMA(3,1,3) 273.1
From Table 8, we observed that the MSE most adequate among the models;
of the ARIMA (3,1,3) model proved to therefore, we make A-3 year forecast
have the smallest value which showed using the model.
that ARIMA (3,1,3) model remains the
The forecasting model is
Xt 0.111.01Xt1 0.91Xt2 0.73Xt3 t 1.13 t 1 1.10 t 2 0.92 t 3 .
IJMSRT23JUL047 www.ijmsrt.co 32
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
272
270
268
FORECAST
266
264
262
260
IJMSRT23JUL047 www.ijmsrt.co 33
m
Volume1, Issue1, July2023 International Journal of Modern Science and Research Technology
Dangote cement. ARIMA (3, 1, 3) model 6. Chen, S. and Ge, L.(2019): Exploring the
was adopted as the best fited model to the attention mechanism in LSTM-based Hong
data because it has the least MSE and all its Kong stock price movement prediction.
parameter were significant and the Ljung- Quant. Financ.19,1507-1515.
box gave non-significant P-value. Also the 7. Devi, B. U., Sundar, D and Alli, P.
PACF and ACF have spikes that were all (2013). An Effective Time Series Analysis
within the bounds and died down to zero. for Stock Trend Prediction Using ARIMA
Therefore, we conclude that ARIMA (3, 1, Model for Nifty Midcap-50.International
3) was adequate, and most preferred model Journal of Data Min. Knowl. Manag.
that could be fitted into the data. In Process 3 (1), 65
furtherance, result from a-3 year forecast 8. Etuk, E. H., Uchendu, B. and Udo, E. O.
with ARIMA (3, 1, 3) showed that there was (2012): Box-Jenkins Modelling of Nigerian
an upward movement in the monthly share Stock Prices Data. Greener Journal of
prices of Dangote Cement but the share Science, Engineering and Technological
prices will increase in the long-run. Research, 2(2), 032-038
9. Feng, F.; He, X.; Wang, X.; Luo, C.; Liu,
REFERENCES Y. and Chua, T.S.(2019):Temporal
1. Mohamed,A.BandSenthamaria,K.K: Relational Ranking for Stock Prediction.
(2017). Forecasting National Stock price ACM Trans. Inf. Syst. (TOIS), 37, 1-
using ARIMA model. Global and 30.
Stochastic Analysis.4.77- 10. Fischer S, Hallschmid M, Elsner, AL
81.https:\\www.researchgate.net/publicatio and Born J. Sleep (2002): Forms Memory
n/317223337_forecasting_national_stock_pr for Finger Skills. Proceeding of the
ice_using_arima_model Academy of Sciences, 99(18):11987-11991.
2. Ariyo, A., A., Adewumi, A.O., and Ayo, 11. Jenkins, G. M. (1982): Some Practical
C. Aspects of Forecasting in Organizations.
K. (2014). “Stock Price Prediction Using Journal of forecast. 1 (1), 3-21.
the ARIMA Model,” in Proceeding of the doi:10.1002/for.39800101003
2014 UKSim-AMSS 16thInternational 12. Kim, H.Y and Won, C.H. (2018):
Conference on Computer Modelling and Forecasting the volatility of stock price
Simulation, 106-112. Index; A hybrid Model Integrating LSTM
doi:10.1109/uksim.2014.67 with multiple GARCH-type models. Expert
3. Banerjee, D. (2014). Forecasting of Indian Syst. Appl.103, 25-37.
Stock Market using Time Series ARIMA 13. Teng, X.; Zhang, X. and Luo, Z.
model in proceeding of the 2014 2nd (2022):Multi-Scale Local cues and
International Conference on Business and Hierarchical Attention-based LSTM for
Information Management (ICBIM), 131-134 Stock Price Trend Prediction.
4. Cao, J. and Li, J. (2019): Financial Time Neurocomputing 505, 92-100
Series Forecasting Model Based on 14. Uri, N. D. (1977).Forecasting: A Hybrid
CEEMDAN and LSTM. Phys. Sta. Mech. Approach. Omega 5(4), 463-472. doi:10
Its Appl. 2019, 519, 227-139 1016/0305-0483(77)90008-1
5. Chatfield, C. (1988). What is the ‘best’ 15. Zhang, G. P. (2003). Time Series
Method of Forecasting? Journal of Applied Forecasting Using a Hybrid ARIMA and
Statistics 15 (1), 19-38. Neural Network model, Neurocomputing 50,
doi:10.1080/02664768800000003 159-175.doi:10.1016/S0925-2312(01)
00702-0
IJMSRT23JUL047 www.ijmsrt.co 34
m