Abstract

We use the exponential Ornstein–Uhlenbeck model to predict the stock price dynamics over some finite time horizon of interest. The predictions are the key to the investors in a financial market because they provide vital reference information for decision making. We estimated all the parameters of the model (mean reversion speed, long-run mean, and the volatility) using the data from Stanbic Uganda Holdings Limited. We used the parameters to forecast the stock price and the associated mean absolute percentage error (MAPE). The predictions were compared against those by the ARMA-GARCH model. We also found the prediction intervals before and during the COVID-19 pandemic. Results indicate that the exponential Ornstein–Uhlenbeck stochastic model gives very accurate and reliable predictions with a MAPE of . All the forecasted stock prices were within the prediction region established. This was not the case during the COVID-19 pandemic; the predicted stock prices are higher than the actual prices, indicating the severe impact COVID-19 inflicted on the stock market.

1. Introduction

Investments into a stock are considered as being too risky because of the stock price fluctuations. A prediction of the price dynamics of a stock would minimise the high risk to the traders in the stock market and would provide advance information to investors to make the right decisions. Making intelligent investments is the key to the prosperity of any investor.

A stock market is a well-organised place at which stock shares and other financial securities are traded. In Uganda, this occurs at the Uganda Securities Exchange (USE) under tight supervision by the Uganda Capital Markets Authority. The market brings together investors who provide capital and companies that require the capital in a centralised market place. In January 2000, USE listed its first equity: Uganda Clays Limited (UCL). More companies have been listed at the exchange since then such as Stanbic Bank Uganda (SBU).

Stanbic Uganda Holdings Limited is one of the largest financial institutions in Uganda licensed under the Financial Institutions’ Act, 2004 and was listed on the Uganda Securities Exchange Limited on 25 January, 2007. It is uniquely identified by the sticker symbol “SBU” and has International Securities Identification Number (ISIN) as UG0000000386. It is one of the liquid stocks at USE and provided permission to utilise her data for this study. It is one of the listed companies that duly comply with the listing rules. There is an increased transparency that results from a listing on USE. In addition, listing provides a company with equity financing opportunities to grow the business from expansion of operations to acquisitions of more capital base through issuance of public shares. Listed companies benefit from more favorable borrowing terms from financial institutions. Improved liquidity in the public market leads to better valuation than would be through private arrangements.

The daily stock prices at USE are so volatile, and while purchasing a stock, it does not guarantee anything in return at the next period. Therefore, it makes stocks more risky in investment but investors can gain high return when the listed companies make profits. Wrong decision in choosing a stock may end up in capital loss to the investor. This view is also shared by [1]. Stock trading has a high rate of risk, and the fluctuation of stock prices affect the investors’ decisions and capital. However, unlike safe investments, risky investments provide best returns. In [2], details are provided that indicate that risky investments are dangerous but still investors go for them because of the high returns. When the infinite ruin probability of an insurance company that invested in a risky asset (large volatility) was computed, ruin was imminent. However, the case of a nonrisky investment gave ruin probability that decayed exponentially.

Stock price fluctuations are influenced by many factors such as policy adjustments, economic environment, international situations, and disease outbreaks like COVID-19. Predicting stock prices gives crucial trading information about market efficiency, and it reduces investment risks; besides, it guides investors on how to design a suitable portfolio. Stock prices can be well modelled by random walks because of their up and down movements. This randomness may be best captured by Brownian motion, . However, Brownian motion has an expected value of zero which cannot be related to stock prices. Moreover, Brownian motion goes negative, hence not a good model for stock prices. Several models have been suggested to replace Brownian motion. We shall take all processes and random variables in this study to be defined on the filtered probability space satisfying the usual conditions. Here, is right continuous and -complete. To expound on the variables in the special space, is a sample space with elements denoted by ; is a -algebra on ; is a measure with compact support on [0, 1]; and is a filtration. A filtration is an increasing and right continuous class of sub -algebras of . The interpretation of the -field is that it is the information available to an agent at time with being the information available at time 0, (the initial information). Whenever , .

The geometric Brownian motion (GBM), sometimes called the exponential Brownian motion or the Black Scholes model, is a modification of that ensures positivity all the time. It is one of the mathematical models for predicting the future price of a stock. A stochastic process is said to follow a GBM process if it satisfies the stochastic differential equation (SDE):where is an -adapted Brownian motion, is the drift, and is the volatility. For constants and , both parameters satisfy the following:and

