{'fraction_non_alphanumeric': 0.03352571719572229, 'fraction_numerical': 0.0070870819894754715, 'mean_word_length': 4.792772861356932, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Markov Chains application to the financial-economic time series prediction

In this research the technology of complex Markov chains is applied to predict financial time series. The main distinction of complex or high-order Markov Chains and simple first-order ones is the existing of aftereffect or memory. The technology proposes prediction with the hierarchy of time discretization intervals and splicing procedure for the prediction results at the different frequency levels to the single prediction output time series. The hierarchy of time discretizations gives a possibility to use fractal properties of the given time series to make prediction on the different frequencies of the series. The prediction results for world's stock market indices is presented.


INTRODUCTION
Successful modeling and prediction of processes peculiar to complex systems, such as ecological, social, and economical (ESE) ones, remain one of the most relevant problems as applied to the whole complex of natural, human and social sciences ( [1][2][3][4][5][6]).
The diversity of possible approaches to modeling such systems and, usually, more than modest success in the dynamics prediction, compel us to look for the reasons of failure, finding them not only in details, but also in the axiomatics, which relates to problem statement, chosen modeling methods, results interpretation, connections with other scientific directions.
With the appearance of quantum mechanics and relativity theory in early twentieth century new philosophical ideas on physical values, measuring procedures and system state have been established, the ones that are completely different from Newtonian notions [7,8].
For more than 70 years basic concepts of classical and neoclassical economic theories have been discussed by leading scientists, generating new approaches [9]. The general systems theory has acquired recognition in the middle of the 20th century giving way to development 3 of the new, systemic, emergent, and quantum in essence approach to investigation of complex objects, which postulates the limited nature of any kind of modeling and is based upon fixed and closed system of axioms [10].
However, the development of this new philosophical basis of ESE systems modeling is still accompanied with numerous difficulties, and new principles are often merely declared.
Current research is devoted to investigation and application of the new modeling and prediction technology, suggested in [11,12], based on concepts of determined chaos, complex Markov chains and hierarchic (in terms of time scale) organization of calculating procedures.

ANALYSIS OF PROMINENT PUBLICATIONS RELEVANT TO THE
SUBJECT Prediction of financial-economic time series is an extremely urgent task. Modern approaches to the problem can be characterized by the following directions: 1) approximation of a time series using an analytical function and extrapolation of the derived function towards future -so-called trend models [13]; 2) investigation of the possible influence various factors might have on the index, which is being predicted, as well as development of econometric or more complicated models using the Group Method of Data Handling (GMDH) [3,14]; 3) modeling future prices as the decisions-making results using neuronal networks, genetic algorithms, fuzzy sets [14][15][16].
Unfortunately, these techniques don't produce stable forecasts, what can be explained by complexity of the investigated systems, constant changes in their structure. Although we are trying to join these directions in one algorithm, it is the latter option that we prefer, with it consisting in creating a model adequate to the process generating a price time series [17]. This very approach gives a chance to approach the complexity of the system, which generates the observed series, develop the model and use its properties as the prognosis.

AIMS OF THE PAPER, PROBLEM STATEMENT
Assume the time series is set by a sequence of discrete levels with constant step of time sampling ∆t. We need to generate variants of the time series continuation (prognosis scenarios) according to the relations between the sequences of absolute and relative changes 4 discovered with the help of complex Markov chains.

