Type-3 fuzzy logic and Lyapunov approach for dynamic modeling and analysis of financial markets

Chaos theory offers a new way to investigate variations in financial markets data that cannot be obtained with traditional methods. The primary approach for diagnosing chaos is the existence of positive small Lyapunov views. The positive Lyapunov index indicates the average instability and the system's chaotic nature. The negativity indicates the average rate of non-chaoticness. In this paper, a new approach on basis of type-3 fuzzy logic systems is introduced for modeling the chaotic dynamics of financial data. Also, the attracting dimension tests and the Lyapunov views in the reconstructed dynamics are used for examinations. The simulations on case-study currency market show the applicability and good accuracy of the suggested approach.


Introduction
The theory of chaotic systems (CSs) is a novel way to model economics, especially in financial markets.Chaotic systems are observed in nature as well as in human behavior.For instance, heartbeats, clock pendulums, and economic fluctuations all exhibit nonlinear dynamic behavior.According to this theory, events in the world are so complex and dynamic that they seem chaotic, but in fact, the chaotic system has an underlying order.It is challenging to identify this hidden order, although it is not impossible because several factors in dynamic and unpredictable interaction shape the behavior of phenomena and create their future behavior pattern.Research on the chaotic existence in economic problems has been started since 1980s.For example, Stutzer [1] introduced a macroeconomic growth model with chaotic dynamics.Barnett and Chen [2] showed that financial factors show chaotic behavior.Shintani and Linton [3] have also explored the existence of chaos in various economic indicators.The presence of chaos in the exchange rate of Romania against the US dollar was investigated by Scarlat et al. [4].Using the BDS test and the Lyapunov view, and correlation dimension, existence of chaos in both periods was confirmed.Lee-Chua [5] studied the existence of chaos on the Philippine peso against the US dollar and used correlation dimension tests and the most extensive Lyapunov view.These tests are shown the presence of chaos [6].
Chaotic modeling and dynamic modeling of financial systems has been well studied [7][8][9].For example, Diouf and Sene [10] used the Caputo derivative to construct a fractional-order model for financial systems, and bifurcation diagrams analyze factors, such as saving rate.Liping et al. [11] developed a chaotic model for financial systems using the Atangana-Baleanu operator and analyzed the chaotic behavior by the Lyapunov approach.Atangana et al. [12] developed the Mittag-Leffler technique to design a chaotic model and suggested an optimal controller based on the Euler-Lagrange scheme.Farman et al. [13] analyzed the minimum interest rate by a chaotic model and studied the stability range.Xu et al. [14] studied a chaotic model and analyzed the bifurcation phenomena and stability by designing a simple controller.Ma and Li [15] developed a three-dimensional (3D) model and introduced some conditions to stabilize an expanded model.Lu [16] proposed an intermittent controller for a chaotic financial model and analyzed instability in various conditions.Anh and Inoue [17] presented a dynamic model and compared it with Black-Scholes model.
The similarity of the time series of exchange rate parity in financial markets with chaotic time series and their random characteristics make possible the existence of some kind of chaotic nonlinear dynamics that can be discovered in these series.Every country in the international economic system interacts with other economies through two channels: one is the trade of goods and services and the other is the inflow and outflow of capital.As a result of this interaction, the country's domestic currency has a price in the global economy, called the exchange rate in the conventional economy.In purchasing power parity, the exchange rate shows the ratio of the prices of domestic goods in terms of domestic currency to the price of foreign goods in local currency.
Herein, the cases where the exchange rate forecasting and how its change process should be considered as a necessary matter in decision-making are briefly mentioned.
A-Speculation: A speculator enters into transactions with the risk of currency fluctuations in the currency market to make a profit.If changes prediction accuracy is good in the cash rates of the currency well, they will profit.
B-Uncovered Interest Arbitrage (IA): IA is related to the global flow of cash capital in the short term in order to earn more money from abroad.For this purpose, in order to avoid the loss of foreign currency devaluation, it is necessary to know how the exchange rate changes.
C-Foreign direct investment: In the evaluation of projects related to foreign direct investment, calculated by indicators such as Net Present Value (NPV) and Internal Rate of Return (IRR), in order to convert the cash flow of foreign money into domestic money, one needs to forecast the exchange rate.Because a plan that is acceptable in terms of foreign currency may not be acceptable in terms of domestic currency.
A leading way to find an uncertain system in economics is to verify that data exhibit a chaotic behavior.This idea is the hidden framework of a chaotic economy.Hence, there are two main groups of data perturbation tests: the first method is to look at the trajectory of the data when the initial conditions of the system are slightly changed [18].By approximating the Lyapunov expression, this may be accomplished.The divergence of the mean route of experimental data produced by the system with an incredibly slight change in the beginning circumstances is quantified by the Lyapunov exponent.When there is a small change in the deterministic system, if the data change exponentially, then the Lyapunov exponent will be positive and therefore chaotic.The Lyapunov expression will be negative in the event that the convergence route resumes its steady state [19].The next test for the existence of chaos is 2system absorber dimension test.Unfortunately, the analysis becomes complicated in the presence of larger dimensions, and the test for chaos is weaker.This issue is a strong barrier to the theory of chaotic economics, and it is one of the main reasons that statistical research has not been aware of the existence of chaotic dynamics in the data [20].
To deal with uncertain, complicated systems, recently, type-3 fuzzy logic systems (T3-FLSs) have been suggested.T3-FLSs have been used for different applications.For example, Liu et al. [21] studied an energy management system and utilized a T3-FLS to handle the uncertainty of solar energy.Cao et al. [22] developed an energy modeling and forecasting technique is developed using T3-FLSs and verified the applicability of T3-FLSs.Vafaie et al. [23] established a control system by T3-FLSs and used to control a gyroscope with uncertain dynamics.Wang et al. [24] designed a fault detection system in Gas sensors and examined the better accuracy of T3-FLSs.Castillo et al. [25] developed a T3-FLS for image processing and suggested an approach to improve the image quality in televisions.Tian et al. [26] improved the dynamics of a case of financial systems using T3-FLSs.Xu et al. [27] designed an optimal controller based on T3-FLSs and analyzed the behavior of controlled system.Castillo et al. [28] studied a financial prediction problem and suggested a T3-FLS based scheme for better predication under chaotic and noisy data.Tarafdar et al. [29] developed an economic model using T3-FLSs and presented some statistical data to demonstrate the better outcome of T3-FLSs.Tian et al. [30] developed another T3-FLS based controller for chaotic systems and studied stability in the presence of estimation error of T3-FLSs.
In this paper, the chaotic modeling of financial systems is studied, then the basic approaches are analyzed, and finally a T3-FLSbased model is proposed and validated through synthetic and experimental data.The rest of this paper is organized as follows.In Section 2, the proposed T3-FLS model is presented.Section 3 investigates the concept of chaos and basic chaotic models, such as Henon and the logistic model.In Section 4, the attractor dimension tests are investigated.In Section 5 the simulations are given, and finally in Section 6 the conclusions are presented.