Details on existence and solutions to stochastic differential equations can be found in [3]. Itô’s lemma provides the solution to equation (1) as follows:where is the value of the process at time zero. Reference [1] used this model to predict future closing prices of small sized companies in Bursa Malaysia, and reference [4] also used this model to predict stock prices of the Walmart company at the New York Stock Exchange. The results showed acceptable predictions; however, the assumption of constant volatility and drift needs to be revisited to capture the real world scenarios. Finer details on stock price modelling using geometric Brownian motion are well described in [5].

The Ornstein–Uhlenbeck (OU) model is classified as the simplest mean-reverting model by [6]. The OU is also known as the arithmetic Ornstein–Uhlenbeck model and is used as an alternative to GBM when a tendency of reversion towards an equilibrium point is required. A stochastic process is said to follow an arithmetic Ornstein–Uhlenbeck process if it satisfies the following SDE:where is the speed of mean reversion, is the mean-reversion level (long-run mean), and is the volatility. For times ,

Consequently, is normally distributed with mean as follows:and variance as follows:

The OU model is a well-known example of continuous time models. It can be used to model data with Gaussian and diffusion behaviour [7]. Chaiyapo and Phewchean [8] used the OU model to predict commodity prices in Thailand at the Thai commodity market. Mariani et al. [9] developed a 3-component superposed OU model and applied it to financial markets. They underscored the need to study stock behaviours to both investors and governments. In the same article, they note that research methods that use the OU model to predict stock prices have some deviations from the expected behaviour and could be best handled using non-Gaussian processes [10]. In their work, they estimated the model parameters and weights. The improved OU model performed better than the OU model. The OU model with Levy noise has been studied recently by [11]. Gamma-related OU processes and their simulation appear in [12]. At times, the OU is unable to predict accurate prices when speculation is present in a market, and additionally, the spot prices (stock prices) predicted by the OU can have negative values [13]. Rogers in [14] noted that in the Ornstein–Uhlenbeck (Vasicek) model of interest rates, there is a possibility of negative rates which can result in substantial mispricing. A closely related model suitable for modelling the structure of interest rates is the Cox–Ingersoll–Ross model. The parameters in this model have the same meaning as in the OU process.

The Cox–Ingersoll–Ross model (CIR) was introduced in 1985 [15]. The SDE for the CIR model is given by the following equation:where is the value of the interest rate at time zero. The CIR model always takes non-negative values due to its square root element. Orlando et al. in [16] predicted future interest rates using the CIR model. They found out that the CIR model was efficient and able to follow very closely the structure of market interest rates and to predict future interest rates. The model is sensitive to the underlying parameters. During a period of low volatility, the CIR can be an incredibly useful and accurate model. However, if the model is used to predict interest rates during a time frame in which volatility extends beyond the parameters chosen, the CIR is limited in its scope and reliability. The expectation and variance of given that are given by the following equation:andrespectively.

Other models for stock price prediction are the time series models. Time series forecasting is widely used for nonstationary data whose statistical properties such as the mean and standard deviation are not constant over time but instead vary over time. Time series analysis mainly employs the following models: AR (autoregressive), MA (moving average), ARMA (autoregressive moving average), and ARIMA (autoregressive integrated moving Average) and its seasonal modification SARIMA, generalized autoregressive conditional heteroscedasticity (GARCH) models, and their combinations. These models are widely used for stock market analysis, sales forecasting, economic forecasting, astronomy, sales forecasting, and weather forecasting, among others. Time series analysis is the most common and fundamental traditional method used to perform the task of stock price forecasting. An effort to describe these models can be found in Vochozka et al. [17]. The combination of the AR and MA models forms the ARMA model of autoregressive order , and moving average order is expressed as follows:where is a stock price, are the parameters of the autoregressive component of order , are the parameters of the moving average component of order , and are independent and identically distributed white noise error terms that are usually normally distributed random variables with zero expectation and variance . The order and are non-negative integers. The GARCH model aims at capturing the volatility that the ARMA cannot. This model is usually carried out because financial data do not have a constant variance across time but instead show signs of volatility clustering. Li and Zhang in [18] predicted CYTS stock prices using the GARCH model. The general form for GARCH model is as follows:where is the long-run volatility with condition and , and are parameters of the model. An ARMA error whose conditional variance follows a generalized autoregressive conditional heteroskedasticity (GARCH) process is called an ARMA-GARCH model (mixed ARMA-GARCH model). Specifically, each component of the mixed model can be denoted as an ARMA model with a residue term which is assumed to be Gaussian white noise whose variance is denoted by . However, limitations of time series models are as follows: the difficulty to accurately identify the correct model to represent the data and a poor performance for long-term forecasts. Next, we describe the exponential Ornstein–Uhlenbeck model that we used to predict the stock prices at USE. The main contribution to the literature is in the use of the exponential Ornstein–Uhlenbeck model to predict stock prices at a stock market and how to compute the price-acceptable band/region. This model is superior to Brownian motion, geometric Brownian motion, mean-reverting OU model, Cox–Ingersoll–Ross model, and the time series models. The work is based on mathematical finance and stochastic differential equations.

