# Application of Hidden Markov Model in Financial Time Series Data

Authors: Qingqing Chang; Jincheng Hu
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Financial time series have typical characteristics such as outliers, trends, and mean reversion. The existence of outliers will affect the effectiveness of the unknown parameter estimation in the financial time series forecasting model, so that the forecasting error of the model will be larger. Quantitative forecasting methods are divided into causal forecasting method and time series forecasting method. The causal forecasting method uses the causal relationship between the predictor variable and other variables to predict, and the time series forecasting method infers the future value of the predictor variable based on the structure of the historical data of the predictor. Therefore, this paper proposes a hidden Markov model prediction method based on the observation vector sequence, which can simultaneously consider the influence of the variable sequence structure and related factors.


---

## Body

## 1. Introduction

The financial market can be said to be the core of a country’s economic operation. Governments and investment institutions in various countries strive to study the law of changes in the financial market, effectively manage it, and increase the rate of return on financial investment. Financial time series is the most important type of data in the economic and financial fields. Analysis, prediction, and control of this type of data are important tasks for financial workers and researchers. Financial time series include bonds, exchange rates, interest rates, stock prices, and financial futures prices. From a macroperspective, they can also include macroeconomic data such as investment, income, and consumption. The securities market plays an important role in the financial market and is the main body of the financial market. Especially in the context of increasing global financial integration, the degree of integration between our country’s economy and the world economy is getting higher and higher, and the financial industry is facing greater and newer development opportunities and challenges. Understanding and grasping the essential laws of the financial market is directly related to the stability, efficiency, and safety of our country’s financial market. After decades of rapid development, our country’s financial industry has formed a considerable scale. The financial market is a complex system that will be affected by various factors. The law of its motion is difficult to predict, while the financial time series data are positive. It is the external manifestation of this characteristic. “Phenomena reflect the essence, and the essence determines the phenomenon.” Therefore, there must be a lot of information about economic laws hidden in the financial time series. Finding all kinds of valuable information from financial time series and better understanding its application is undoubtedly of great significance to investment forecasting, decision making, and risk management [1–9].In the 1960s, mankind entered a new era in the development of time series analysis theories and methods. Someone proposed the maximum entropy spectrum (MSE) estimation theory since the power spectrum estimation and the maximum entropy spectrum estimation effect of the autoregressive model is the same and it is later called modern spectrum estimation. Due to its inherent advantages, it has expanded the application field of time series analysis methods and thus has been more widely used. It has also made a great contribution to the research in the engineering field and has become a more practical tool [10–15].From 1970 to 1979, information signal technology developed rapidly. In terms of theory, time series analysis methods have become more and more perfect. Improvements in theory have made it perform in some aspects such as parameter estimation algorithms, order determination methods, and modeling. Especially, we see that time series analysis methods are becoming more and more practical, and then some practical time series analysis software has appeared. Gradually, time series analysis methods and software have become impossible to predict and analyze those seemingly unrelated data [16–23].From market forecasts to output forecasts and from population forecasts to earthquake forecasts, the theoretical development of time series analysis is becoming more and more mature and perfect. Nowadays, there are many research studies in the fields of precision instrument measurement and control, safety and quality inspection, maintenance, and measurement and control. Innovative discoveries provide convenient conditions for testing and management in the engineering and safety fields, so as to better ensure the precision of instruments and the accuracy of construction projects and ensure that high standards and high requirements for production safety and production quality are met [24–29].Forecasting methods are divided into qualitative forecasting methods and quantitative forecasting methods, among which quantitative forecasting methods are divided into causal forecasting methods and time series forecasting methods. The causal prediction method uses the causal relationship between the predictor variable and other variables to make predictions. The correct determination of the causal relationship is the key to this type of method. The specific methods are univariate linear regression, multiple linear regression, and nonlinear regression prediction methods; the principle is to infer the future value of the predictive variable’s historical data structure. Correctly identifying the historical data structure is the key to this type of method. Specifically, there are time series decomposition analysis method, moving average method, exponential smoothing method, ARIMA model method, gray forecasting method, Kalman filtering method, neural network prediction method, etc. Any time series as the target of prediction has many characteristics, such as the structure of the sequence itself, the causal relationship between it and other time series, and so on. The sum of these characteristics determines the future development of the time series. Only by reflecting these characteristics to a certain extent can a better forecasting effect be produced. However, no matter what kind of realistic prediction method, it can only describe a certain aspect of the prediction object but cannot describe all its characteristics. For example, time series can only describe the structure of the variable’s own sequence but cannot describe other characteristics; the causal prediction method can describe the causal relationship between a variable and other variables, but it lacks the function of describing the structure of the variable’s own time series. Bates and Granger first proposed the combined forecasting method in 1969. Its essence is to obtain new forecasting results from the forecasting results of several different forecasting methods according to a certain mapping. The combined forecasting method can simultaneously consider the structure of the sequence itself and its influencing factors, thereby effectively improving the prediction accuracy. The literature has conducted research on combined prediction, but it is not easy to determine the mapping relationship.The hidden Markov model is a kind of Markov chain, and its state cannot be directly observed but can be observed through observation vector sequence; each observation vector is expressed as various states through some probability density distribution, and each observation vector is generated from a sequence of states with a corresponding probability density distribution. The hidden Markov model (HMM) originated a long time ago and was successfully applied to acoustic signal modeling in the 1980s, as shown in Figure1. At present, HMM is mainly used in engineering fields, such as image processing, artificial speech synthesis, seismic exploration, biological signal processing, and so on, and has achieved important results with scientific significance and application value. In recent years, there are also documents that apply HMM to the volatility analysis of financial markets.Figure 1
Hidden Markov model.Therefore, the hidden Markov model is a double random process—a hidden Markov chain with a certain number of states and a set of explicit random functions. Firstly, introduce the basic theory of the hidden Markov model; secondly, on the basis of model training and hidden state sequence estimation, propose a hidden Markov model prediction algorithm based on observation vector sequence; finally, conduct simulation experiments and empirical research to prove the effectiveness of the method. The research results show that the hidden Markov model proposed in this paper adopts the mechanism conversion hybrid forecasting model and applies it to the forecast of financial time series, which effectively reduces the forecast error.


