# Applications of Parameterized Nonlinear Ordinary Differential Equations and Dynamic Systems: An Example of the Taiwan Stock Index

Authors: Meng-Rong Li; Tsung-Jui Chiang-Lin; Yong-Shiuan Lee
Journal: International Journal of Differential Equations
 (2018)

---

## Abstract

Considering the phenomenon of the mean reversion and the different speeds of stock prices in the bull market and in the bear market, we propose four dynamic models each of which is represented by a parameterized ordinary differential equation in this study. Based on existing studies, the models are in the form of either the logistic growth or the law of Newton’s cooling. We solve the models by dynamic integration and apply them to the daily closing prices of the Taiwan stock index, Taiwan Stock Exchange Capitalization Weighted Stock Index. The empirical study shows that some of the models fit the prices well and the forecasting ability of the best model is acceptable even though the martingale forecasts the prices slightly better. To increase the forecasting ability and to broaden the scope of applications of the dynamic models, we will model the coefficients of the dynamic models in the future. Applying the models to the market without the price limit is also our future work.


---

## Body

## 1. Introduction

Stock indices draw a lot of attention in the financial field and modelling stock prices is one of the major topics. Nevertheless, in most existing studies, stock price returns are modelled instead of stock prices themselves. It results from the theory of random walks stated and published in many books and theses. Fama’s 1965 article [1] is one of the most commonly known ones. Among massive researches of modelling stock prices, Chen et al. [2] have investigated and modelled the mean reversion of stock prices. They characterized the phenomenon by three dynamic models derived from the concept of Newton’s law of cooling. However, the type of the stock movement other than mean reversion should be included in a more reasonable model. Also, the speed of the convergence to the implied equilibrium should be described if we try to increase the accuracy of the model.From past experiences, the uptrend and downtrend of the stock price, usually during a bull market and a bear market, respectively, move differently. The uptrend usually goes up fast at first due to good news and then slows down gradually as a result of selling pressure, but the downtrend generally drops steeply. The stock price movement and the logistic growth perform very much alike; nevertheless, stock prices fluctuate more dynamically in the real world. Therefore, modelling this phenomenon is the main goal in the study.We examined a series of the daily closing prices of Taiwan Stock Exchange Capitalization Weighted Stock Index (TAIEX) and treated it as a dynamic system. The only assumption in this study is that the stock prices are related to time. In order to depict the movement with respect to time, we attempt to modify the logistic growth model and bring in the technique of dynamic integration to construct some models. Furthermore, the models describing the mean reversion in the existing study only consist one time related coefficient [2]. We include two time-varying coefficients for constructing new models to increase the accuracy. Hence, we will introduce the nonlinear dynamic models in this study. From this point of view, modelling the stock prices may be more reliable.In Section2, we provide the literature review of the logistic growth model and dynamic integration. Section 3 is the methodology of how we build the nonlinear dynamic models. Section 4 consists of the empirical study of applying the dynamic models to TAIEX. In Section 5, we make some conclusions from the empirical study and some suggestions for future works.


## 2. Literature Review

The logistic growth model was named by the mathematician Verhulst. He solved the logistic equation and called the solution the logistic function [3–5] to express the population growth. The logistic model is continuous in time and can be stated by the differential equation:(1)dNdt=rN1-NK,where t is time, r is the growth rate, K is the carrying capacity, and N is the population size. The logistic growth model was first used to describe the population growth in a restricted environment and then extensively applied to all kinds of fields such as Biology, Chemistry, Economics, Demography, and Statistics.Concerning the topic of macroeconomics, Teräsvirta and Anderson [6] included logistic function to build a smooth transition autoregressive (STAR) model for describing business cycles. Based on their research, González-Rivera [7] applied STGARCH model on stock returns and exchange rates to explore the asymmetric response of conditional variances to positive and negative news. Other than applying logistic function, the nonlinear time series model such as GARCH is applied to explain the nonlinear phenomenon in the behaviors of the stock returns in the existing studies [8, 9]. Besides, there are neural network models applied to model the stock index [10–12]. Guresen et al. [10] list a table of existing studies of artificial neural networks and financial time series models. The exponential law of the stock movement is described and analyzed by Gkranas et al. [13] and Zarikas et al. [14]. However, applying logistic equation to stock prices directly is absent in existing studies.As for applying dynamic system and differential equations to stock prices, Chiang-Lin et al. [15] applied “parabola approximation” and “dynamic integration” proposed in [16] to model the Taiwan stock index, TAIEX, and evaluate its derivative by considering the index as a dynamic system. Li et al. [17] also applied the same methods to model German DAX and tried to develop a risk detecting instrument of approaching financial catastrophe. Chen et al. [2] further combined Newton’s law of cooling and dynamic integration to explain the phenomenon of mean reversion by modelling TAIEX. On the basis of existing researches, we try to transform the logistic model into some models by considering the stock price, the velocity of the stock price, and the stock return as the subject, respectively. We also solve the equations representing the models by dynamic integration. The details of the dynamic models are in the following section.