Type-3 FLS
The chaotic dynamics are modeled by the suggested T3-FLS, and the identified model can be used for various applications.T3-FLSs are intricate and complex structures that are used to handle uncertainties in information.These systems have a higher level of complexity than type-1 and type-2 fuzzy logic systems, with additional degrees of freedom to represent the level of assigned uncertainty in the input data [31,32].In a T3-FLS, each linguistic term has a fuzzy set associated with it, which contains a spectrum of membership grades representing the degree to which that term might apply to the input data.These membership grades are then subjected to further fuzzification through additional mapping functions, resulting in a highly nuanced and detailed model of the input information.T3-FLSs are best suited for situations where the information available is highly uncertain or incomplete, and where a higher level of granularity and detail is required in the output for better decision-making.The T3-FLS diagram is given in Fig. 1.The structure shows the four layers.First, the inputs are received, and the memberships are computed.In the next layer, the firing degree of rules is calculated and finally the output is obtained.The details of all steps are presented below.
2) For  1 (),  2 () and   (),  membership functions (MF) are considered.MFs show the changing range of inputs.For all MFs, the upper/lower memberships should be computed as: represent the lower memberships.
3) The -th rule is given as: where Ψ where  is constant, and  denote the error between target and of output of T3-FLS.

Chaos
The traditional view of economic phenomena tries to model data linearly with an approach that has random processes.The disturbances and irregularities observed in them are caused by the random effect of multiple inputs and external shocks.In the 1960s and 1970s, it became clear that many seemingly complex and random natural processes can be modeled with less complex nonlinear equations with limited degrees of freedom.Such certain systems that show apparently random and unpredictable behavior are the basis for the introduction of chaos theory and the development of chaotic time series modeling.In the investigation of chaos, the reason for data fluctuations such as oil price data is the internal mechanism of the system that generates it, and external and random shocks have not led to the creation of such seemingly disorderly behaviors.Most of the natural phenomena that have completely non-linear behavior can be well studied and analyzed in chaos research.Although most of these macroeconomic phenomena have countless influential factors from the point of view of economists, they are modeled with a certain chaotic system with a limited dimension.
Chaotic systems are also sensitive to the circumstances at the beginning.Because the prediction error at each stage can be considered an error in the conditions.Assuming the beginning of the forecast in the next moments, the accuracy of the multi-stage forecast is exceptionally high.It is affected by the error in the previous steps and drops quickly.The properties of chaotic systems are investigated with two essential concepts: absorber dimension and Lyapunov exponents.These two concepts, as immutable properties of systems, are also a tool for detecting chaos in time series.A primary goal to analyze the chaotic is that this type of behavior can explain seemingly random fluctuations in financial markets and macroeconomics.But as stated, what is important is the existence of a low-dimensional chaotic system because a random process has continuous (high) dimensions while a chaotic system has more dimensions.So, one can calculate the dimensions of a series to create a process it found.According to this method, if the amplitude of the series were high, then it indicates a stochastic process; otherwise, it is a chaotic.Therefore, if the system follows a chaotic process, short-term forecasting ability would exist.However, conventional linear forecasting methods will not be practical and practical because linear models cannot correctly cover sudden movements and unlimited fluctuations in stock prices or other financial items, and nonlinear models should be used [34].
is a nonlinear function.However, it should be noted that just nonlinearity is not enough to have a chaotic behavior.For example,  () =  3 is nonlinear, but it does not show a chaotic feature.
Chaotic is subset of nonlinear process that produces very complex and irregular results.To show chaos, we will examine two chaotic models in the following sections.