## 2. Basic Theory of Hidden Markov Model

The hidden Markov model is a double-embedded random process, that is, the hidden Markov model is composed of two random processes, one is an implicit state transition sequence, which corresponds to a simple Markov process (shown in Figure2); the other is related to the implicit state transition sequence.Of these two random processes, one of the random processes (hidden state transition sequence) is unobservable and can only be inferred from the output observation sequence of the other random process, so it is called a hidden Markov model. Its basic elements include the following:(1)
A collection of hidden state numbers. The discrete set S is often used to represent different hidden states:(1)S=S1,…,SN,whereN is the number of states. Use q t = Si to indicate that the HMM is in the hidden state Si at time t, and the hidden state sequence is(2)Q=q1,…,qt.(2)
The probability distribution A of state transition. The probability distribution of state transition can be expressed as(3)A=Pqt+1=Sj|qt=Si,1≤i,j≤N.(3)
Probability distribution B of the observed variable output under the condition of state Si. Assuming that the sample space of the observed variable isV, the probability distribution of the output observed variable in the state Si can be expressed as(4)B=fQt=v|qt=Si,1≤i≤N,v∈V,whereQ t is the observed random variable at time t, which can be a value or a vector, and the observation sequence is denoted as O. It is worth noting that the sample space and probability distribution of the observed variables here can be discrete or continuous.(4)
The probability distribution of the initial state of the systemπ. The probability distribution of the initial state of the system can be expressed as(5)π=Pq=Si,1≤i≤N.Figure 2
Flowchart of hidden Markov model.In summary, to describe a complete HMM, the model parameters are required to be {S, A, B,π}. For simplification, it is often expressed in the following form, namely, λ = {A, B, π}. So, figuratively speaking, HMM can be divided into two parts: one is a Markov chain, described by {π, A}, and the output is a hidden state sequence; the other random process is described by B, and the output is a sequence of observations. In addition, for a standard HMM model, three basic problems need to be solved: model training, hidden state estimation, and likelihood calculation.(1)
Model Training. The problem of model parameter estimation is how to adjust the parameters of the model λ = {A, B, π} for the initial model and the given observation sequence O for training, so that it can best fit the observation data, namely:(6)λML=argmaxλfO|λ.This can be done by the EM algorithm or the Baum–Welch algorithm.(2)
Likelihood Calculation. Given the model parameter λ, calculate the likelihood of the observation sequence O, that is, calculate the likelihood f (O︱λ) or log likelihood lnf (O|λ), which represents the accuracy of the parameter λ to fit the data O. This can be obtained by traversing the HMM once through the forward-backward algorithm.(3)
Hidden State Estimation. Given model parameters λ = {A, B, π} and observation data O, estimate the most probable hidden state sequence Q based on a certain optimal criterion, that is, estimate the most likely path through which the observation sequence is generated. This can be done by the Viterbi algorithm. Make an estimate.The hidden Markov model has the following three main application problems, as shown in Figure3.Figure 3
Three main application problems.