2. The Exponential Ornstein–Uhlenbeck Model

A stochastic process is said to follow an exponential Ornstein–Uhlenbeck (EOU) process if its dynamics are governed by the following SDE:where all the parameters carry the same meaning as in equation (5).

The solution to equation (14) by Itô’s Lemma is

The expected value of given that isand its variance is

Schwartz [19] used the exponential Ornstein–Uhlenbeck process for WTI crude oil, gold, and copper. Equation (14) is a modification of the mean-reverting model of Dixit and Pindyck in [6]. This modification was proposed by [19]. The Dixit and Pindyck model and equation (14) both do not have negative values of spot prices. Mejía Vega in [13] modelled the spot prices of gold using the exponential Ornstein–Uhlenbeck process and the data used were from Bloomberg.

3. Materials and Methods

A spreadsheet of the historical daily stock prices of Stanbic Bank Uganda was downloaded from the Wall Street Journal (WSJ) under the section: “Research and Ratings” of SBU at USE on WSJ. The daily historical data of SBU from 4th July 2011 to 4th July 2017 were used to determine the parameters of the model and later; the prediction of stock prices for the next 100 days was carried out. The following url was used to download the historical prices of SBU at USE from WSJ: https://www.wsj.com/market-data/quotes/UG/XUGA/SBU/historical-prices.

To determine the parameters of the exponential Ornstein–Uhlenbeck model, we used the natural logarithms of the closing stock prices of SBU. Let and , then

The equation of the conditional probability density of under the exponential Ornstein–Uhlenbeck model in equation (14) is given by the following equation:where .

We took the time step for , for . Hence,

Let and . The likelihood function of a set of observations is given by the following equation:

If the observations are independent and identically distributed, then the joint log-likelihood function is given by the following equation:

The maximum of the joint-log-likelihood function is obtained by taking the partial derivatives with respect to each parameter and equate them to zero. Taking the partial derivative of equation (22) with respect to ,

Taking the partial derivative of equation (22) with respect to ,

Taking the partial derivative of equation (22) with respect to ,

To simplify equations (23)–(25), we let , , for so thatand

The mean absolute percentage error (MAPE) is given by the following equation:where is the number of period forecast, is the actual value in time period , and the forecast at time is denoted by . MAPE was computed and used to evaluate the forecasting accuracy of the exponential Ornstein–Uhlenbeck model in each time period. The prediction intervals of the predicted closing stock prices in each time period were established and utilised in plotting a confidence band for the predicted stock prices before and during the outbreak of COVID-19.

A prediction interval can be written as , where the multiplier depends on the coverage probability. To get a prediction interval, it is necessary to have an estimate of .

4. Results and Discussion

We obtained the parameters of the exponential Ornstein–Uhlenbeck model using historical data of SBU. Excel software was used to compute the values of for 1306 days (from July 2011 to July 2017).

For , , , , , and .

The values of , and were substituted in equations (23)–(25) to obtain the values of , and . Hence, the values of and were obtained using the estimated values of , respectively.

The parameter values were the following (all rounded to 4 decimal places): .

The long-term mean of the logarithm of the prices was 3.3283, the mean-reversion speed of the log-prices which is the rate at which the log-prices revert to their long-term mean was 0.0409. The percentage volatility of the logarithm of the stock prices which indicates the rate at which prices move up and down was 0.0468.

The stock prices of the next 100 days from July 2017 were predicted (that is to say, closing stock prices from July 2017 to January 2018). The discretized form of equation (15) was used to predict the closing stock prices using the Monte Carlo simulations, where the average of 1000 simulated stock prices on a particular day was taken to be the predicted stock price on that day. We calculated the prediction interval with a multiplier of 1.96 which gave a probability of of the predicted value to capture the true value. We computed the standard deviation of the forecast distribution using Matlab and computed the prediction interval on each day. Figure 1 shows a sample path of the prediction intervals together with the simulated stock prices and the actual closing stock prices.

The closing stock prices and predicted closing stock prices are shown in Figure 1, and the prediction interval captured all the actual values. Before the COVID-19 outbreak, the MAPE was , indicating reliable predictions. This value was different at each run but the trend was the same.