Table 1
The sensitivity of Eq. ( 1) according to different values of .

Chaotic logistics model
The chaotic logistics model is a dynamic model that illustrates the behavior of complex financial systems in logistics and supply chain management.In this approach, the interactions between various variables are nonlinear and lead to a chaotic behavior.One of the key characteristics of the logistics models is sensitivity to initial conditions.This means that a small change in the initial conditions can lead to drastically different outcomes.This sensitivity to initial conditions can make it difficult to predict the behavior of the system in the long term.Another important feature of this model is the presence of delays in dynamics.These delays and feedback loops can strengthen small disturbances and lead to unpredictable fluctuations in the system.Delays in the system can also introduce lags in the response of the system to changes, further complicating the behavior of the system.Also, this model can provide valuable insights into the dynamics of logistics and supply chain systems.By studying the chaotic behavior of these systems, researchers and practitioners can better understand the underlying mechanisms that drive their behavior and develop strategies to optimize their performance.
We examine the most common and most straightforward chaotic system, known as logistic mapping, and includes the receiver of a one-variable, first-order nonlinear differential equation.This mapping is defined as follows: where  is the logistic coefficient.In Eq. ( 1), coefficient  causes the effect of butterflies.For a better understanding of the issue, a one-dimensional logistic map of  () changes with the assumption of  = 3.95 and  (0) = 0.2 is shown in Fig. 2, where  (0) represents the starting point.The changes of  () appear to be totally random, and no specific pattern can be considered.But when we examine the relationship of variables in successive repetitions in a two-dimensional map, the process of data changes will have a definite pattern.Assume that another specific process of change is reached.Sensitivity to beginning circumstances is one of a chaotic system's fundamental properties.To clarify this issue, it is better to examine the sensitivity of the logistic map in one-dimensional space for different values of .In logistic mapping, by placing the initial point (0) = 0.2 and changes, , the nature of the time series can be seen differently.The sensitivity of logistic mapping behavior according to different values of  is shown in Table 1.For some values of  from the intervals stated in Table 1, the onedimensional logistic map is drawn in Fig. 2. As it is clear in the figure, a very small change in the value of  causes drastic changes in the results.Fig. 3(a) and 3(b) illustrate some diagrams of the two and three dimensions of the chaotic logistics model, respectively.
As can be observed, when 3.57 ≤  ≤ 4, the logistic mapping shows an apparently irregular behavior, named here as chaotic behavior.It is also possible to analyze the initial starting point of this sensitivity.The first batch is fifty examples of logistic map output without any changes.But in the second category, the output of sample 25 is increased by 1%.The changes obtained between the first and second category show the sensitivity to the initial conditions.