### 2.1. Assessing the Problem

This type of application is based on the known hidden Markov model to find the probability of a sequence of observations.To use forward algorithm (forward algorithm) to solve this problem, this type of problem is based on the assumption that a series of hidden Markov models are known to describe different systems, the law of weather changes in summer, and the law of weather changes in winter. We want to know which system is most likely to generate a sequence of observations. It can also be understood as applying weather systems in different seasons to a given sequence of observations, and the season corresponding to the system with the highest probability is the most likely season. This is a similar application in speech recognition systems. Define the forward variable as probability:(7)αti=PO1,O2,…,Ot,Xt|λ.Then,(8)PO|λ=∑i=1NαTi.It can be seen from this definition that the forward algorithm can be used to calculate the probability of a sequence of observations when the parameters of the hidden Markov model are known. In this way, in practical applications, the maximum value of P obtained by substituting the parameters of different hidden Markov models is the hidden Markov model parameter that is most consistent with the observed value sequence. The comparison of the prediction is shown in Figure4.Figure 4
Comparison of the prediction.


### 2.2. Decoding Problem

This kind of application problem is to find the most likely hidden state sequence based on the sequence of observations. In many cases, people are more interested in model hidden states since they represent some more valuable things that are usually not directly observed. For example, there is a famous example of the relationship between the state of seaweed and the weather on the Internet: a blind person can only feel the state of seaweed, but he wants to know the weather. The actual state of the weather at this time is a hidden state. Therefore, the blind person needs to judge the state of the weather by observing whether the seaweed is dry or wet.When the observation sequence and the hidden Markov model are known, the Viterbi algorithm can be used to determine or identify the most likely hidden state sequence of the sequence. A good application of the Viterbi algorithm is part-of-speech tagging in natural language processing. In the part-of-speech tagging problem, the words in the sentence are in the observed state, and the part-of-speech (grammatical category) is the hidden state (for many words, such as wind, fish has more than one part of speech). For the words in each sentence, by searching for the most likely hidden state, the most likely part-of-speech tag of each word can be found in a given context.


### 2.3. Learning Problems