Riding on this accuracy, we predicted stock prices during the days of COVID-19 outbreak (100 days from 9th December 2019 to 24th July 2020). The Monte Carlo simulations using equation (14) were carried out where the average of 1000 simulated stock prices on each day was taken to be the predicted stock price on that day. Again, we calculated the prediction interval with a multiplier of 1.96 which was expected to have a probability of of the predicted value to capture the true value in that period of time. Figure 2 shows a plot of the prediction interval together with the simulated stock prices and the actual closing stock prices. The MAPE value obtained for the 100 days during COVID-19 was which indicated that the model was a good forecast for that time period. As expected, the actual stock values are far way below what they would have been in absence of COVID-19.

We made a comparison to predictions using the traditional mixed model. We used the model with the smallest MAPE value of . Figure 3 shows a plot of the predicted and actual stock prices for the 100 days after 4th July 2017.

The value of the MAPE showed that the model is also highly accurate for SBU data (before the outbreak of COVID-19) though it was tiresome to find out which of the mixed ARMA-GARCH models would best fit available data. However, the MAPE value for the exponential Ornstein–Uhlenbeck model was smaller than the one of the model.

Table 1 shows part of the predicted stock prices obtained while using both the exponential Ornstein–Uhlenbeck model (EOU) and the mixed model (MAG). In Table 1, represents the predicted stock price and the corresponding MAPE is also indicated.

The MAPE value for all the 100 days before the outbreak of COVID-19 of the exponential Ornstein–Uhlenbeck model was while that of the mixed model was . Both of the two models were highly accurate before the outbreak of COVID-19 but the exponential Ornstein–Uhlenbeck model outperformed the model.

5. Conclusion

The parameters of the exponential Ornstein–Uhlenbeck model that were obtained using the logarithms of the stock prices of SBU were the following; . The estimated parameters were used to predict the stock prices of SBU. One thousand values of stock prices were predicted for each day, and their average was taken to be the predicted stock price on that day. This was carried out using Monte Carlo method. The predicted stock prices before the outbreak of COVID-19 were very close to the actual values and in the run that we used (different predictions were obtained for each run); the MAPE value which was showed that the exponential Ornstein–Uhlenbeck model was highly accurate for the data set that was used. The prediction interval that was established captured all the actual values. The predicted stock prices during the outbreak of COVID-19 were a bit close to the actual values and in the run that we used, and the MAPE value which was showed that the exponential Ornstein–Uhlenbeck model was a good forecast model (but not highly accurate) for the data set that was used. The prediction interval in this case did not capture the actual values. This indicates that the stock prices were affected by the outbreak of COVID-19.

Comparison of the forecasting accuracy before the outbreak of COVID-19 of the exponential Ornstein–Uhlenbeck model with that of the mixed ARMA-GARCH model whose MAPE value was showed that the exponential Ornstein–Uhlenbeck model outperforms the mixed . Namugaya et al. [20] studied the GARCH approach in details to model stock volatility on USE. They employed different univariate generalised autoregressive conditional heteroscedastic (GARCH) models, both symmetric and asymmetric. The models included GARCH (1, 1), GARCH-M, EGARCH (1, 1), and TGARCH (1, 1). They used quasi maximum likelihood (QML) method to estimate the models and then the best performing model obtained using two model selection criteria: Akaike information criterion (AIC) and Bayesian information criterion (BIC).

Further research to predict stock prices using equation (14) can involve restrictions on the parameters of the model by defining an interval where each parameter falls and varying the parameters to establish conditions on the intervals when they can give appropriate and more accurate results. Further research can also employ machine-learning techniques to obtain the parameters (range of the parameters) of the exponential Ornstein–Uhlenbeck model. Another suggested modification is a 3-component superposed exponential Ornstein–Uhlenbeck model as was the case on the OU model in [9]. One can also compare the results with those from the state-of-the-art (SOTA) models (BERT, GPT, ELMo, RoBERTa, and XLNet). These models, recent in trends, are advantageous in that they increase task precision and reliability, in addition to reducing generation time.

Data Availability

A spreadsheet of the historical daily stock prices of Stanbic Bank Uganda is available for download from the Wall Street Journal (WSJ) under the section: “Research and Ratings” of SBU at USE on WSJ. The following url was used to download the historical prices of SBU at USE from WSJ. \newline\url {https://www.wsj.com/market-data/quotes/UG/XUGA/SBU/historical-prices}.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

The authors were funded by the Eastern Africa Universities Mathematics Programme (EAUMP), Sida Phase IV project 316-2014: $ Capacity Building in Mathematics and its Applications. Additional financial support came from the NORHED II: Mathematics for Sustainable Development Project.