## 3. Methodology

In order to characterize the movement of the stock prices, we only assume that the stock price is a function of timet and consider it as a dynamic system. Since we suspect that the rise and fall of the stock prices may be described by the logistic growth model, we combine the concept of the logistic growth model and the dynamic integration to build dynamic models. The models are represented by differential equations which are detailed below along with their solutions.Model A (dynamic logistic model) (2) d S t d t = α 1 t · S t 2 + β 1 t · S t ,where S(t) is the stock price at time t. We can rewrite (2) as(3)dStdt=β1t·St·1-St-β1t/α1t,and hence model A is in the form of the logistic growth model.Because the stock prices change dynamically in reality, we assume that the coefficientsα1(t) and β1(t) are constant during a very short time. Then we consider the parameterized differential equation:(4)dStdt=α1·S2t+β1·St,St0=S0,St1=S1,t0<t1,with given values of two points at time t0 and t1. Let c=S(t0)+β1/α1/S(t0) and the solution is(5)St=β1/α11/ceβ1t-t01-1/ceβ1t-t0,ifSt>St0,St+β1/α1·St>0;(6)St=-β1/α11/ceβ1t-t01+1/ceβ1t-t0,ifSt>St0,St+β1/α1·St<0;(7)St=β1/α11/ce-β1t-t01-1/ce-β1t-t0,ifSt<St0,St+β1/α1·St>0;(8)St=-β1/α11/ce-β1t-t01+1/ce-β1t-t0,ifSt<St0,St+β1/α1·St<0.Model A describes the relationship between the stock price,S(t), and its velocity, dS(t)/dt. From the economic point of view, there exists an implied equilibrium in the market. All other things being equal, if the stock price is below the equilibrium, it will rise towards the equilibrium price; if the stock price is above the equilibrium, it will decline. The phenomenon is also called the mean reversion. This model characterizes the mean reversion of the stock prices if α1 is negative, β1 is positive and when the expected future stock price is higher than the current stock price. Under the circumstances, the implied equilibrium is at β1/α1 and the stock price moves as how the logistic growth model describes. The convergence of the simulated theoretical stock prices by (5), (6) is plotted in Figures 7 and 8. Otherwise, the movement of the stock prices follows a quadratic differential equation with no constant growth rate [15]. In this situation, the stock prices will not converge to the implied equilibrium.In addition to model A, we further consider both the velocity,dS(t)/dt, and the acceleration, d2S(t)/dt2, of the stock price to construct a model. In this instance, the model may represent the movement more properly. Hence, we propose model B in the following.Model B (dynamic transformed logistic model) (9) d 2 S t d t 2 = α 2 t · d S t d t 2 + β 2 t · d S t d t ,where S(t) is the stock price at time t.Assuming the coefficientsα2(t) and β2(t) are constant during a very short time, we consider the parameterized differential equation with given values of two points at times t0 and t1:(10)d2Stdt2=α2·dStdt2+β2·dStdt,St0=S0,St1=S1,t0<t1,and it can be solved as follows. Let vt=dSt/dt and h=v(t0)+β2/α2/v(t0); then the solution is(11)St=St0-1α2ln⁡eβ2t-t0-h1-h,ifvt+β2α2·vt>0,vt>vt0,St>St0;St=St0+1α2β2β2ln⁡eβ2t-t0-h1-h,ifvt+β2α2·vt>0,vt>vt0,St<St0;St=St0-1α2ln⁡eβ2t-t0+h1+h,ifvt+β2α2·vt<0,vt>vt0,St>St0;St=St0-1α2·β2β2ln⁡eβ2t-t0+h1+h,ifvt+β2α2·vt<0,vt>vt0,St<St0;St=St0+1α2β2β2ln⁡e-β2t-t0-h1-h,ifvt+β2α2·vt>0,vt<vt0,St>St0;St=St0-1α2ln⁡e-β2t-t0-h1-h,ifvt+β2α2·vt>0,vt<vt0,St<St0;St=St0+1α2β2β2ln⁡e-β2t-t0+h1+h,ifvt+β2α2·vt<0,vt<vt0,St>St0;St=St0+1α2ln⁡e-β2t-t0+h1+h,ifvt+β2α2·vt<0,vt<vt0,St<St0.Model B describes the relationship between the velocity,dS(t)/dt, and the acceleration, d2S(t)/dt2, of the stock price. The relationship is in the form of the logistic growth model. When α2 is negative and β2 is positive, the velocity moves in the way that the logistic growth model depicts. That is, the velocity reverses to an implied equilibrium velocity so that the stock price goes up or down with an approximately constant speed. In the case of other combinations of the coefficients (α2 and β2), the velocity diverges and hence the stock prices fluctuate more dynamically.Other than the velocity, the relative growth rate of the stock price,dSt/dt/St, which is also known as the return is a meaningful measure in the field of finance. Therefore, we change the velocity and the acceleration in model B into the relative growth rate and its derivative to build model C. Model C provides another kind of differential equation characterizing the stock price movement.Model C (dynamic relative growth rate transformed logistic model) (12) d δ t d t = α 3 t · δ 2 t + β 3 t · δ t ,where S(t) is the stock price at time t and δt=dSt/dt/St is the relative growth rate of the stock price at time t.Assuming the coefficientsα3(t) and β3(t) are constant during a very short time, we consider the parameterized differential equation with given values of two points at times t0 and t1:(13)dδtdt=ddtdSt/dtSt=α3·δ2t+β3·δt,St0=S0,St1=S1,t0<t1,and it can be solved as follows. Let k=δ(t0)+β3/α3/δ(t0) and the solution is(14)St=St0·exp⁡-1α3ln⁡eβ3t-t0-k1-k,ifδt+β3α3·δt>0,δt>δt0,St>St0;St=St0·exp⁡1α3β3β3ln⁡eβ3t-t0-k1-k,ifδt+β3α3·δt>0,δt>δt0,St<St0;St=St0·exp⁡-1α3ln⁡eβ3t-t0+k1+k,ifδt+β3α3·δt<0,δt>δt0,St>St0;St=St0·exp⁡-1α3·β3β3ln⁡eβ3t-t0+k1+k,ifδt+β3α3·δt<0,δt>δt0,St<St0;St=St0·exp⁡1α3β3β3ln⁡e-β3t-t0-k1-k,ifδt+β3α3·δt>0,δt<δt0,St>St0;St=St0·exp⁡-1α3ln⁡e-β3t-t0-k1-k,ifδt+β3α3·δt>0,δt<δt0,St<St0;St=St0·exp⁡1α3β3β3ln⁡e-β3t-t0+k1+k,ifδt+β3α3·δt<0,δt<δt0,St>St0;St=St0·exp⁡1α3ln⁡e-β3t-t0+k1+k,ifδt+β3α3·δt<0,δt<δt0,St<St0.Model C describes the relationship between the relative growth rate of the stock price,δt, and its derivative. Since the relative growth rate is the return of the stock price, when α3 is negative and β3 is positive, the return moves in the way that the logistic growth model depicts. That is, the return reverses to a constant implied equilibrium. In the case of other combinations of the coefficients (α3 and β3), the return diverges and the fluctuations of the stock prices are more dynamical but different from what model B describes.The dynamic models above are built on the work of Chen et al. [2]. But all of them consist of two coefficients instead of one as in their study. Hence we generalize one of their models into a two-coefficient dynamic model and compare it with the three models above. This extended model is stated in the following.Model D (dynamic general Newton model) (15) d S t d t = α 4 t · S t - A t ,where S(t) is the stock price at time t. We assume the coefficients in (15) are constant during a very short time interval t∈t0,t1 and consider the parameterized differential equation:(16)dStdt=α4·St-A,St0=S0,St1=S1,t0<t1,between two given data points at times t0 and t1. The solution can be found in the article of Chen et al. [2].As applying these dynamic models, we discretize and convert them into difference equations since the time interval between the two given points at timest0 and t1 is relatively short compared to the interval of the complete data. The discretization and the parameterization make the differential equations solvable. In the empirical study, we fit and forecast the data by the solutions. We also adopt the dynamic forecasting method discussed in [2] to obtain more accurate theoretical values.The forecasting error is measured by MAPE (Mean Absolute Percentage Error) and RMSPE (Root Mean Square Percentage Error). They are defined asMAPE=1/N∑i=1NS^(i)-S(i)/S(i)×100% and RMSPE=1/N∑i=1NS^(i)-S(i)/S(i)2×100%, where S^i is the theoretical value of the model at time i, Si is the market value at time i, and N is the length of data points. Lewis [18] suggested that the forecasting ability of a model can be classified as in Table 1.Table 1
Classification of model forecasting ability by MAPE.
MAPE <10% 10%~20% 20%~50% >50% Accuracy High Good Reasonable InaccurateRMSPE can also determine the forecasting ability of a model by the classification of Table1 although RMSPE is more affected by extreme values. In brief, the smaller the values of MAPE and RMSPE are, the better the forecasting ability of a model is. Besides, MAPE and RMSPE are also calculated to measure the fitting accuracy of the models in this study.