This type of problem refers to determining the parameters of the hidden Markov model from the sequence of observations. It is a method of training a hidden Markov model using known data. This is the most commonly used tool because in practical problems, it is usually impossible to know the parameters of a ready-made hidden Markov model. These parameters include the initial matrix, the state transition matrix A, and the output matrix B. It can only be determined by studying the sequence of observations of the hidden Markov model. The evaluated data are shown in Figure5.Figure 5
Evaluated data.This is the most difficult application problem of the hidden Markov model. A triple (Π, A, B) should be generated according to the observation sequence and the hidden state it represents, so that this triple can best describe the phenomenon we see. You can use the forward-backward algorithm to solve this problem.The backward variable can be defined as(9)βti=POt+1,Ot+2,…,OT,|Xt,λλ=Π,A,B.Let the backward variables of all states att = T be 1. Thus, the backward variable of each time point t = T − 1, T − 2, …, 1 can be calculated:(10)βti=∑i=2TaijbjOt+1βt+1jt=T−1,T−2,…1,1≤i≤N.What is calculated in this way is the backward variable corresponding to the hidden state at each moment. Given the observation sequence O and the hidden Markov model parameterλ, define the probability variable at the hidden state qi at time t as(11)γti=αtiβti∑i=1nαtiβti.Given the observation sequence O and the hidden Markov model, define the probability variable of being in the hidden state qi at timet and in the hidden state qj at time t + 1 as(12)ξti,j=αtiaijbjOt+1βt+1j∑i=1n∑j=1nαtiaijbjOt+1βt+1j.Therefore, if the above three formulas are calculated iteratively, the parameters of the hidden Markov model can be continuously re-estimated. Then, after multiple iterations, a maximum likelihood estimate of the hidden Markov model can be obtained. However, it should be noted that the result obtained by the forward-backward algorithm is a local optimal solution. The FFT analysis is shown in Figure6.Figure 6
FFT analysis.


## 2.1. Assessing the Problem

This type of application is based on the known hidden Markov model to find the probability of a sequence of observations.To use forward algorithm (forward algorithm) to solve this problem, this type of problem is based on the assumption that a series of hidden Markov models are known to describe different systems, the law of weather changes in summer, and the law of weather changes in winter. We want to know which system is most likely to generate a sequence of observations. It can also be understood as applying weather systems in different seasons to a given sequence of observations, and the season corresponding to the system with the highest probability is the most likely season. This is a similar application in speech recognition systems. Define the forward variable as probability:(7)αti=PO1,O2,…,Ot,Xt|λ.Then,(8)PO|λ=∑i=1NαTi.It can be seen from this definition that the forward algorithm can be used to calculate the probability of a sequence of observations when the parameters of the hidden Markov model are known. In this way, in practical applications, the maximum value of P obtained by substituting the parameters of different hidden Markov models is the hidden Markov model parameter that is most consistent with the observed value sequence. The comparison of the prediction is shown in Figure4.Figure 4
Comparison of the prediction.


## 2.2. Decoding Problem

This kind of application problem is to find the most likely hidden state sequence based on the sequence of observations. In many cases, people are more interested in model hidden states since they represent some more valuable things that are usually not directly observed. For example, there is a famous example of the relationship between the state of seaweed and the weather on the Internet: a blind person can only feel the state of seaweed, but he wants to know the weather. The actual state of the weather at this time is a hidden state. Therefore, the blind person needs to judge the state of the weather by observing whether the seaweed is dry or wet.When the observation sequence and the hidden Markov model are known, the Viterbi algorithm can be used to determine or identify the most likely hidden state sequence of the sequence. A good application of the Viterbi algorithm is part-of-speech tagging in natural language processing. In the part-of-speech tagging problem, the words in the sentence are in the observed state, and the part-of-speech (grammatical category) is the hidden state (for many words, such as wind, fish has more than one part of speech). For the words in each sentence, by searching for the most likely hidden state, the most likely part-of-speech tag of each word can be found in a given context.


## 2.3. Learning Problems