Henon's chaotic model
Another chaotic map is Henon's model.This model has two variables, and it is nonlinear and second order.The Henon's model proposes a discrete model for chaotic modeling of financial systems.This model includes two variables.Following, the behavior of Henon's model is described in some figures.The relationships of this model are as follows: ( + 1) = 1 −  2 () +  () ,  ( + 1) =  () , which is chaotic in the area,  = 1.4, = 0.3.Initial conditions of the system are as  0 = 0.18,  1 = 0.63.In figures, the relationship of variables in one-dimensional and two-dimensional space is displayed.The diagrams for one, two and three dimensions of Henon's chaotic model are depicted in Fig. 4(a), 4(b), and 4(c), respectively.

Chaos tests
Generally, two viewpoints have been put out to assess the condition of complicated time series.In the first point of view, it is looked into whether a specific or random process produced the required time series.The second viewpoint makes an effort to assess whether the time series shows chaotic or non-chaotic behavior.The first perspective's procedures are based on an examination of the system's correlation dimension.The examination of the greatest Lyapunov representation is one of the approaches used to support the second point of view, and it is briefly detailed below.

The concept of the Lyapunov view
Lyapunov expressions are defined as the logarithm of the absolute magnitude of the eigenvalues of the linearized dynamics of the system on the absorber and can be calculated for continuous and discrete systems.Positive Lyapunov profiles indicate divergence, whereas negative Lyapunov profiles indicate convergence (stability) (instability).The Lyapunov spectra set is employed to gauge the impact of starting circumstances on a chaotic dynamical system prior to the development of the chaos theory.Chaos theory merely asserts that positive and negative Lyapunov exponent values can coexist in a naturally chaotic system without contradictory definitions.Since the Lyapunov exponents are by definition independent of the initial circumstances and the absorption route has several stationary characteristics, they are an expression of the degree of dynamic complexity, and in a chaotic system, their maximum positive value serves as the upper bound of the prediction.
The primary characteristic of these series, i.e., the chaotic level of these series, assessed by Lyapunov coefficients, is given attention to determine the predictability of the time series of the financial markets.This rate describes how much altering the initial circumstances or model parameters changed the generated series from the original series.Suppose a time-varying model properly predicts how a natural system will behave.This time-varying deterministic model may be the result of ẏ () =  (  () ) Or, in the discrete case, the answer to the equation is  ( + 1) =  (  () ) , which  is considered derivable in this case.Still, the initial conditions Δ (0) are determined by an imprecise error.The amount of error resulting from the error of the initial conditions at time  () has behavior  as   Δ (0) in which Δ indicates the amount of the error of the initial conditions.To calculate the Lyapunov representation of the partial  vectors, the following vectors are used.
Then the largest Lyapunov representation is calculated: .
The positive value of   indicates the chaotic nature, and its negative value indicates the non-chaotic and predictable nature of the process in the long term.If   takes a positive value close to zero, the chaos is weaker and medium-term forecasting is possible.

Attractor dimension test
The Attractor dimension test is a mathematical tool used to analyze and understand how complex systems evolve and behave over time.It is based on chaos theory and is commonly used in physics, engineering, and other fields that deal with the study of dynamics.The attractor dimension test measures the degree of complexity in a system by analyzing the geometric pattern formed by the system's state variables as they change over time.This helps researchers to identify and study patterns in the behavior of complex The results for  ( + 1) = 1 −  2 () +  () ,  (0) = 0.1,  = 1.4, = 0.3.This test depends on one of the unique traits that distinguishes a random process from a chaotic process.The dimensions of a random process are continuous (infinite).A chaotic system, however, has much more constrained dimensions.It therefore has a set of one of the points, where the temporal route is constrained herein.Therefore, it is possible to understand the process that creates it by calculating the dimensions of a series.According to this method, if the range of the above series (usually greater than 10) indicates a process is stochastic, otherwise it would be chaotic.Dimension is defined as the lower limit of the number of independent variables necessary to describe the absorber model.The fractal dimension of absorber of chaotic processes is called a strange-attractor.The strange-attractor is a fractal geometric structure that is characterized by the asymptotic states of the chaotic system.Fractals are mathematical objects.Are the same on different scales.In the strange absorber, the trajectory covers the state of the nonlinear absorber as a density it meets every point at a distance of  from the previous path, and the paths never repeat.This property causes a complex behavior, apparently random but certain.The error in estimating each absorbing point can cause the prediction system to lead another path and make it impossible to predict in the following stages.The absorber dimension is calculated by correlation integral, as follows.

