# Study on the Macroeconomic Model Based on the Genetic Algorithm

Authors: Sun Shihao; Yixin Zhou; Yong Wang; Wu Wang
Journal: Applied Bionics and Biomechanics
 (2022)

---

## Abstract

In order to design a more reliable general push time cycle prediction software for macroeconomic indicators, a set of general software is used to serve financial transactions, bulk material transactions, international trade, macro-control and other fields, so as to improve the prediction of macroeconomic indicators. Because the macro data is one-dimensional array data, the essence of the mutation algorithm is to obtain the movement direction of the mutation of data nodes, obtain the distance between the linear programming result and the original data through the least square method, and calculate the average value in the original data, After binaryt-correction, it refers to the binary t-correction results of the one-dimensional matrix before the final evaluation output factor and the one-dimensional matrix after the final evaluation output factor. In this study, genetic algorithm is introduced as the core algorithm. In the algorithm efficiency verification test, the calculation model based on genetic algorithm is constructed in Matlab environment, and the data space construction mode and genetic variation mode of genetic algorithm are explored. Finally, a high-throughput macroeconomic timing prediction scheme based on genetic algorithm is designed. This scheme is more accurate than the paid full-function 10jqka software, and has a higher prediction cycle for stock price and stock index. The simulation software composed of this algorithm has the prediction function that 10jqka software cannot complete.


---

## Body

## 1. Introduction

Economy is a complex system. Micro individuals can interact to determine the form of macro economy, and the dynamics of macro economy will affect the behavior of micro individuals [1]. Foreign research shows that genetic algorithm is an effective tool for complex systems. This method has stable measurement results of macroeconomic uncertainty, consistent with the actual economic operation, can effectively identify economic fluctuations and exogenous shocks, and can accurately reflect the impact degree difference of different shocks [2].Macroeconomic aggregate, generally using regional gross national product (GDP) or stock market index and other controllable factors to describe macroeconomic state [3]. Commonly used macroeconomic state description data is: regional GDP, regional GDP per capita, monetary nominal purchasing power, iconic main grain price, precious metals and legal currency exchange price, commodity volume and transaction price, stock market index, freight index, etc., conventional macroeconomic state analysis, may be applied to dozens of commonly used macroeconomic state description data [4]. These data mostly expand statistics along the time line, in economics, using time-sharing data and K-line data for statistics. The K-line statistical method is the initial value, final value, highest value, and lowest value in the record statistical period. When the final value is higher than the initial value, it is recorded as the forward K-line, and the reverse K-line when the final value is lower than the initial value.In this study, a series of macroeconomic models based on genetic algorithm are developed to analyze the stock market trading system, including: the linear programming results are obtained by the least square method. In the analysis, the linear estimation can be obtained for the linear data x, the macro data is a group of dimensional data, and the essence of the mutation algorithm is to obtain the movement direction of the mutation of the data nodes, And the distance between the algorithm obtained by the linear formula and the original data, calculate the average value in the original data, and then undergo binary t-correction, which refers to the binary t-correction results of the one-dimensional matrix before and after adding the final evaluation output factor. In this study, genetic algorithm is introduced as the core algorithm. In the algorithm efficiency verification test, the calculation model based on genetic algorithm is constructed in Matlab environment, and the data space construction mode and genetic variation mode of genetic algorithm are explored. Finally, a high-throughput macroeconomic timing prediction scheme based on genetic algorithm is designed.In the macroeconomic analysis, it is an important analysis goal to use the previous K-line data to make an early warning or forecast of the K-line data in a certain period of the future [5]. Genetic algorithm was introduced in this study to use certain periodic data as initialization data to obtain more accurate macroeconomic prediction data by obtaining target data for maximum fitness. Using the macroeconomic indicators (GDP) and demographic data, based on the macro vulnerability model and the genetic algorithm, we can also effectively predict and evaluate the economic losses in other emergencies [6].


## 2. Design of the Macroeconomic Genetic Algorithms