This type of problem refers to determining the parameters of the hidden Markov model from the sequence of observations. It is a method of training a hidden Markov model using known data. This is the most commonly used tool because in practical problems, it is usually impossible to know the parameters of a ready-made hidden Markov model. These parameters include the initial matrix, the state transition matrix A, and the output matrix B. It can only be determined by studying the sequence of observations of the hidden Markov model. The evaluated data are shown in Figure5.Figure 5
Evaluated data.This is the most difficult application problem of the hidden Markov model. A triple (Π, A, B) should be generated according to the observation sequence and the hidden state it represents, so that this triple can best describe the phenomenon we see. You can use the forward-backward algorithm to solve this problem.The backward variable can be defined as(9)βti=POt+1,Ot+2,…,OT,|Xt,λλ=Π,A,B.Let the backward variables of all states att = T be 1. Thus, the backward variable of each time point t = T − 1, T − 2, …, 1 can be calculated:(10)βti=∑i=2TaijbjOt+1βt+1jt=T−1,T−2,…1,1≤i≤N.What is calculated in this way is the backward variable corresponding to the hidden state at each moment. Given the observation sequence O and the hidden Markov model parameterλ, define the probability variable at the hidden state qi at time t as(11)γti=αtiβti∑i=1nαtiβti.Given the observation sequence O and the hidden Markov model, define the probability variable of being in the hidden state qi at timet and in the hidden state qj at time t + 1 as(12)ξti,j=αtiaijbjOt+1βt+1j∑i=1n∑j=1nαtiaijbjOt+1βt+1j.Therefore, if the above three formulas are calculated iteratively, the parameters of the hidden Markov model can be continuously re-estimated. Then, after multiple iterations, a maximum likelihood estimate of the hidden Markov model can be obtained. However, it should be noted that the result obtained by the forward-backward algorithm is a local optimal solution. The FFT analysis is shown in Figure6.Figure 6
FFT analysis.


## 3. Time Series