CLASSICAL MODELING PROBLEMS OF ESE SYSTEMS DYNAMICS
Another peculiar feature of ESE systems, apart from complexity, is a memory, including the long-term one, as well as nonlinear and unstable nature of interactions and components, which makes it harder to predict their future behavior.
Unfortunately, mathematical models based on differential equations have no memory (there is no aftereffect), while for models with memory, where integral interrelations are used, it is not always possible to take into account nonlinearity (the integration procedure is linear by definition).
In reality, in the Cauchy problem future systems behavior is defined by its initial state and doesn't depend on the way the system reached its current state. However, it is hardly true that future behavior of a real socio-economic or socio-ecological system can be predicted by giving an immediate time "slice" of a variables set that describe its state.
Let us consider possible ways to take into account past events while modeling ESE systems' dynamics, which goes beyond the boundaries of classical differential and integral equations.
Functional differential lagging equation can serve as a simple example of the dynamic model with memory, where present time is defined by the state variable x(t) and depends on the past state x(t − τ ) with constant time lag τ = const: where f (x) is the known function, with initial conditions being set for the half-interval t 0 − τ ≤ t < t 0 by the function φ(t): Given the 2 equation 1 has the only solution, defined by recurrent ratios: f ((f (φ(t − τ )))) ; if t 0 + 2τ ≤ t < t + 3τ ; Using Dirac delta function, as defined by ratios: we can formally rewrite equation 1 in the integral form: Delta function is not a function in the conventional interpretation and is related to the class of generalized functions that were mathematically described only in the middle of the last century [18] (physics started using this function much earlier). Its classical form is considered to be a limit of the "peak" sequence, with its centre set in the point of origin. The afore-mentioned "peaks" indefinitely converge widthway, indefinitely increase throughout the height and have a unit area.
6 Therefore if the system's state in the time moment t depends on the infinite sequence of its past states, the integral analogue of the functional differential lagging equation will, generally speaking, contain an integral of the infinite multiplicity. At the same time the infinite amount of past states can relate to both finite (t − τ 1 ; t) (short-term memory) and infinite (−∞; t) (long-term memory) time span.
Pay attention that the classic integral lagging equation is one of the Volterra type [19]: where F x(t); t;t -is an arbitrary (generally nonlinear) function of variables x(t); t;t, which allows to take into account system's memory of its past states only in the additive approximation, which becomes evident, if the right section 10 is rewritten in the following way: In connection with it note that the equation 9 in case of an additive dependency of contemporaneity on the past, i.e. in case: becomes a particular case of the equation 10 with the following integrand: Meaningful analysis of nonlinear models dynamics with memory, in which the future is defined by the infinite amount of states in the past is generally possible only in case of a discrete representation. The results of such analysis will be approximated, i.e. will contain uncertainty, which has to be considered endogenous, i.e. internal, and peculiar to this very system.
With a certain level of time sampling, models with memory both 7 and 10 becomes: To take into account and quantify the uncertainties, observed in ESE as well as other complex systems probability models are normally used. However their application is based on doubtful hypotheses, while the statistical interpretation of the results is not always informative enough and results might not correspond with the real process occurring within the system. In particular, the well-known problem of 1/f -noise (look for example [20]), closely connected to the presence of long-term memory in complex systems, implies the absence of the mean temporary value (as a limit of a certain time span converging to infinity, which serves as the basis for averaging) for any process occurring in such kind of system. Therefore such processes can't have a rigorous statistical substantiation.

MODERN CONCEPTS IN ESE SYSTEMS MODELING
New approaches to modeling and prediction of complex nonlinear systems dynamics with memory are based on the use of determined chaos and neural networks technologies (cf. e.g. [15,21,22]). Both investigation and realization of such techniques has become possible only with the appearance of quick-operating computers. Use of the recurrent computational process has become the general feature for all these technologies: where f i (x i ) is a certain nonlinear mapping of a multi-dimensional vector x i , i -discrete, real or fictitious, time. Identification of the model 15 is reduced to the determination of functions f i (x i ), while the differences between the models of determined chaos and neural networks are connected with the function type and methods of its definition (neural network models normally use rather narrow class of f i (x i ) mappings [16]). Generally speaking, stability or convergence of the process 15 is not required, whereas a single-step set of vector x i components as well as their time dynamics can be of great interest.
For the particular case of the model 15, introducing corresponding lagged variables, a model 14 can be transformed.
Both determined stable processes, described by integro-differential equations, and random processes, which also include complex Markov chains (CMC), can be formally considered as separate extreme cases of determined chaos models realization 15. Given the sampling scale, which tends to zero, if such a tendency makes sense and corresponding limits exist, we 8 derive classical differential and integral problem statement. Finite ∆t allows to get models with discrete time, which in the general case in the corresponding phase space (which also includes lagged variables) can produce both measurable sets (discrete or continuous) that allow probabilistic interpretation and those of the special structure -fractals [23], that can't be always interpreted in that way.
Various digital generators of so-called random sequences used in imitational modeling can be an example of determined chaos models that allow probabilistic interpretation.
Let us note that in reality there are no accurate procedures that would give an opportunity to distinguish a "real" random sequence from the pseudorandom one.