., 𝑦 𝑡+𝑀−1 ]
if the real -dimensional system and,  ≥ 2 + 1, then these -dimensional points can create the dynamics that the system under investigation created.The spatial correlation between these m-dimensional sets is obtained by calculating the correlation integral.

Simulations
Most of the tests related to the discovery of the chaotic process in a time series require a lot of data.The data used in this research are the data related to the currency market, which is available on a daily basis.The data used in this article are divided into two parts: synthetic and experimental data.Synthetic data are chaotic data generated with deterministic systems whose deterministic equations were explained in the previous sections.Among the most famous chaotic maps, we can refer to Logistics Map and Henon Map.The number of data used in each system to find Lyapunov expressions is 4537 observations.The experimental data of the exchange rate data of the American dollar (USD against the Iranian rial and also the British pound), (GBP, Euro), EUR, Canadian dollars (CAD and Australia), (AUD, Swiss franc), (CHF, one hundred Japanese yen), (JPY100 Swedish kronor), (SEK) Norway (NOK) and UAE dirham (AED) have been defined against the Iranian rial from 05/01/1992 to 02/03/2007.The output of the software simulations consists of two parts and is in the form of Excel, the first part represents the Lyapunov view, the first column of the Lyapunov view represents one dimension, and all the numbers obtained in that column are the Lyapunov view, which is the largest number obtained in each.The column represents the maximum Lyapunov view.The second part is the absorber dimension, the last number obtained in each column represents the dimension of the system (Henon Maps).The final results are given in the Tables 2-5.
The similarity reports the values of the largest view in each dimension in the experimental and synthetic studied series, which indicates the existence of a certain degree of certainty in the experimental data.Secondly, it can be seen that, except for the US dollar and the UAE dirham, in other parity rates, the increase in the hedging dimension (J) leads to the shrinking of the largest Lyapunov surface (Max), which means that the dynamics of the exchange rate of the dollar and the dirham are more sensitive than other currencies.As it can be seen in Table 5, the absorptive dimension for the two logistic and Henson maps (0.44 and 1.04) is close to zero, which shows that these models are non-random and the certainty of the model and their predictability are established.The absorption dimension obtained for the countries shows that the dynamics of the system are not very complicated and short-term forecasting can be investigated.To examine the ability of T3-FLS based model, the accuracy is examined on both above mentioned chaotic models.Fig. 5(a), 5(b), and 5(c) illustrate the results of series, 2D, and 3D for Henon's chaotic model, respectively.Also, the results of series, 2D, and 3D for the logistics chaotic model are depicted in Fig. 6(a), 6(b), and 6(c), respectively.As the results show, the suggested approach well models the complicated chaotic dynamics.

Conclusion
In this paper, a new T3-FLS based approach was proposed for analyzing financial chaotic systems.An important reason for examining chaotic behavior here was that this type of behavior could potentially explain the seemingly random fluctuations of financial markets and macroeconomics.The attracting dimension tests and the largest Lyapunov exponents were used to indicate the chaos and the complexity level.The suggested approach was used for modeling two basic chaotic models, namely, Logistics and Henon systems, and the results showed good modeling accuracy.In addition, the suggested approach was applied to discover the chaotic behavior in the time series of exchange rate parity in the financial markets.The suggested T3-FLS showed excellent accuracy in modeling.However, to improve the robustness and increase the interpretability, the rules of T3-FLS can be optimized.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Yan, A. Mohammadzadeh and E. Ghaderpour  denote rule numbers, and   and μ are: ŷ =   , where  and  are: where , = 1, ..., ,where   denotes the number of slices.The rules are updated as:

Table 3
as weather patterns and the behavior of financial markets.The Attractor dimension test is a valuable tool that helps researchers to model and predict the behavior of complex systems and has numerous applications in various fields.

Table 4
Calculation of maximum Lyapunov views in dimension one to five.

Table 5
Calculation of maximum Lyapunov views in dimension five to ten.