Because the causal prediction method only uses the causal relationship between a variable and other variables, it lacks the function of describing the structure of the variable’s own time series, while the time series prediction method can only describe the structure of the variable’s own sequence but does not consider other related factors. A sequence composed of some random variables xN is called a random sequence, which can be represented by a set {xN}. A random vectorX can also be defined in a multidimensional random space, where each component is represented by xi. Then, the so-called time series are sorted in the order of time, that is to say, the subscript in xi is the variable of time t, where t is an integer, which represents the increment of the time interval, which is called a random sequence. It is also a time series. It is usually represented by {xt }. In the time variable of the time series, t can be a positive integer or a negative integer because they are all based on the current moment. A negative value means that it is generated before the current moment; a positive value means that it is generated after the current moment.The content of this section is to discuss the time series model, and we use mathematical methods to express the structure of the time series model. Thus, by studying the characteristics of autocorrelation and partial autocorrelation of time series, it lays a foundation for the subsequent establishment of mathematical models, so as to better study the changing laws of volatility and ultimately enable people to predict or avoid risks in the process of financial transactions.Usually, due to the inertia of the economic system, the time series related to the economy often have a contextual dependence. The simplest case is that the current value of the variable is mainly related to the value of the previous period. The mathematical model to describe this relationship is the first-order autoregressive model. The prediction is shown in Figure7.Figure 7
Prediction.The stock market index is a complex financial time series. Behind the rise and fall of stock prices, there are many economic and noneconomic factors that hide the influence. These influences are like an invisible hand that controls the stock market. How to analyze the various influencing factors reflected behind the index and the economic status through the rise and fall of the stock market index and how to use the changes in the economic status behind the stock index to predict the stock market index are all issues worthy of study. This article will use hidden Markov model to analyze and study these two situations. By studying the stock market index to discover a certain hidden state behind the stock market, on the one hand, and by mastering and estimating the changing law of this hidden state, on the other hand, the forecasting model is improved, thereby improving the prediction effect of the model.In this section, we will give improvements to the nonparametric kernel regression model and the least squares support vector machine model based on the hidden Markov model, that is, the mechanism conversion hybrid prediction model, and the hidden state sequence is different, and the number of samples is different. The prediction method of the mechanism conversion hybrid prediction model is expressed in three forms: LSSVM-LSSVM model, KERNEL-KERNEL model, and KERNEL-LSSVM model.The algorithm that realizes the decoding function of the hidden Markov model is called the Viterbi algorithm. In the analysis of financial time series in this section, it is assumed that it has only two hidden states. In fact, these two hidden states can be understood as the normal state of the stock market and the state when abnormal conditions occur, just like the “barometer” of the stock market. Therefore, after this article, these two states will be referred to as normal state and abnormal state. In order to meet the research needs of this article, some improvements have been made to the previously defined Viterbi algorithm and the two-category Viterbi algorithm. Value vs. time is shown in Figure8. As can be seen, the predicted value agrees well with the above analyses, which also means that the validation of this paper is reasonable.Figure 8
Value vs. time.Here, the alpha quantile can be achieved with the help of the QUANTILE function in the MATLAB software. This paper takes 0.8, so that the number of normal state points in the sequence is 4 times that of abnormal state points. This is more reasonable because it is clear that there should be more cases. In fact, differentα can be selected in different problems.In addition, if you want to implement these steps in practical applications, it is obvious that you first need to use the Baum–Welch algorithm, which is the forward-backward algorithm defined in this article, to train the hidden Markov model. It is necessary to obtain the Viterbi algorithm. The parameters are the initial probability, state transition probability, and output probability. In this way, the hidden state of the sequence can be obtained by using the above Viterbi algorithm.The previous section of this article introduced the theory of hidden Markov models. There is a kind of decoding problem in the application of hidden Markov model. This type of application is to find the most likely hidden state sequence based on the sequence of observations. For the research object of this article: financial time series, we can use this decoding function of hidden Markov model to reveal its hidden state sequence.After using the hidden Markov model Viterbi algorithm to “decode” the hidden state of a financial time series, two hidden state series will be obtained. These are the normal state sequence and the abnormal state sequence of the time series. Since the most fundamental purpose of this article is to predict the financial time series, what must be done next is to predict the hidden state at timeT + 1 based on the hidden state before the sequence.According to the principle of hidden Markov model, it is assumed that the hidden state sequence is a first-order Markov process. In other words, the hidden state at timeT + 1 is only related to the state at time T. Then, as long as you know the state transition probability matrix A and δ at time T, you can find δ at T + 1. Then, compare δ when i takes different values, and note that i that maximizes δ is the state at time T + 1.This method can make a one-step prediction for the situation where the hidden Markov model contains two types of hidden states. In this paper, it is called the one-step hidden state prediction method of the two-class hidden Markov model. Using this algorithm, the prediction of the hidden state of the financial time series atT + 1 is realized.One thing to note here is that the parameters of the hidden Markov model are required to be known in the defined conditions, but this is almost impossible to achieve in practical problems. Therefore, in practical applications, we must first use the forward-backward algorithm introduced in this article to train the parameters of the hidden Markov model and then use the definitions in this section to identify and predict the hidden state of financial time series at various points in time.After obtaining the hidden state of the sequence at time 1, …,T and predicting the hidden state at time T + 1, the next thing to do is to choose a suitable method to predict the financial time series. The basic methods used in this paper are still nonparametric kernel regression models and least squares support vector machine models. However, the original financial time series was decomposed into two subsequences, namely, the normal state sequence and the abnormal state sequence. For these two subsequences, different methods need to be selected for prediction according to their different properties, in order to achieve better prediction results.This paper integrates the above-mentioned theories and models and proposes a hybrid forecasting model of mechanism transformation. Because this paper uses different methods to predict different hidden state subsequences and according to the different methods, the mechanism conversion hybrid prediction model is expressed in the following three specific forms: LSSVM-LSSVM model, KERNEL-KERNEL model, and KERNEL-LSSVM model. The difference between these three models lies in the different prediction methods for the sequence. The following are the methods for predicting the sequence of these three models according to the sample data volume of the financial time series. The predicted results are shown in Figure9.Figure 9
Predicted results.


## 4. Empirical Analysis