MARKOV CHAINS PREDICTION TECHNOLOGY
Suppose there is a sequence of a certain system discrete states. From this sequence we can determine transitions probabilities between the two states. Simple Markov chain is a random process, in which the next state probability depends solely on the previous state and is independent from the rest of them. Complex Markov chain, unlike the simple one, stands for the random process, in which the next state probability depends not only on the current, but also on the sequence of several previous states (history). The amount of states in history is the order of the Markov chain.
Theory of simple Markov chains is widely presented in literature, for example [24]. As for the high order Markov chains, modern literature [25] can offer us a mere definition.
Developing complex or high order Markov chain's properties is not widely presented in modern scientific publications. It's necessary to mention the papers [26,27] where properties of complex Markov Chains are developed, but no prediction algorithm is proposed there.
The development of prediction method, based on complex Markov chains, is proposed in this paper.
Markov chain of the higher order can be brought to a simple Markov chain by introducing the notion of a "generalized state" and including a series of consequent system's states into it. In this case, tools of simple Markov chains can be applied to the complex ones.
Investigated dynamic series is a result of a certain process. It is assumed that this process is determined, which implies the existence of a causal dependence of further states on history.
It is impossible to fix and analyze the infinite history, which puts obstacles in the way of an 9 accurate detection of this influence and making precise predictions.
The problem consists in the maximal use of information, which is contained in the known segment of the time series, and subsequent modeling of the most probable future dynamics scenario.
The observed process is described as a time series of prices p t with the given sampling time span ∆t Discrete presentation of the time series is in fact a way of existence of this very system.
New prices are formed on the basis of contracts or deals, made on the market in certain discrete moments of time, while the price time series is a series of the averaged price levels during the chosen time intervals. While making a decision each trader, who is an active part of the pricing system, works solely with discrete series of the chosen time interval (e.g. minute, 5-minute, hourly, daily etc.). For ∆t → 0 the accuracy of data presentations reaches a certain limit, since for relatively small ∆t the price leaps in the moment of deal, while staying unchanged and equal to the last deal during the time between the two deals. Hence, the discreteness of time series has to be understood not only as a limited presentation of activity of the complex financial system, but also as one of the principles of its operation [11,12,[28][29][30].
The time series of initial conditions has to be turned into a sequence of discrete states.

PREDICTION CONSTRUCTION ALGORITHM
Let us consider the consequence of operations, required for the prognostic time series construction. To do this we need to set the following parameters: 1) The type of time increments hierarchy (simple -powers of two, complex -product of powers of the first simple numbers).
2) Values of s -the amount of states and r -the order of the Markov chain. These parameters can be individual for every sampling level; finding of optimal parameters is done experimentally.
3) Threshold values δ, and minimal number of transitions N min .
Prediction construction algorithm includes the following steps: 1) Generating hierarchy of time increments -t sequence. The maximal of them has to correspond to the length of a prognostic interval N max .
2) For every time increment ∆t, as the increments increase, a prediction of states and restoration of the time series along the prognostic states is conducted. Current stage includes 3) To splice the last spliced time series with the continuation of the linear trend, created along all previously known points.
The time series, spliced with the linear trend, is the result of prediction. Let us consider the stages of the given algorithm in detail.

DEFINING THEM
In everything that concerns current technology, states are connected to the measuring of a prognostic value. There is a number of ways to classify returns in states, from which the following are suggested. One of them is the classification based on the homogeneity principle as concerning the amount of representatives in classes; based on the homogeneity principle of deviation, as well their combinations for different deviation modules.
Increment or returns of the time series serves as the basis for states classification [32,33].
Absolute r a and relative r t increments of the time series are considered: where p t -is the input time series of price dynamics, ∆t -sampling interval, which is chosen for subsequent analysis. It is known that mathematical expectation of the returns time series equals zero, whereas variation comes as the measure of time series volatility. correction of the division a necessary action. In that way we will reach the largest possible homogeneity in state division. Classification is conducted along the following algorithm [34,35]: where s t is the number of state, which corresponds to the moment of time t, for which the Since the real causal dependence is unknown during the process, to find it adequate state classification, which would allow to reveal vital dependencies of the time series, is required. We suggest a couple of ways to divide the time series into states, which in the first place allow to preserve adequate transition probabilities between states, as well as prevent averaged deviations inside the states from affecting the accuracy of the derived prediction.
To check the efficiency of division we conduct the sampling procedure and classify the increments according to each hierarchy. Having completed that, we restore the time series using known states for each hierarchy and finish the splicing procedure. Since the state series correspond to the initial time series, we get the curve, with deviation, caused exclusively by the state averaging mistake (quantum mistake). Thus, having set a certain value of state numbers s and carried out sampling, restoring, and sampling procedures (excluding prediction), we get absolute sampling (quantum) mistake.

