Timeseries Analysis of All Shares Index of Nigerian Stock Exchange: A Box-Jenkins Approach

This study was aimed at analyzing the Nigerian Stock Exchange All Share Index. The data was extracted from the Central Bank of Nigeria’s Statistical Bulletin and it covered the period of January 1985 to September 2014. The Box and Jenkins approach of model identification, parameter estimation and diagnostic checking was adopted in the analysis with the aid of S-plus Package. From the analysis, the result revealed that Autoregressive model of order two AR (2) after differencing once gives Akaike Information Criteria (AIC) of 6682.4416 which is an optimal order for Nigeria Stock Exchange All Share Index, the model is 2 1 5123 . 0 47 . 0     t t t X X X . Therefore, the model generated shows that ARIMA (2, 1, 0) is adequate to define the optimal order of Nigerian Stock Exchange All Share index.


Introduction
The Stock Exchange Market has been one of the most popular investments in the recent past due to its high returns. The Market has become an integral part of the global economy to the extent that any fluctuation in this market influences personal and corporate financial lives and the economic health of a country (Agwuegbo et al 2010). The stock market forecasting is marked more by its failure than by its successes since stock market prices reflect the judgments and expectations of investors, based on the information available. If things look good, the prices move upward so quickly that recipients of cheerful information have little or no time to act upon it.
The accuracy in forecasting the stock market prices or at least predicting the trend correctly is of crucial importance for any future investment in a dynamic global economy. Over the years, economists and finance analysts have consistently maintained that an unregulated market price is the best yardstick reflecting the true scarcity or worth of a commodity. One can easily evaluate the Nigerian Stock Market (NSM) or the Nigerian Stock Exchange (NSE) performance by the use of Stock Market Index or Returns.
Stock market returns are predictable from a variety of financial and macroeconomic variables and has long been an attraction for equity investors. Recently increasing attention has shifted to the Stock Market Index as a method of measuring a section of the Stock Market. The Stock Market Index are regarded as an important indicator by the investing public at large and can be used as a benchmark by which investor or fund manager compares the returns of their own portfolio . (Senol 2012) A stock market index is a tool used by investors and financial managers to describe the market, and to compare the return on specific investments. A stock index is a method of measuring the value of a section of the stock market. A market index tracks the performance of a specific basket of stocks considered to represent a particular market of sector of the Nigerian economy.
Thus, the need to predict the stock price to meet the fundamental objectives of investors and operators of the stock market for gaining more benefits cannot be overemphasized. This issue has attracted the attentions of researchers and statisticians the world all over. Stock market is influenced by numerous factors and this has created high controversy in the field. Many methods and approaches for In this paper, we are going to use the components of All Share Index (ASI) of the Nigerian Stock Exchange (NSE) which comprises of monthly value of All Share Index for the period of January 1985 to September 2014.

Methodology 2.1 Autoregressive (AR) Model
An Autoregressive (AR) model of order P satisfied the following: p denotes the order of autoregressive model, defining how many previous values the current value is related to.

Moving Average (MA) Model
Moving Average (MA) model of order q is given as: The error (or noise) term in this equation t  is the one step ahead forecasting error which can be expressed as a function of previous forecasting errors. It shows that MA (q) models make forecast based on the error made in the past, and so one can learn from the error made in the past to improve current forecast.

Autoregressive Moving Average (ARMA) Models
This is Autoregressive Component of order p and Moving Average Component.of order q In a situation where AR (q) and MA(p) were not able to solve the case at hand, a combination of the two produces another interesting model known as Autoregressive moving average (ARMA)(p, q) model where p is the number autoregressive component and q is the number of moving average component. This model is as presented as follows The Form ARMA (p, q) model is given by the equation: Average (q) parameter for the time series data after it was differenced once to attain stationary. If = 0 the model becomes ARMA, which is linearly stationary, ARIMA ( ≥ 0) is a linear nonstationary model. If the underlying time series is nonstationary, taking the difference of the series with itself makes it stationary, and then ARMA model is applied onto the difference part.

Forecasting Using Arima Models
Forecasting from 1 2 2 1 , ,..., , X X X X ARIMA consist of the following steps: the Model identification, parameter estimation, and diagnostics. Model identification is the first step of these processes. The data would be examined to check for the most appropriate class of ARIMA processes by selecting the order of the consecutive and seasonal differencing, required in the making the series stationary, as well as specifying the order of the regular and seasonal autoregressive and moving average model necessary to adequately represent the time series model.
The Autocorrelation Function (ACF) and the Partial Autocorrelation function (PACF) are the most important elements of the time series analysis and forecasting. The ACF measure the amount of linear dependence between observations in a time series that are separated by k lag . The PACF plots help to determine how many Autoregressive term are necessary to reveal one or more of the following characteristics: time lag where high correlations appear, seasonality of the series trend either in the mean level or in the variance of the series.