The essence of genetic algorithm is to form the determinable original data into data space, take the target data as the target data, use the mutation algorithm to mutate the target data, and finally form the data with the highest evaluation result as the output data. Because the dynamics of complex adaptive systems are usually nonlinear, sometimes even chaotic, it is difficult to obtain accurate analysis results by using traditional linear and fixed-point methods. The algorithm is mainly used for data prediction and analysis with large chaotic effect or unclear data transmission logic. The general mode of genetic algorithm is shown in Figure1.Figure 1
Schematic representation of the general patterns of the genetic algorithm. Basic Data: Basic data provided by the trading platform or the index platform software; Spatial data initialization: Basic data matrix for the Basic Data trip; Target data initialization: Based on the linear planning target data of the Basic Data itinerary, as the data to be varied; Variation: Data variation algorithms, such as the target weight variant algorithm designed in this study; Evaluate: Data evaluation algorithms, such as the weighted evaluation results given by the decision coefficientR2 used in this study and t in the bivariate difference analysis; Loop: Algorithmic cycle branch, re-variant trigger results when poor user data evaluation results; Output & Result: Data analysis results.For the macroeconomic analysis process, there is a large volume of Basic Data data (most of the original data cycles provided by the platform software are several years to decades), and the analysis and prediction cycle is short (generally need to push the data from 1 to 3 days before). Therefore, the influence of the different raw data selection cycles and the different relevant raw data volume on the accuracy of the final analysis results was explored. The available data structure of the macroeconomic economy is shown in Figure2.Figure 2
The raw data acquisition mode and analysis results used in this study. Opening & Maximum & Minimum & Closing: initial value, maximum value, minimum value, final value in K-line data; result oft-bivariate t-verification, and evaluation value of determination coefficient in R2 regression analysis.Combined with the calculation link in Figure2 above, the following algorithms need to be elaborated.


### 2.1. Linear Planning Algorithm

Linear planning results were obtained by least squares, and in the analysis, for the linear dataX, linear estimates can be obtained:
(1)β^=XTX−1XTy,where X is the statistical array data; XT is the statistics of the last data in the 1D array; and β^ is the output data.


### 2.2. Variability Algorithm Based on Target Weights

The essence of the variation algorithm is to obtain the movement direction of data node variation, because the macroeconomic data are 1-dimensional array data, so the movement direction of freedom is only one dimension, obtaining the direction and forward or reverse movement, the algorithm in the previous formula (1), and the distance between the original data calculation average in the original data:
(2)∆x=AvgX−β^maxX−minX,where β^ is the linear planning results; maxX is the maximum value of the raw data X; minX is the minimum value of the raw data X; AvgX is the arithmetic average value of the raw data calculated in formula (5); and ∆x is the final variation factor of the data variation.


### 2.3. Decision CoefficientR2 Value Algorithm

In the study design, the determination factorR2 value and bivariate check t value are used to form the evaluation factor, and the final R2 value and t value are considered to reach the output standard, where the R2 value algorithm is
(3)R2=βTXTy−1/nyTuuTy∑i=1nxi2−1/n∑i=1nxi2where R2 is the decision coefficient evaluation result; other mathematical symbols are found in formula (1) and formula (2).


### 2.4. Bivariatet Calibration Algorithm

Thet test, also known as the bivariate t test, is a t distribution theory used to infer the probability of differences occurring and thus compare whether the difference between the two mean values is significant. It is mainly suitable for a normal distribution with a small sample size, and the overall standard deviation is unknown. The difference of the data is compared by statistical bivariate t calibration method, where the Value value is t value. When t<10.000, the smaller statistical difference. Log value is P value, statistical reliability is considered when P<0.05, and statistical significance is considered when P<0.01.The bivariatet test designed in this study refers to the results of the bivariate t test for adding the one-dimensional matrix before the final evaluation output factor and the one-dimensional matrix after the final evaluation output factor, as shown in
(4)t=X1¯−X2¯n1−1σ12+n2−1σ22/n1+n2−21/n1+1/n2whereX1¯, X2¯ is the average calculated value of column X before and after the final evaluation of the output factor; σ12,σ22 is the squared value of the standard deviation of column X before and after the final evaluation of the output factor; and n1, n2 is the number of column X elements before and after adding the final evaluation output factor.The mean value algorithm is the formula (5):
(5)X¯=∑i=1nxi,where the meaning of mathematical symbols is the same as the previous formulas;The standard deviation rate is calculated as(6)σ=1n−1∑i=1nxi−X¯2,where the meaning of mathematical symbols is the same as the previous formulas.