## 4. Empirical Study

We collected and studied a series of Taiwan Stock Exchange Capitalization Weighted Stock Index (TAIEX) closing prices from June 1, 2015, to August 31, 2016. There are 310 trading days during this period. Since the dynamic forecasting method is applied, the length of forecasts needs not to be long [2] so that we make 30 forecasts for each model. But the forecasting periods of the four models are different because first-order difference is revolved in calculations of model A, D and second-order difference is revolved in calculations of model B, C.We apply forward difference method to numerical analysis since the results do not differ much from applying backward difference method [16]. For fitting with the dynamic models, the future information is included in calculations. To avoid the inclusion of future information for model forecasting, the theoretical values are obtained assuming that the situation is unchanged during a longer period from three trading days before the date to be forecasted. That is, the model coefficients are assumed to be constant in the interval t∈t0,t3 and the theoretical values at time t3 are obtained by solving (4), (10), (13), and (16), respectively. Therefore, the fitting periods of model A, D begin from June 2, 2015, and end at July 19, 2016, while the fitting periods of model B, C begin from June 2, 2015, and end at July 18, 2016. Forecasts of model A, D are both from July 20, 2016, to August 30, 2016; forecasts of model B, C are both from July 19, 2016, to August 29, 2016.In numerical analysis, the theoretical values of model D sometimes blow up when the coefficientα4 are very large because of its position in the power of exponential part of the solution. The theoretical values make sense if they are restricted in a range where market values exist. Hence, when α4 is higher than 2 (resulting in the theoretical value out of range of possible market values on the condition) the theoretical value will be replaced with the theoretical value of the previous trading day. Moreover, a 10% daily price fluctuation limit in Taiwan stock market is set up since June 1, 2015. Accordingly, the theoretical values of the four models are restricted to the limit if they are above or below it.The TAIEX series is also analyzed by examining its sample ACF (autocorrelation function) and PACF (partial autocorrelation function) and testing by Ljung-Box Test [19] shown in Figure 9 and Table 4. The autocorrelation of the series is not statistically significant. Under the circumstances, we suppose the stock closing prices during the period is a random walk and consequently the martingale is set as the benchmark model. Once the theoretical values of the four dynamic models are obtained, we compare them with the fits and forecasts of the martingale.We will first present the fits of the four dynamic models and next their forecasts in the section. The fitting results are in Figures1–4.Figure 1
Time plot of raw data and model A fits.Figure 2
Time plot of raw data and model B fits.Figure 3
Time plot of raw data and model C fits.Figure 4
Time plot of raw data and model D fits.The graphs show that the fits of model A fluctuate much more than the other models and model D has the fewest deviations of the fits from the market values. The MAPEs and RMSPEs of the models are listed in Table2. The order of the model performance by the values coincides with the graphs. Furthermore, the fits of the martingale are only closer to the market values than those of model A.Table 2
MAPEs and RMSPEs, fits of the four dynamic models and the martingale.
MAPE RMSPE Model A 2.0362% 3.5065% Model D 0.3467% 0.5943% Martingale(2015/06/02~2016/07/19) 0.7608% 1.0404%  Model B 0.6634% 1.0072% Model C 0.6622% 1.0080% Martingale(2015/06/02~2016/07/18) 0.7625% 1.0421%We then examine the model coefficients. The graphs and some statistics of the coefficients are in Table5 and Figures 10–13. Basically the alphas and the betas move in the small range around their median except for some large jumps or drops. The unusual jumps and drops seem to appear on the same dates and should be studied more thoroughly.As noted in the previous section, the phenomenon of mean reversion shows ifα1<0 and β1>0 for model A, α2<0 and β2>0 for model B, α3<0 and β3>0 for model C, and α4<0 for model D. On the condition, if the subject value is higher than the implied equilibrium, it will reverse to the equilibrium with a sharp decreasing speed; if the subject value is lower than the implied equilibrium, it will first reverse to the equilibrium with a steep rise and then gradually slow down. The phenomenon is for different subjects related to stock index: the stock index closing price for model A, D; the velocity of stock price for model B; the relative growth rate (return) of stock price for model C. Therefore, the mean reversion described in models A and D is either the bull market or the bear market for the stock prices. In models B and C, the bull market (upward trend) or the bear market (downward trend) is used to describe the velocity and the related growth rate of the stock prices, respectively. The proportion of mean reversion shown during the studied period of the data is 0.72 (199/278) for model A, D and 0.23 (64/277) for model B, C. Other than the mean reversion phenomenon, the dynamic models also characterize different types of market trends as well by different performances of the model coefficients.Next we forecast by the four dynamic models and compare the results with the martingale in Figures5 and 6. The details of each model are shown in Figures 14–19. The forecasts of model A fluctuate the most and have the most deviations from the market values. Models B, C, and D all forecast the trend of the stock prices well and model D seems to have the most accurate forecasts. We list the errors of the four dynamic models and the martingale in Table 3. The forecasting ability of the martingale is the best among all models; however, model D has similar results.Table 3
MAPEs and RMSPEs, forecasts of the four dynamic models and the martingale.
MAPE RMSPE Model A 2.5055% 4.4041% Model D 0.4658% 0.5973% Martingale(2016/07/20~2016/08/30) 0.4306% 0.5377%  Model B 0.7082% 0.8786% Model C 0.7101% 0.8799% Martingale(2016/07/19~2016/08/29) 0.4403% 0.5404%Table 4
p values of Ljung-Box tests for TAIEX daily returns from June 2, 2015, to August 31, 2016.
lag = 1 lag = 2 lag = 3 lag = 4 lag = 5 lag = 6 lag = 7 lag = 8 lag = 9 lag = 10 lag = 11 lag = 12 lag = 13 lag = 14 lag = 15 lag = 16 lag = 17 lag = 18 lag = 19 lag = 20 0.2254 0.4485 0.3458 0.2858 0.2568 0.3482 0.1224 0.1421 0.1831 0.2470 0.2842 0.2744 0.2669 0.2865 0.3065 0.3719 0.4398 0.5037 0.4334 0.1304Table 5
Centering tendency of the dynamic model coefficients.
Mean 10% Trimmed Mean Median α 1 −0.000141 −0.000098 −0.000101 β 1 1.169824 0.832151 0.867041 α 2 0.031618 −0.004302 −0.000321 β 2 −1.144368 −0.044949 −0.911920 α 3 206.432875 −37.809327 −2.199180 β 3 −1.052092 −0.026376 −0.909614 α 4 −1.20276 −0.866740 −0.859210 A 8520.318324 8490.764107 8477.203518Figure 5
Time plot of raw data and the forecasts of the four dynamic models and the martingale.Figure 6
Time plot of raw data and the forecasts of model D and the martingale.Figure 7
The convergence of the simulated theoretical stock prices by equation (5). (Impliedequilibrium = medianβ1/medianα1 = 8563.101 high stock index initial value St0 = 8563.101 + 500 = 9063.101; low stock index initial value St0 = 8563.101 – 500 = 8063.101).Figure 8
The convergence of the simulated theoretical stock prices by equation (6) (implied equilibrium = 8563.101; high stock index initial valueS(t0) = 9063.101; low stock index initial valueS(t0) = 8063.101).Figure 9
ACF and PACF of TAIEX daily returns from June 2, 2015, to August 31, 2016.Figure 10
Time plots of model A coefficients-α1 and β1Figure 11
Time plots of model B coefficients-α2 and β2.Figure 12
Time plots of model C coefficients-α3 and β3.Figure 13
Time plots of model D coefficients-α4 and A.Figure 14
Time plots of raw data and the forecasts of model A.Figure 15
Time plots of raw data and the forecasts of model B.Figure 16
Time plots of raw data and the forecasts of model C.Figure 17
Time plots of raw data and the forecasts of model D.Figure 18
Time plots of raw data and the forecasts of model B, C and the martingale.Figure 19
Time plots of raw data and the forecasts of model A, D and the martingale.The sources of error include the disparity between the differential equations and the difference equations, the disagreement between the movement of the subject and the model form, and the dynamics of the model coefficients. If the model form does not represent the movement of the subject very accurately, the model will produce larger error and thus the forecasting ability of the model will be lower. Model A and model D both characterize the relationship between the subject and its first-order derivative. Nevertheless, model D forecasts much better than model A as a result of the concordance between model D and the data. Besides, error comes from the dynamics of the model coefficients. We assume the model coefficients are constant in a four-day interval prior to the forecast during the forecasting process. In real world, the coefficients are more dynamical and consequently error shows.