13
Increasing the number of states, we improve the accuracy of restoration, however one should remember, that the choice of the quantum levels is limited by the fact that the transition probabilities definition with sufficient accuracy is required, which is confirmed by artificial test time series prediction experiments. In this case, you have to take into account that probabilities are calculated with a certain mistake. We cannot precisely compute the probabilities, since it is impossible to derive an infinite time series, and only a part of the time series is known -the known part serves as the basis for probabilities. The second important aspect implies the case of several states with maximal probability.
To prevent the omission of the states, for which the probabilities are computed with a mistake, one should add a state with maximal probability to the states, which are located in the distance of δ from the maximal one. The value of parameter δ depends on the probability evaluation mistake and requires experimental refinement.
If δ > 0, the number of states with maximal probability increases in comparison to the value δ = 0. Let us call a couple of neighbouring states with maximal probability a cluster.
Cluster states with average deviation values are supposed to have the largest probability.
To predict the dynamics, let us confine ourselves to one or two most probable states. To define them a following algorithm is suggested: 1) If levels (discretized increments) create several clusters (cluster is a group of several neighbouring levels -cluster elements, minimal cluster is a single isolated level) with maximal probability, we choose the largest cluster.
2) If the number of cluster elements is odd, as k max we choose a central element.
3) If the number of cluster elements is even, we consider two central cluster elements and choose as k max the one, which is closer to the centre of distribution. can also form clusters that will undergo the same steps 1)-4).
This principle is based on the following ideas: 1) If there are two neighbouring states of maximal probability, it is better to take the one, which is closer to the centre of distribution, in order to minimize the risk of occurrence of false linear trends in the prediction.
2) If levels of maximal probability are not the neighbouring ones, at least two variants have to be considered, as it can be connected to the bifurcations that should not be omitted.
3) If the prediction is carried out according to 1) (on all stages of the hierarchy), we receive a certain approximation of the lower limit of the prediction, whereas in case of 2)we get an approximation of the upper limit.
Hence this algorithm can adequately restore the case of possible bimodal probability distribution, it is proposed to consider 2 prediction scenarios.
In case of the complex Markov chains, probability of the next state depends not only on the previous state, but also on the sequence of r states, which have occurred before given.
In this case, it is necessary to calculate transition probabilities from the sequence of r states into the r + 1 state. Formally, these probabilities can be written into the rectangular table of (r s , s) size.
Having generalized the notion of "present state" and included a sequence of r preceding states into it, we can reduce Markov chains of r order to the chain of the first order. Thus transition probabilities can be written into rectangular matrices of (r s , r s ), that come as transition probability matrices for generalized states.
The process of prediction implies the following: the last state is chosen (in case of Markov chains of an order r > 1 a sequence of r latest states is taken). The probability of transition from current state to all possible states is defined. From all possible states a state with maximal probability is chosen. It is possible that several states with maximal probability occur, which can be explained by the bimodal probability distribution. The process of decision-making in this case is described later.
The chosen most probable state is taken as the next prognostic state and the procedure is repeated for the next (last added) state. Thus we receive a time series of prognostic states for the given sampling time ∆t.
Further according to the received state sequence and known initial value the time series is 15 being restored for the given time sampling ∆t. In this case every state implies ∆t points of the time series. On the stage of state classification every state was connected to the average increment r avg,i , which is added to the value of the last point in the time series, and the next discrete point is computed. Intermediate points are filled as linear interpolation of two known neighbouring points. Algorithm of y t time series values restoration according to the initial price p t and a series of average increments r avg,ik , corresponding to the prognostic states s k , can be given by a sequence of calculations: y t+1 = y t + r avg,i1 /∆t = p t + r avg,i1 /∆t, y t+2 = y t+1 + r avg,i1 /∆t = p t + 2r avg,i1 /∆t, . . . y t+∆t−1 = y t+∆t−2 + r avg,i1 /∆t = p t + (∆t − 1)r avg,i /t, y t+∆t = y t+∆t−1 + r avg,i1 /∆t = p t + ∆tr avg,i /∆t = p t + r avg,i1 , y t+∆t+1 = y t+∆t + r avg,i2 /∆t = p t + r avg,i1 + r avg,i2 /∆t, . . . y t+n∆t−1 = y t+n∆t−2 + r avg,in /∆t = p t + n−1 k=1 r avg,ik + (∆t−1) ∆t r avg,ik , y t+n∆t = y t+n∆t−1 + r avg,in /∆t = p t + n k=1 r avg,ik . Thus an increment hierarchy is chosen, where each one is responsible for its own sampling rate, which serves as a basis for predicting, restoring and splicing.

RESULTS OF STOCK INDICES PREDICTION
In this section we offer the results of stock indices prediction. The stock's indices databases are available from [36].

19
The normalization procedure is proposed in order to compare indices and it's prediction series with different absolute values. The normalized values calculated with the following formula: y n (t) = y(t) − min (y(t)) max (y(t)) − min (y(t)) .