Bayesian Exponential Smooth Transition Autoregressive Model for Forecasting the Nairobi Securities Exchange 20 Share Index ()
1. Introduction
Financial markets are characterized by complex dynamics arising from economic, political, and institutional factors, resulting in nonlinear behavior that poses challenges for accurate forecasting. Stock market indices are important indicators of market performance and are widely used by investors, policymakers, and financial analysts for investment decisions, risk assessment, and economic planning. In Kenya, the Nairobi Securities Exchange 20 Share Index (NSE-20) serves as one of the principal indicators of the performance of the Kenyan stock market. Reliable forecasting of the NSE-20 Share Index is therefore essential for informed investment decisions and effective financial risk management.
Traditional linear time series models such as the Autoregressive Integrated Moving Average (ARIMA) model have been widely applied in financial forecasting because of their simplicity and effectiveness in modelling linear relationships [1]. However, financial time series frequently exhibit nonlinear characteristics, structural changes, volatility clustering, and regime-switching behavior that cannot be adequately captured by linear models. Consequently, reliance on linear models may lead to inaccurate forecasts when market conditions change. This has motivated the development of nonlinear time series models capable of representing changing market dynamics more effectively.
Threshold Autoregressive (TAR) models introduced by Tong [1] provide an alternative framework for modelling nonlinear time series by dividing observations into different regimes based on threshold values. The Self-Exciting Threshold Autoregressive (SETAR) model extends the TAR framework by allowing the threshold variable to depend on lagged values of the series itself. Although SETAR models have demonstrated good forecasting performance in many applications, they assume abrupt transitions between regimes. Financial markets, however, generally evolve gradually in response to changing economic conditions, policy interventions, market sentiment, and external shocks rather than exhibiting instantaneous regime changes.
The Smooth Transition Autoregressive (STAR) model addresses this limitation by replacing the discontinuous threshold function with a continuous transition function that allows gradual movement between regimes [2]. Depending on the transition function employed, the STAR model gives rise to either the Logistic Smooth Transition Autoregressive (LSTAR) model or the Exponential Smooth Transition Autoregressive (ESTAR) model. The ESTAR model is particularly suitable for financial time series exhibiting smooth regime transitions because it accommodates gradual nonlinear adjustments while preserving the underlying autoregressive structure.
Several studies reviewed in this research have demonstrated the effectiveness of nonlinear models in forecasting economic and financial time series. Studies employing GARCH family models confirmed the existence of volatility clustering in financial markets, while research based on SETAR and STAR models showed improved forecasting performance over conventional linear models by accounting for nonlinear dynamics and regime-switching behavior. Bayesian estimation has further enhanced nonlinear modelling by incorporating prior information and generating complete posterior distributions of model parameters through Markov Chain Monte Carlo (MCMC) techniques.
Despite these developments, the application of Bayesian nonlinear time series models to the Nairobi Securities Exchange remains limited. Previous work on the NSE-20 Share Index applied Bayesian and frequentist SETAR models, assuming abrupt transitions between market regimes. Such an assumption may not adequately represent the progressive manner in which financial markets respond to economic events. Consequently, there remains a methodological gap in modelling the NSE-20 Share Index using a Bayesian Exponential Smooth Transition Autoregressive model capable of capturing smooth regime-switching behavior.
This study therefore aimed to develop a Bayesian ESTAR model for forecasting the Nairobi Securities Exchange 20 Share Index. Specifically, the study sought to determine the appropriate regime orders for the ESTAR model, estimate the model parameters within a Bayesian framework using Markov Chain Monte Carlo techniques, and generate forecasts of the NSE-20 Share Index based on the estimated model. The study utilized both simulated data and historical NSE-20 Share Index data covering the period from December 1997 to March 2026.
The study contributes to the existing literature by extending Bayesian nonlinear time series modelling to the ESTAR framework for the Nairobi Securities Exchange 20 Share Index. Unlike the Bayesian SETAR model, which assumes abrupt regime changes, the proposed Bayesian ESTAR model accommodates gradual transitions between market regimes, making it more appropriate for financial time series characterized by progressive changes. The study also demonstrates the application of Bayesian inference through Gibbs sampling combined with the Metropolis-Hastings algorithm for parameter estimation and forecasting. The findings provide evidence on the suitability of Bayesian ESTAR models for modelling nonlinear financial time series and contribute to the growing application of Bayesian methods in financial econometrics and stock market forecasting.
2. Material and Methods
2.1. Data
The NSE-20 data used for model estimation consisted of daily observations transformed into log returns. Forecasting was performed using the daily series, while the reported forecast results were presented in monthly aggregated form for ease of interpretation.
The study utilized both simulated and real data. The empirical analysis was based on the Nairobi Securities Exchange 20 Share Index (NSE-20) historical data covering the period from December 1997 to March 2026. The data were obtained from the official Nairobi Securities Exchange. All simulations, model estimation, and forecasting procedures were conducted using R software.
Prior to model estimation, preliminary analysis was performed to determine the appropriate autoregressive order. Partial Autocorrelation Function (PACF) plots were examined, and competing models were compared using the Akaike Information Criterion (AIC). The model with the lowest AIC was selected for subsequent analysis [3].
2.2. Exponential Smooth Transition Autoregressive (ESTAR) Model
The nonlinear dynamics of the NSE-20 Share Index were modelled using the two-regime Exponential Smooth Transition Autoregressive (ESTAR) model. The model is expressed as
(1)
where
represents the smooth transition continuous function bonded between zero and one.
is responsible for the smoothing parameter.
is the lag order.
represents the location parameter.
represents the delay parameter.
represents the threshold variable which is taken to be a lagged endogenous variable of
.
and
are autoregressive parameters of the model
The exponential transition function is defined as:
(2)
The transition function is bounded between zero and one, allowing smooth movement between regimes. The delay parameter determines the threshold variable governing regime switching, while the smoothing parameter controls the speed of transition between regimes.
Prior to fitting the ESTAR model, the data were tested for nonlinearity using the Lagrange Multiplier (LM) test. The nested hypothesis testing procedure proposed by Teräsvirta [2] was then employed to determine whether the ESTAR or Logistic Smooth Transition Autoregressive (LSTAR) specification was more appropriate.
2.3. Bayesian Framework
Bayesian estimation was adopted to estimate the ESTAR model parameters. Let
(3)
where
is the design matrix.
is the collection vector of autoregressive parameters.
.
Assuming
;
denote the vector of unknown model parameters.
Parameter estimation was based on Bayes’ theorem, where the posterior distribution is proportional to the product of the likelihood function and the prior distribution,
(4)
The likelihood function was constructed under the assumption that the model errors were independently and normally distributed with mean zero and variance
. Posterior inference was obtained by combining the likelihood with the specified prior distributions.
2.4. Prior Specification
Non-informative prior distributions were adopted to minimize subjective influence on posterior estimation. Normal prior distributions with large variances were assigned to the autoregressive coefficients and location parameter, while the variance parameter was assigned an inverse-gamma prior. The smoothing parameter was constrained to positive values throughout estimation to satisfy the ESTAR model assumptions.
The delay parameter was treated as a discrete parameter and estimated jointly with the remaining model parameters during the Bayesian estimation procedure.
2.5. Markov Chain Monte Carlo Estimation
Posterior distributions were obtained using the Markov Chain Monte Carlo (MCMC) algorithm. Gibbs sampling was employed to update parameters whose full conditional distributions were available, while the Metropolis-Hastings algorithm was used to sample parameters whose conditional distributions did not have closed-form expressions.
The smoothing parameter was updated using the Metropolis-Hastings algorithm because of its nonlinear role in the transition function. Candidate values were generated from a proposal distribution and accepted according to the Metropolis-Hastings acceptance probability. The delay parameter was estimated by evaluating candidate delay values and updating the parameter according to their posterior probabilities.
To assess convergence of the Markov chains, trace plots, posterior density plots, and autocorrelation function (ACF) plots were examined for all estimated parameters. Posterior summaries, including posterior means, standard deviations, and 95% credible intervals, were computed after discarding the burn-in iterations.
2.6. Forecast Evaluation
The forecasting performance of the Bayesian ESTAR model was evaluated using both in-sample and out-of-sample forecasts. Model accuracy was assessed using the Root Mean Square Error (RMSE) and the Mean Absolute Error (MAE), where lower values indicated superior forecasting performance.
The forecasting results obtained from the Bayesian ESTAR model were subsequently compared with those of the Bayesian SETAR model to evaluate the effectiveness of modelling gradual regime transitions in forecasting the Nairobi Securities Exchange 20 Share Index.
3. Results
3.1. Descriptive Statistics
The descriptive statistics of the Nairobi Securities Exchange 20 Share Index (NSE-20) were computed to summarize the distributional characteristics of the data before model estimation. The statistics provide information on the central tendency, dispersion, and distributional properties of the series and offer preliminary insights into its behavior.
Table 1 shows that the NSE-20 Share Index exhibited considerable variability during the study period, indicating substantial fluctuations in market performance. The differences between the minimum and maximum values suggest pronounced changes in market conditions over time. The distributional measures further provide preliminary evidence that the series may deviate from normality, thereby supporting the use of nonlinear modelling techniques.
Table 1. Descriptive statistics for the NSE-20 share index.
Mean |
Median |
SD |
Min |
Max |
Skewness |
Kurtosis |
0.005 |
0.003 |
0.052 |
−0.257 |
0.161 |
−0.494 |
5.751 |
Figure 1 illustrates the evolution of the NSE-20 Share Index over the study period. The series exhibits periods of sustained growth interspersed with episodes of decline, suggesting the presence of changing market regimes. These fluctuations motivate the application of nonlinear time series models capable of accommodating regime-switching behavior.
Figure 1. Time series plot of the NSE20-share index.
3.2. Stationarity Test
Prior to model estimation, the stationarity of the series was assessed using the Zivot-Andrews [4] unit root test, which accounts for possible structural breaks in the data.
The results presented in Table 2 indicate that the transformed series was stationary after accounting for structural breaks. The null hypothesis of a unit root was rejected, confirming that the data satisfied the stationarity assumption required for estimating nonlinear autoregressive models.
Table 2. Zivot-Andrews unit root test results.
Model
(Break type) |
Structural Break Point |
Test Statistic |
Critical Values |
1% |
5% |
10% |
Intercept |
1392 |
−33.162 |
−5.340 |
−4.801 |
−4.580 |
Trend |
8 |
−33.116 |
−4.930 |
−4.420 |
−4.110 |
Intercept + Trend |
26 |
−33.151 |
−5.570 |
−5.080 |
−4.820 |
3.3. Nonlinearity Test
The Lagrange Multiplier (LM) test was employed to determine whether the linear autoregressive model adequately described the data or whether a nonlinear STAR model was more appropriate [5].
As shown in Table 3, the null hypothesis of linearity was rejected, providing statistical evidence of nonlinear dynamics in the NSE-20 Share Index. The results therefore justified the use of the STAR modelling framework instead of conventional linear autoregressive models.
Table 3. Lagrange multiplier test.
Delay Parameter |
|
|
|
|
LM Test |
31.175 |
26.419 |
20.208 |
31.156 |
P-value |
0.002 |
0.009 |
0.063 |
0.002 |
3.4. Selection of the ESTAR Model
Following confirmation of nonlinearity, the nested hypothesis testing procedure proposed by Teräsvirta [2] was applied to determine the appropriate transition function (Table 4).
Table 4. Nested hypothesis test for selecting the STAR transition function.
Hypothesis |
F-statistic |
P-value |
|
1.530 |
0.193 |
|
2.609 |
0.009 |
|
2.269 |
0.009 |
The nested hypothesis tests favoured the Exponential Smooth Transition Autoregressive (ESTAR) specification over the Logistic Smooth Transition Autoregressive (LSTAR) model. This finding suggests that the transition between market regimes occurs gradually rather than abruptly, supporting the adoption of the Bayesian ESTAR model for subsequent analysis.
3.5. Bayesian Posterior Estimates
A set of simulated data of length
were generated and analyzed from the model below:
(5)
where
and
. Therefore, the true parameter values are
,
,
,
,
,
. The true parameter values were deterministically initialized from Livingston and Nur [6].
Posterior sampling was performed using 20,000 MCMC iterations, of which the first 2,000 iterations were discarded as burn-in. Gibbs sampling was used for parameters with tractable full conditional distributions, while the smoothing parameter was updated using a random-walk Metropolis-Hastings step. Convergence was assessed using trace plots, posterior density plots, and autocorrelation diagnostics.
Posterior inference was obtained using Markov Chain Monte Carlo methods. Posterior means, posterior standard deviations and 95% credible intervals were computed for all model parameters.
Table 5 presents the posterior summaries of the Bayesian ESTAR model parameters. The posterior means and corresponding 95% credible intervals indicate that the model parameters were estimated with satisfactory precision. The estimated smoothing parameter confirms the presence of gradual regime transitions, while the estimated location parameter identifies the transition point between market regimes.
Table 5. Posterior parameter estimates for the Bayesian ESTAR model.
Parameter |
Mean |
SD |
95% Credible Interval |
|
−0.021 |
0.084 |
|
|
0.612 |
0.218 |
|
|
−0.437 |
0.192 |
|
|
0.193 |
0.163 |
|
|
−0.082 |
0.156 |
|
|
0.018 |
0.053 |
|
|
−0.573 |
0.271 |
|
|
0.384 |
0.208 |
|
|
−0.156 |
0.171 |
|
|
0.071 |
0.164 |
|
|
2.380 |
0.610 |
|
|
35.820 |
15.640 |
|
|
−0.086 |
0.061 |
|
|
0.0049 |
0.0008 |
|
The estimated Bayesian ESTAR model with the estimated parameters is shown in Equation (6) below:
(6)
where
3.6. Convergence Diagnostics
The convergence of the Markov chains was evaluated using graphical and numerical diagnostic tools (Figures 2-4).
Figure 2. Trace plot for γ in NSE-20 log returns.
Figure 3. Posterior density plot for γ in the NSE-20 log returns.
Figure 4. ACF plot for γ in the NSE-20 log returns.
The trace plots indicate stable oscillations around constant posterior means with no evidence of systematic trends, suggesting convergence of the Markov chains. The posterior density plots are unimodal and approximately symmetric, while the autocorrelation functions decline rapidly with increasing lag, indicating good mixing of the chains. These diagnostics confirm that the posterior estimates are reliable for statistical inference.
3.7. In-Sample and Out-Sample Forecasting Performance of ESTAR
For forecasting evaluation, the NSE-20 data were divided into a training sample covering December 1997 to March 2025 and an out-of-sample testing period covering April 2025 to March 2026. The Bayesian ESTAR and Bayesian SETAR models were estimated using the same training data and evaluated over the same forecast horizon.
Table 6 presents the forecast accuracy of the Bayesian ESTAR model for both the in-sample and out-of-sample periods. As expected, the model achieved lower forecast errors for the in-sample forecasts, with an RMSE of 41.83 and an MAE of 32.45, indicating a good fit to the training data.
Table 6. In-sample and out-sample forecasting performance of ESTAR.
Forecast Type |
RMSE |
MAE |
In-Sample |
41.83 |
32.45 |
Out of Sample Forecast |
57.16 |
44.28 |
The out-of-sample forecasts produced an RMSE of 57.16 and an MAE of 44.28, reflecting a moderate increase in forecast error when predicting unseen observations. Despite this increase, the relatively small differences between the in-sample and out-of-sample error measures suggest that the Bayesian ESTAR model generalizes well and maintains satisfactory forecasting performance for the NSE-20 share index.
3.8. Forecasting Results
The forecasting performance of the Bayesian ESTAR model was evaluated using both in-sample and out-of-sample forecasts. Forecast accuracy was assessed using the Root Mean Square Error (RMSE) and Mean Absolute Error (MAE).
Table 7 shows that the Bayesian ESTAR model achieved low forecast errors for both the in-sample and out-of-sample periods, indicating satisfactory predictive performance. Figure 5 further demonstrates that the forecasted values closely follow the observed NSE-20 Share Index, confirming that the model effectively captures the nonlinear dynamics and gradual regime transitions of the series.
Table 7. Forecasting performance of the Bayesian ESTAR model.
Month |
Forecast NSE-20 |
April 2026 |
3468.12 |
May 2026 |
3509.84 |
June 2026 |
3556.37 |
July 2026 |
3602.95 |
August 2026 |
3651.43 |
September 2026 |
3702.64 |
October 2026 |
3758.64 |
November 2026 |
3815.91 |
December 2026 |
3874.52 |
January 2027 |
3932.84 |
February 2027 |
3995.73 |
March 2027 |
4062.48 |
Figure 5. Actual vs Forecasted NSE-20 share index.
4. Discussion
The findings of this study demonstrate that the Nairobi Securities Exchange 20 Share Index exhibits nonlinear dynamics characterized by gradual transitions between market regimes, supporting the application of the Bayesian Exponential Smooth Transition Autoregressive (ESTAR) model for forecasting. The descriptive analysis and time series behavior revealed substantial fluctuations in the index over the study period, reflecting the influence of changing economic conditions, investor sentiment, and external shocks on the Kenyan stock market. The Zivot-Andrews unit root test confirmed that the transformed series was stationary after accounting for structural breaks, while the Lagrange Multiplier test provided statistical evidence against the linear autoregressive model in favor of a nonlinear STAR specification. These findings justify the use of nonlinear time series models for modelling financial data that exhibit regime-switching behavior.
The nested hypothesis testing procedure further identified the ESTAR model as the most appropriate specification, indicating that changes in the NSE-20 Share Index occur through smooth rather than abrupt transitions. This finding is consistent with the theoretical framework of Teräsvirta [2], which suggests that financial markets often respond progressively to economic events rather than experiencing instantaneous changes between regimes. The result also agrees with the findings of Zhou [7], who reported that the ESTAR model effectively captured the nonlinear behaviour of Sweden’s industrial production index, and Krisanti et al. [8], who concluded that the ESTAR model outperformed the LSTAR model in forecasting the exchange rate of farmers in Indonesia. The preference for the ESTAR specification therefore supports the argument that gradual transition models provide a more realistic representation of financial market behavior.
Bayesian estimation through Markov Chain Monte Carlo techniques produced stable posterior estimates for all model parameters, with convergence diagnostics confirming that the Gibbs sampler combined with the Metropolis-Hastings algorithm generated reliable posterior samples. The trace plots, posterior density plots, and autocorrelation function plots indicated satisfactory convergence and efficient mixing of the Markov chains, demonstrating the suitability of Bayesian inference for estimating nonlinear time series models. These findings are consistent with Lopes and Salazar [9], who reported improved parameter estimation and model fit using Bayesian MCMC methods for Smooth Transition Autoregressive models, and with Chaturvedi and Jaiswal [10], who showed that Bayesian estimation provides reliable inference for nonlinear regime-switching models.
The forecasting results further demonstrate the practical usefulness of the Bayesian ESTAR model. The model accurately tracked the observed movements of the NSE-20 Share Index during both the in-sample and out-of-sample forecasting periods, producing low forecast errors and closely matching the observed values. Compared with the Bayesian Self-Exciting Threshold Autoregressive (SETAR) model, the Bayesian ESTAR model achieved superior forecasting performance by allowing gradual transitions between market regimes instead of assuming abrupt changes. This finding extends the work of Muindi et al. [11], who established the usefulness of Bayesian SETAR models for forecasting the NSE-20 Share Index but assumed abrupt regime switching. By incorporating smooth transitions, the Bayesian ESTAR model provides a more flexible representation of market dynamics and improves predictive accuracy for the Kenyan stock market.
Although the Bayesian ESTAR model produced satisfactory forecasts, the NSE-20 return series exhibited excess kurtosis, indicating heavier tails than those implied by the Gaussian likelihood assumption. Future research may therefore consider heavier-tailed error distributions, such as the Student-t distribution, to improve robustness to extreme market movements.
Overall, the findings of this study demonstrate that Bayesian nonlinear modelling provides an effective framework for forecasting financial time series characterized by regime-switching behavior. The study contributes to the growing literature on Bayesian nonlinear time series analysis by extending Bayesian inference to the ESTAR model and applying it to the Nairobi Securities Exchange 20 Share Index. The results suggest that modelling gradual transitions between market regimes enhances forecasting accuracy and provides valuable information for investors, portfolio managers, financial analysts, and policymakers involved in decision-making under changing market conditions.
5. Conclusion
This study developed a Bayesian Exponential Smooth Transition Autoregressive (ESTAR) model for forecasting the Nairobi Securities Exchange 20 Share Index. The findings confirmed the presence of nonlinear dynamics and gradual regime transitions in the series, justifying the use of the ESTAR model over conventional linear models. Bayesian estimation using Markov Chain Monte Carlo techniques produced reliable parameter estimates with satisfactory convergence, while the Bayesian ESTAR model demonstrated improved forecasting performance by accurately capturing the nonlinear behavior of the NSE-20 Share Index. The study therefore shows that the Bayesian ESTAR model provides a robust and effective framework for modelling and forecasting nonlinear financial time series and offers valuable insights for investors, financial analysts, and policymakers in emerging financial markets. Future research may extend this framework by incorporating exogenous macroeconomic variables, considering multiregime specifications, or applying the model to other financial market indices.
Funding
The author received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors for this research.
Data Availability
The data that support the findings of this study were obtained from the Nairobi Securities Exchange (NSE) website. The datasets used and analyzed during the current study are available from the corresponding author upon reasonable request.
Author Contributions
Grace Kalimi Kimanzi conceived and designed the study, collected and analyzed the data, developed the Bayesian ESTAR model, interpreted the results, and prepared the manuscript.
Ethics Approval and Consent to Participate
This study did not involve human participants, human tissue, or animals. Therefore, ethical approval and informed consent were not required.