Measure of Forecasting Accuracy
The forecast error is the difference between the actual value and the forecast value for the corresponding period.
Out of these MAPE and MAE are the commonly used once. MAPE and MAE are related with how close the forecast value is to the actual value. The lower the MAPE and MAE value, the better is the forecast. But they deal only with the absolute difference between the forecast value and the actual values.

Differencing and Unit Root
In the full class of ) , , ( q d p ARIMA models, consider an autoregressive model of order one as follows: and with further back substitution arrive at is the initial value plus an un-weighted sum of s '  or 'shocks' they are permanent and the variance of X grows without bound over time. This type of series is called a random walk. Many stock series are believed to follow this or some closely related model. The failure of forecasts to return to mean in such a model implies that the best forecast of the future is current value and hence the strategy of buying low and selling high is pretty much eliminated in such a model whether high or low is unknown (Neylon et al 2012).
Any Autoregressive model like is associated with a 'characteristic equation' whose root determine the stationarity or non-stationarity of the series. That is where  is constant at time t and ...
Recall further that the correlation coefficient xy Thus the autocorrelation function at lag K is given by Which exhibits the following propoerties

Illustrative Example
The following data obtained from Central Bank of Nigerian (CBN) Statistical Bulletin comprises of 357 univariate data set collected every last working day of the month from January 1985 to September 2014 chronologically and presented in Table 2 and the time plot is also presented in Figure I.
The focal assumption of time series analysis is stationarity of the series out of other assumption like randomness of the series and normality of the series. In view of this, autocorrelation coefficient is obtained and presented in Table 3 and its autocorrelogarm is also presented in Figure II.
The data do provide sufficient evidence (Table 2 and Figure II) to conclude that the series is not stationary. It is noted that the autocorrelation coefficients of the first several lags are significantly different from zero for instance, autocorrelation coefficient of lag 1, lag 2, lag 3, …, lag 16 = 0.97, 0.94, 0.90,…,0.16 respectively which individually is less than the 0.14 and the autocorrelation coefficients gradually regressed towards zero rather than dropping exponentially, this shows that a trend exist in the series. The ACF for the series decays very slowly indicating that it is non-stationary. Non-stationary stochastic processes tend to generate series whose estimated autocorrelation function fail to die out rapidly; that is, the estimated autocorrelations for non-stationary processes tend to persist for a large number of lags. Persistently large values of then indicate that the time series is non-stationary and that at least one difference is needed. Since the theoretical autocorrelations and partial autocorrelations are only independent of time for stationary processes, it is necessary to difference the original series until it can be assumed to be a realization of a stationary process. The result of first differencing is presented in Table  4. The stationarity test was conducted to check if it has been reached by plotting the corrrelogram of the first difference series to view its behaviour ( Figure  III). The next step is to obtain the autocorrelation coefficient function and partial autocorrelation function for the differenced series using s-plus and the result is presented in Table 5 and Figure IV The model strategy involves model identification, parameter estimation and diagnostic check. The model for the monthly official All Share Index of Nigerian Stock Exchange is achieved by estimating the Autocorrelation Function (ACF) and the Partial Autocorrelation Function (PACF). The selection of a time series model is frequently accomplished by matching estimated autocorrelations coefficients with the theoretical autocorrelation. The matching of the first 50 estimated autocorrelations function (ACF) and partial autocorrelations function (PACF) of the underlying stochastic processes suggested that the series were stationary. The estimated ACF and PACF are as shown in Table 6 and Figures V. With the matching of the ACF with the PACF, the model is identified as an AR (2) model Akaike's Information Criterion (AIC) provides the best fit for an autoregressive model to a set of data. The model with the smallest value of the AIC is judged to be the most appropriate. The AIC obtained for all the models is presented in Table 7. The AIC revealed that the best fit for the model is an AR (2). The test for model appropriation result was as shown in Table  8.
http://www.ijSciences.com Volume 5 -June 2016 (06) The AIC for the ARIMA ( , , )was examined and is as shown in Table 7  The corresponding fitted ARIMA (2, 1, 0) model as generated by S-plus is The AIC for the model is 6675.45418. The parameter for the estimated model is as follows:  where t X is the fitted value, or some functions of the residuals. Thus ARIMA (2, 1, 0) model appears quite adequate for the monthly Nigerian Stock Exchange Index as can be seen in Table 9.

Discussion And Conclusion
Having used Box-Jenkins method as tool to provide accurate forecast for the series, the following conclusions can be drawn: Model identification indicated that ARIMA (2, 1, 0) given as 2 1 5123 is best fit for this index. This was supported by forecasting results of different ARIMA models as the forecasting performance of ARIMA (2, 1, 0) was better than other ARIMA models. The All Share Index of the Nigerian Stock Exchange is non-random. The investigations show that the series is void of seasonal component. The forecast for All Share Index of the Nigerian Stock Exchange for October 2014, November 2014, December 2014 and January 2015 are 40460, 40220, 39630, and 39230, respectively thus, the All Share Index will decrease in the next four months.