## 2.1. Linear Planning Algorithm

Linear planning results were obtained by least squares, and in the analysis, for the linear dataX, linear estimates can be obtained:
(1)β^=XTX−1XTy,where X is the statistical array data; XT is the statistics of the last data in the 1D array; and β^ is the output data.


## 2.2. Variability Algorithm Based on Target Weights

The essence of the variation algorithm is to obtain the movement direction of data node variation, because the macroeconomic data are 1-dimensional array data, so the movement direction of freedom is only one dimension, obtaining the direction and forward or reverse movement, the algorithm in the previous formula (1), and the distance between the original data calculation average in the original data:
(2)∆x=AvgX−β^maxX−minX,where β^ is the linear planning results; maxX is the maximum value of the raw data X; minX is the minimum value of the raw data X; AvgX is the arithmetic average value of the raw data calculated in formula (5); and ∆x is the final variation factor of the data variation.


## 2.3. Decision CoefficientR2 Value Algorithm

In the study design, the determination factorR2 value and bivariate check t value are used to form the evaluation factor, and the final R2 value and t value are considered to reach the output standard, where the R2 value algorithm is
(3)R2=βTXTy−1/nyTuuTy∑i=1nxi2−1/n∑i=1nxi2where R2 is the decision coefficient evaluation result; other mathematical symbols are found in formula (1) and formula (2).


## 2.4. Bivariatet Calibration Algorithm

Thet test, also known as the bivariate t test, is a t distribution theory used to infer the probability of differences occurring and thus compare whether the difference between the two mean values is significant. It is mainly suitable for a normal distribution with a small sample size, and the overall standard deviation is unknown. The difference of the data is compared by statistical bivariate t calibration method, where the Value value is t value. When t<10.000, the smaller statistical difference. Log value is P value, statistical reliability is considered when P<0.05, and statistical significance is considered when P<0.01.The bivariatet test designed in this study refers to the results of the bivariate t test for adding the one-dimensional matrix before the final evaluation output factor and the one-dimensional matrix after the final evaluation output factor, as shown in
(4)t=X1¯−X2¯n1−1σ12+n2−1σ22/n1+n2−21/n1+1/n2whereX1¯, X2¯ is the average calculated value of column X before and after the final evaluation of the output factor; σ12,σ22 is the squared value of the standard deviation of column X before and after the final evaluation of the output factor; and n1, n2 is the number of column X elements before and after adding the final evaluation output factor.The mean value algorithm is the formula (5):
(5)X¯=∑i=1nxi,where the meaning of mathematical symbols is the same as the previous formulas;The standard deviation rate is calculated as(6)σ=1n−1∑i=1nxi−X¯2,where the meaning of mathematical symbols is the same as the previous formulas.


## 3. Validation of the Algorithm Efficiency and the Final Algorithm Optimization

In the algorithm efficiency verification test, the genetic algorithm-based computational model is constructed under Matlab, and the final validation results are obtained using the algorithm accuracy. The algorithm accuracy calculates the absolute value between the difference and the actual data, and then calculates the arithmetic average of the ratio, as shown in Equation (7):
(7)B=1n∑i=1nxi^−xixi,whereB is the results of algorithm accuracy evaluation; other mathematical symbols share the previous formulas.


### 3.1. Effect of the Raw Data Cycle on the Prediction Accuracy