## 5. Conclusions

We propose four dynamic models to characterize the movement of the subject, the TAIEX closing prices. Some types of the movement are considered in the models: the mean reversion, different speeds of the uptrend and the downtrend, and so forth. There are two forms of the models: the logistic growth and the law of Newton’s cooling. We apply the four dynamic models to fit and forecast the TAIEX closing prices and compare them with the martingale. The fits of models B, C, and D are closer to the market values than those of the martingale which suggests that they characterize the movement of the subject quite properly. However, the martingale outperforms the dynamic models for forecasting since the error of the martingale is the smallest. But the forecasts of model D are very similar to the martingale and has the best performance among the four dynamic models. To sum up, model D is the most proper model to characterize the TAIEX closing prices but we still need to examine and model the coefficients to increase its forecasting ability. Modelling the coefficients by some different methods such as time series analysis and polynomial extrapolation is our future work.Furthermore, there are some limits to the dynamic model applications. For example, the theoretical values are limited in a range of 10% price limit because of the regulation constraint. Therefore, applying the dynamic models to the subject in the market without the price limit may not be suitable. However, the empirical study shows that the model in the form of the law of Newton’s cooling (model D) is better than the models in the form of the logistic growth (models A, B, and C). This suggests that the former type of the model may be more proper for the market with price limit while the later type of the model may be more proper for the market without price limit. Confirming the conjecture and modifying the models to generalize their applications are also our future work.



---

*Source: 4762485-2018-04-12.xml*