All the empirical analyses in this article were conducted using MATLAB software. We use MATLB Hidden Markov Model Toolkit and Least Squares Support Vector Machine Toolkit: LS-SVMlab version 1.5.This section uses the LSSVM-LSSVM and KERNEL-KERNEL model forecasting methods to conduct empirical analysis on the Shanghai Stock Exchange Index and the KERNEL-LSSVM model forecasting method to conduct empirical analysis on the NASDAQ Composite Index. Compare the results with the prediction results of ordinary LSSVM model or nonparametric kernel regression model.The closing price data of the Shanghai Stock Exchange Index as of March 11, 2012, a total of 2932 trading days, were selected as the experimental dataset. In order to obtain better training of the support vector machine model, select the first 80% of the data as the training dataset and the last 20% of the data as the test dataset. At this time, the sample data volume is not much, so the data are predicted using the ordinary LSSVM model and the LSSVM-LSSVM model.When using LSSVM to predict time series, it is necessary to select appropriate parameters gam and sig2 in the program. These two parameters, respectively, correspond to the constant C and variance 2 in this paper. These two parameters are determined according to the number of samples, and the value of sig2 does not have a great influence on the prediction results, so this article generally takes sig2 = 0.2. When the ordinary LSSVM prediction is performed, gam passes the test and is determined to be 21. In LSSVM-LSSVM, 1.5 is selected when predicting the value of the normal state point. The selection of this parameter has already reflected the improvement of the method in this paper because the value of gam is affected by outliers in the sequence. The more the outliers and the greater the deviation, the larger the value of gam. Therefore, it can be determined that the hidden Markov model does separate outliers from the sequence. In addition, the LSSVM regression models used in this article are all first-order autoregressive forms.The comparison chart of the prediction effect of the ordinary LSSVM model of the LSSVM-LSSVM model is as follows.This improvement comes from two aspects. First, it is effective to use the hidden Markov model to decompose financial time series according to hidden states, and the decomposed normal state subsequence reduces the influence of outliers. Second, the mechanism conversion hybrid prediction model is effective in reducing the prediction error of the model.The mechanism conversion hybrid prediction model proposed in this paper can significantly improve the prediction effects of the LSSVM model and the nonparametric kernel regression model. However, the improvement of the LSSVM model is more obvious. Moreover, it can also be seen that in the problem of predicting the Shanghai Composite Index, the prediction errors of the LSSVM model are relatively small. That is to say, it is more suitable to use LSSVM and its improved model LSSVM-LSSVM to predict the Shanghai Composite Index. In fact, in the course of the experiment, it was found that when the sample size of the financial time series is small, in the methods discussed in this article, it is always appropriate to use the LSSVM model or its improved model.But this does not mean that the nonparametric kernel regression model has no advantages at all because whether it is the LSSVM model or the LSSVM-LSSVM model, there is a problem in the application process: the model parameters gam and sig2 are difficult to determine. In the experiment process of this article, this problem took a lot of time. As the sample size increases, the training and parameter determination time of the LSSVM model will become very long. At the same time, even if the parameter gam is found, it will be quite large, which does not meet the original intention of the least squares support vector machine. The nonparametric kernel regression model does not require much calculation, and there are no parameters that are difficult to determine. Also, it has good properties under large samples. Therefore, when the amount of financial time series data is large, the nonparametric kernel regression model can only be used to predict it.In addition, because this paper divides the financial time series into normal state series and abnormal state series, the abnormal state series has fewer points, so the LSSVM model is considered to predict the abnormal state series. Through comparison, see if it can improve the forecasting effect. Therefore, in the next experiment, the ordinary nonparametric kernel regression model, KERNEL-KERNEL model, and KERNEL-LSSVM model will be used to predict the financial time series with a large amount of data, and then their prediction effects will be compared.


## 5. Conclusion

This paper makes use of the assumption that the hidden state of the hidden Markov model is a first-order Markov process and proposes a one-step method to predict the next hidden state of a financial time series when the sequence has two types of hidden states. After getting the prediction result of the hidden state, this paper also proposes to choose different models to predict its value according to the different amount of financial time series sample data.



---

*Source: 1465216-2022-04-16.xml*