In this comparison model, the prediction results of the data of this column supported by a single column data are discussed. Comparing the data of 1 day, 3 days, 7 days and 15 days supported by 1 month to 12 months, respectively, the prediction data travel K-line and form 4 prediction data per day. The final evaluation results are shown in Table1.Table 1
Relationship between raw data volume and prediction accuracy.
Length of basic dataData prediction cycle1d3d7d15d1 m93.6990.2663.5833.292 m98.2493.7168.2438.623 m99.6595.2970.1342.254 m99.8796.9371.5645.785 m99.9697.8272.4347.646 m99.9998.6573.1149.117 m99.9999.3773.7251.598 m99.9999.5474.7552.199 m99.9999.7575.6352.6410 m99.9899.8276.4153.1611 m99.9999.9178.0553.3212 m99.9999.9578.4453.48d = day; m = month.To observe Table1 data more visually, Table 1 data were visualized to obtain the results of Figure 3:Figure 3
Relationship between raw data volume and prediction accuracy /m=month.Observe Table1 and Figure 3 data. The following data rules were found. The forecast target was 1 or 3 days. High data prediction accuracy can be obtained even with only 1 month of data support. According to the engineering industry consensus on AI data analysis, when the prediction accuracy exceeds 95%, the prediction software has an engineering value. So, under the push-forward prediction period of 1 day ago, select the correlation columns for 2 month data as the base data. Under the push-forward prediction period of 3 days ago, select 3 month data as base data. But under the 7 days and 15 days, it has been impossible to simply increase the amount of relevant data using the algorithm to complete accurate data prediction above 95% accuracy.


### 3.2. The Effect of the Number of Reference Data Columns on the Prediction Accuracy

To further provide the system accuracy under the longer push forward push prediction period requirements, the study assumes hidden conduction logic relationships between other relevant economic data and before the predicted data. For example, there is a hidden transmission logic relationship between bulk material delivery and regional GDP. These relationships are difficult in economics to construct conduction coefficients under statistical models, but the broad association between economic indicators supports genetic algorithms when making forward predictions of certain economic indicator data. Additional data are introduced as the reference data. The raw data space was constructed using the corresponding data columns of the predicted data together with the other data columns, to explore the impact of this approach on the machine learning results of genetic algorithms. The results are shown in Table2:Table 2
Relationship between the number of relevant data columns and the prediction accuracy.
Number of original data columnsData prediction cycle3 m-7d3 m-15d170.1342.25288.6163.18393.5885.27497.4292.36598.8594.18699.3495.35799.6396.47899.7497.29999.8697.94d = day; m = month.To observe Table2 data more visually, Table 2 data were visualized to obtain the results of Figure 4:Figure 4
Relationship between the number of relevant data columns and the prediction accuracy.In Figure4, whether the prediction data of 7 days ago or the forecast data, increase the reference of original data columns, can make the prediction data accuracy is greatly improved, when the reference data column reaches 4 columns, 7 days of prediction accuracy of more than 95%, when the reference data column reaches 6 columns, 5 days of data support prediction accuracy of more than 95%.However, the data in Figure 3 above show that under certain conditions, the accuracy of the macro data prediction and analysis results can exceed 99.9%. For the macroeconomic data prediction results of radical investment projects, the higher the prediction accuracy represents the stronger the risk control ability. Therefore, the study continues to assume that when the reference data column and the original data cycle increase simultaneously, the prediction data accuracy will be more significantly improved. Therefore, in the 15 days before the prediction, different reference data columns and reference data cycles, and the experimental results are obtained in Table 3:Table 3
The prediction accuracy of 15 days before the push data under the comprehensive conditions.
Number of original data columnsData prediction cycle(15d)1 m3 m5 m7 m9 m11 m133.2942.2547.6451.5952.6453.32254.8363.1867.2474.1982.4384.29368.7685.2787.8588.6591.2992.35486.4292.3693.1294.5894.3695.57593.2494.1895.2896.7397.2797.69694.1595.3597.4397.9298.6198.94795.3396.4798.8299.0599.3699.73896.2597.2999.5399.5799.8999.99996.1897.9499.7999.9899.9999.99d = day; m = month.To observe Table3 data, Table 3 data were visualized to obtain the results of Figure 5:Figure 5
Data prediction accuracy was pushed 15 days ago under comprehensive conditions.Observe the data in Table3 and Figure 5, it is found that increasing the number of reference data columns and the original data cycle can improve the accuracy of pushing data prediction 15 days ago. Taking the 99.9% accuracy threshold as an example, when the original data cycle reaches 7 months and the number of reference data columns reaches 9 columns, 99.9%, while the data cycle reaches 11 months, only 8 columns can reach 99.9%. Data prediction accuracy. It can be seen that increasing the number of reference data columns and the original data cycle can realize the accurate prediction of macroeconomic data.


## 3.1. Effect of the Raw Data Cycle on the Prediction Accuracy

In this comparison model, the prediction results of the data of this column supported by a single column data are discussed. Comparing the data of 1 day, 3 days, 7 days and 15 days supported by 1 month to 12 months, respectively, the prediction data travel K-line and form 4 prediction data per day. The final evaluation results are shown in Table1.Table 1
Relationship between raw data volume and prediction accuracy.
Length of basic dataData prediction cycle1d3d7d15d1 m93.6990.2663.5833.292 m98.2493.7168.2438.623 m99.6595.2970.1342.254 m99.8796.9371.5645.785 m99.9697.8272.4347.646 m99.9998.6573.1149.117 m99.9999.3773.7251.598 m99.9999.5474.7552.199 m99.9999.7575.6352.6410 m99.9899.8276.4153.1611 m99.9999.9178.0553.3212 m99.9999.9578.4453.48d = day; m = month.To observe Table1 data more visually, Table 1 data were visualized to obtain the results of Figure 3:Figure 3
Relationship between raw data volume and prediction accuracy /m=month.Observe Table1 and Figure 3 data. The following data rules were found. The forecast target was 1 or 3 days. High data prediction accuracy can be obtained even with only 1 month of data support. According to the engineering industry consensus on AI data analysis, when the prediction accuracy exceeds 95%, the prediction software has an engineering value. So, under the push-forward prediction period of 1 day ago, select the correlation columns for 2 month data as the base data. Under the push-forward prediction period of 3 days ago, select 3 month data as base data. But under the 7 days and 15 days, it has been impossible to simply increase the amount of relevant data using the algorithm to complete accurate data prediction above 95% accuracy.


## 3.2. The Effect of the Number of Reference Data Columns on the Prediction Accuracy

To further provide the system accuracy under the longer push forward push prediction period requirements, the study assumes hidden conduction logic relationships between other relevant economic data and before the predicted data. For example, there is a hidden transmission logic relationship between bulk material delivery and regional GDP. These relationships are difficult in economics to construct conduction coefficients under statistical models, but the broad association between economic indicators supports genetic algorithms when making forward predictions of certain economic indicator data. Additional data are introduced as the reference data. The raw data space was constructed using the corresponding data columns of the predicted data together with the other data columns, to explore the impact of this approach on the machine learning results of genetic algorithms. The results are shown in Table2:Table 2
Relationship between the number of relevant data columns and the prediction accuracy.
Number of original data columnsData prediction cycle3 m-7d3 m-15d170.1342.25288.6163.18393.5885.27497.4292.36598.8594.18699.3495.35799.6396.47899.7497.29999.8697.94d = day; m = month.To observe Table2 data more visually, Table 2 data were visualized to obtain the results of Figure 4:Figure 4
Relationship between the number of relevant data columns and the prediction accuracy.In Figure4, whether the prediction data of 7 days ago or the forecast data, increase the reference of original data columns, can make the prediction data accuracy is greatly improved, when the reference data column reaches 4 columns, 7 days of prediction accuracy of more than 95%, when the reference data column reaches 6 columns, 5 days of data support prediction accuracy of more than 95%.However, the data in Figure 3 above show that under certain conditions, the accuracy of the macro data prediction and analysis results can exceed 99.9%. For the macroeconomic data prediction results of radical investment projects, the higher the prediction accuracy represents the stronger the risk control ability. Therefore, the study continues to assume that when the reference data column and the original data cycle increase simultaneously, the prediction data accuracy will be more significantly improved. Therefore, in the 15 days before the prediction, different reference data columns and reference data cycles, and the experimental results are obtained in Table 3:Table 3
The prediction accuracy of 15 days before the push data under the comprehensive conditions.
Number of original data columnsData prediction cycle(15d)1 m3 m5 m7 m9 m11 m133.2942.2547.6451.5952.6453.32254.8363.1867.2474.1982.4384.29368.7685.2787.8588.6591.2992.35486.4292.3693.1294.5894.3695.57593.2494.1895.2896.7397.2797.69694.1595.3597.4397.9298.6198.94795.3396.4798.8299.0599.3699.73896.2597.2999.5399.5799.8999.99996.1897.9499.7999.9899.9999.99d = day; m = month.To observe Table3 data, Table 3 data were visualized to obtain the results of Figure 5:Figure 5
Data prediction accuracy was pushed 15 days ago under comprehensive conditions.Observe the data in Table3 and Figure 5, it is found that increasing the number of reference data columns and the original data cycle can improve the accuracy of pushing data prediction 15 days ago. Taking the 99.9% accuracy threshold as an example, when the original data cycle reaches 7 months and the number of reference data columns reaches 9 columns, 99.9%, while the data cycle reaches 11 months, only 8 columns can reach 99.9%. Data prediction accuracy. It can be seen that increasing the number of reference data columns and the original data cycle can realize the accurate prediction of macroeconomic data.


## 4. The Final Evaluation Ability Test of Macroeconomics by Genetic Algorithms

The application of macroeconomic data prediction software basically focused on the trading platform (stocks, futures, precious metals, etc.) transaction price and comprehensive index prediction, the study uses the genetic algorithm to build the Matlab simulation environment, the original data cycle set to 12 months, related data columns set to 9 columns, push cycle evaluation 1 days, 7 days and 15 days, comparison software for paid version full function flush stock price prediction software (10jqka), from 2000, the algorithm simulation software and reference software, get Table4Table 4
The forecast accuracy comparison table of stock price and stock index.
Comparison items1d7d15dPriceIndexPriceIndexPriceIndex10jqka96.2797.5385.3684.1765.2363.59This program99.9999.9999.3698.9797.2496.45t5.2964.3652.1382.0040.0000.000P0.0060.0050.0030.0040.0010.000In Table4, all data have t<10.000, t<0.000 and P<0.01 with significant statistical differences. From the data ratio, the prediction accuracy of the 1-day push prediction period varied, but as the prediction period increased, the two sets of software gradually increased and decreased both t-value and P-value. We prove that the software has significant algorithm lead in the 10qka period compared with the 10jqka software. The principle of the process is analyzed, because the 10qka prediction method is to construct multiple predictors based on all previous data, and after weighting each index, we form the prediction results. The software focuses more on using machine learning to search for data rules to achieve accurate prediction of data. Moreover, the algorithm can not only realize the prediction of stock price and stock index, but also realize that of other macroeconomic data, as long as the original data can be generated for a long enough time.


## 5. Summary

The development of computer technology makes it possible for us to intelligently simulate the behavior of a monomer in the whole environment. In recent years, the introduction of genetic algorithm in artificial intelligence has applied genetic algorithm to the research of economics. As the core model of macroeconomic forward time cycle prediction, it can achieve high data prediction accuracy and provide data support for macro-control, bulk trading and financial investment with the support of sufficient computing capacity and equipment, However, the algorithm requires high computing power [7]. When most institutions use the algorithm at the same time, the technology leading position of the algorithm will decline. Therefore, using this algorithm can improve the short-term risk control ability of financial institutions, but in the process of economic game, new algorithms still need to be developed.



---

*Source: 9448895-2022-03-30.xml*