Machine learning forecasting of USA and PRC balance of trade in context of mutual sanctions

. The USA decided to regulate the trade more by imposing tariffs on specific types of traded goods. It is therefore more interesting to find out whether the current technologies based on artificial intelligence with time series influenced by extraordinary factors such as the trade war between two powers are able to work. The objective of the contribution is to examine and subsequently equalize two time series – the USA import from the PRC and the USA export to the PRC. The dataset shows the course of the time series at monthly intervals between January 2000 and July 2019. 10,000 multilayer perceptron networks (MLP) are generated, out of which 5 with the best characteristics are retained. It has been proved that multilayer perceptron networks are a suitable tool for forecasting the development of the time series if there are no sudden fluctuations. Mutual sanctions of both states did not affect the result of machine learning forecasting.


Introduction
In essence, machine learning is a sub-area of artificial intelligence. Machine learning focuses on many algorithms and techniques that allow a computer system to learn -that is, a change in the internal state of the system that will be able to adapt effectively to the environmental changes [1][2][3]. Ghoddusi, Creamer and Rafizadeh [4] state in their study that machine learning enables to create new opportunities for innovative research in the field of finance and energy economy. The authors focus on applications in areas such as demand forecasting, energy price forecasting (eg natural gas, energy and oil), business strategy, risk management, macro / energy trend analysis and data processing. The authors' analysis suggests that artificial neural networks (ANNs) and genetic algorithms are among the most popular techniques used in energy economy documents. Zhong and Enke [5] in their work, argue that large data analysis techniques associated with machine learning algorithms still play a very important role in many areas of application, including stock market investment. The authors state that today few studies are concerned with the prediction of daily returns from the stock markets, especially in the implementation of powerful machine learning techniques such as deep neural networks for analysis. Deep neural networks use a wide range of different deep learning algorithms based on a combination of network structure, activation functions, and model parameters, and their performance depends on the level of data representation. Thanks to more complex algorithms of learning and other hidden layers, deep neural networks are recognized as advanced and significant technology in the field of artificial and computational intelligence [6]. Samanpour, Ruegenberg and Ahlers [7] report in their study that an important advantage of deep learning is the analysis and learning of large amounts of data unattended, making it a very valuable and useful tool for analysing huge amounts of data where raw data is largely unclassified and unmarked. Liu and Xie [8] contrast the performance of predicting machine learning methods and nine econometric methods, including a new hybrid method that combines model averaging and machine learning using social media and film industry data. The authors' results show that traditional econometric methods reflect the long-term trend better, while machine learning methods have the advantage of solving short-term noise. However, once the sample heterogeneity is rectified, this hybrid method tends to strike the right balance in solving both trend and noise, resulting in excellent forecast efficiency. According to Carbonneau, Laframboise and Vahidov [9], full cooperation in supply chains is ideal, which the participating companies should try to achieve. However, several factors prevent actual progress in this direction. Therefore, there is a need to predict the demand of participants if there is no complete information on the demand of other participants. The authors investigate the applicability of advanced machine learning techniques, including neural networks, recurrent neural networks, and support vector machines, to predict distorted demand at the end of the supply chain. The authors compare these methods to other traditional methods, including naive forecasting, trends, moving average and linear regression. The authors' results suggest that while repetitive neural networks and support vector machines perform best, their predictive accuracy was not statistically significantly better than the regression model.
Means such as artificial neural networks (ANNs) can be used to estimate the trade balance. Klieštik [10] claims that these networks are certain computational models that were inspired by biological neural networks. The application of these networks is applicable in many areas. Pao [11] states that artificial neural networks are nowadays used to solve possible future obstacles, especially for the forecasting of values. According to Sayadi et al. [12], the main advantages of ANNs are the ability to generalize and the ability to learn. The main disadvantages of ANNs, according to the Rowland and Vrbka [13], include the possibility of illogical network behaviour and that they demand very high-quality data. According to Vochozka and Horák [14], ANNs is one of the most popular methods used as a prognostic method that requires a more complex model, uses more variables and tends to be non-linear. Therefore, artificial neural networks are suitable for auxiliary adjustments of the financial sector. According to Cho, Kim and Bae [15], ANNs techniques perform better than traditional statistical methods. Accurate and complex results are also provided by modern hybrid models, which enable to combine statistical methods with artificial neural network techniques. Li et al. [16] state that traditional statistical methods are very popular due to their easy comprehensibility, interpretation and acceptable predictive performance Balcaen and Ooghe [17] achieved a surprising result, comparing selected methods based on discriminant analysis and methods based on logistic regression. The authors found that the accuracy of the model is much more influenced by the indicators that are included in the model than by the method by which the model was derived.
In the economic sphere it is possible to use other methods than just the above mentioned artificial neural networks. Thus, it is possible to use, for example, cluster analysis, decision trees, discriminant analysis and the known ARIMA model [18]. Multiple discrimination analysis is one of the traditional statistical models. According to Crăciun et al. [19], multiple discriminant analysis is a method of diagnosis consisting of measuring and interpreting future economic risks. According to Klieštik, Vrbka and Rowland [20], the advantage of discriminatory analysis is its simplicity and that it is not time consuming, the authors see a disadvantage in its incompleteness. Pai and Lin [21] state that the ARIMA model, or autoregressive integrated moving average, is one of the most widespread linear models in time series predictions. According to Mélard and Pasteels [22], this model is mainly used for short-term prediction in a situation where there is no data available to explain variables or whether the model has poor predictive properties. Junttila [23] sees the advantages of the model primarily in the ability to quickly adapt to changes during a time series, and the main disadvantages that practical applications of models are very demanding, resulting models are difficult to interpret and are only suitable for time series within at least 50 observations. The subject of cluster analysis is, according to Krulický [24], a generalization and a description of relations in a group of variables. Based on the similarity of variables, it creates their clusters. The purpose of this analysis is to classify a certain number of objects into several relevantly homogeneous clusters, where the objects within one cluster are required to be as similar as possible and the objects belonging to different clusters to be as different as possible. According to Šuleř [25], the main advantage of this method is its simplicity and the possibility of using statistical software. The disadvantage of the method is its susceptibility to distortion of results. According to Tuffell et al. [26], decision trees are data structures that allow predicting the output value for specific inputs or classifying input data points. Valášková, Klieštik and Mišánková [27] rank among their main advantages the easy visualization and interpretation, while their disadvantage is that they cannot be used at any time due to the more difficult processing of continuous data.
Rowland, Šuleř and Vochozka [28] set out to compare the accuracy of time series equalizing using regression analysis and artificial neural networks on the example of the trade balance of China and the Czech Republic. Initially, they performed linear regression followed by regression using artificial neural networks. They compared the two methods on a professional level. The results of the authors inform us that artificial neural networks seem to be very useful for the prognosis of time series. In their work, Weijin and Yuhui [29] present a model that is used to predict export and import transactions in one sector. The authors concluded that the nonlinear prognosis may not only address data combination and improving accuracy but may also vividly reflect the nonlinear characteristic of the prediction system. The aim of the authors Horák, Šuleř and Vrbka [30] was to compare the accuracy of time series equalizing using artificial neural networks and regression analysis on the example of US exports to China. The purpose of their study is to show the possible benefits and use of artificial neural networks in practice. The authors' results show that artificial neural networks can effectively learn time series dependencies. Similar findings were made by Vrbka, Rowland and Šuleř [31] in their work, where they compare the accuracy of time series equalizing using artificial neural networks and regression analysis on the example of trade balance between China and the EU.

Data and methods
In the last few years, mutual USA and PRC trade restrictions caused by the USA feeling of imbalance of the both countries trade significantly affect not the mutual trade of the two countries, but also the overall climate of the international trade. The USA decided to regulate the trade more by imposing tariffs on specific types of traded goods. It is therefore more interesting to find out whether the current technologies based on artificial intelligence with time series influenced by extraordinary factors such as the trade war between two powers are able to work. It is desirable that artificial neural networks are able to cope with such a task. For any businessman and economist, it is important to be able not only be aware of the current development but also to forecast the future development. The objective of the contribution is to examine and subsequently equalize two time series: 1. The USA import from the PRC. 2. The USA export to the PRC. Based on the results it will be possible to forecast the future development of the balance of trade of the two trade war actors.
The dataset shows the course of the time series at monthly intervals between January 2000 and July 2019. The course of both time series is shown in Figure 1. Source: [32], own processing The Figure shows seasonal fluctuations in the development of import within the individual years of the monitored period. There is a clear increase in the import from USD 6,902 bn in 2000 to USD 52,202 bn in October 2018. This means that the USA import from the PRC for the monitored period increased more than 7 times. On the contrary, in the case of export the seasonal effect is not apparent at first sight. The volume of the USA export to the PRC is significantly lower. There are many reasons, e.g. cheap labour in the PRC. However, this is not the subject of this contribution. On the contrary, what is important is that there are no seasonal fluctuations evident within one year at first sight. The balance of trade of both countries is negative from the USA perspective, which is clearly shown by the Figure. The shape of the curve is very similar to the inverse curve of imports. The development of export is less noticeable on the balance of trade curve. Table 1 shows the basic statistical characteristics of the dataset.  There will be regression carried out by means of neural structures. The time series will be equalized separately for import and export. The balance of trade will be the difference of the two variables over the time. The procedure chosen corresponds with the situation where the seasonal fluctuations of both time series differ. Therefore, separated equalizing of each time series and the following calculation of the balance of trade will yield more accurate results.
Multilayer perceptron networks (MLP) will be generated. The considered time series lag will be 5 months. This means that the target (forecast) variable will be calculated using the data from the previous five months. This will enable to avoid any time series fluctuations caused by the latest data (in this case, this refers to the time series of the USA import from the PRC). A small lag of the time series can result I extreme fluctuations of the equalized time series. A larger time series lag can mean averaging values. However, each lag of the time series entails greater demands on the complexity of the artificial neural structure, specifically the neurons in the input layer (in the case of this calculation, it will be 15 neurons in the input layer of the artificial neural structure).
The independent continuous variable will be time. The seasonal fluctuations will be represented by the categorical variable in the form of the month and the year in which the value was measured. We will work with possible monthly seasonality of the time series. However, we should also capture the overall trend of the time series. They will be entered as continuous variables in the "Integer" regime. The dependent variable will be the USA import from the PRC or the USA export to the PRC.
The time series will be divided into three data sets: training, testing and validation. The first group will contain 70% of the input data. Based on the training data set, neural structures will be generated. The remaining two data sets will contain 15% of the input data each. Both groups will be used for the verification of the neural structure or the model created. 10,000 neural structures will be generated, out of which 5 with the best characteristics 1 will be retained. The hidden layer will contain at least two neurons and at most 9 neurons. The 1 We will use the least squares method. following distribution functions in the hidden and output layers will be considered: Linear, Logistic, Atanh, Exponential, Sinus.
Other settings will remain default. Finally, forecasting of both time series will be carried out till December 2020, and at the same time, by identifying the difference of export and import, the balance of trade will be calculated. However, this assumes that out of the retained neural structures the one capable of best forecasting of the development of the specific time series will be chosen. Table 2 shows the overview of the neural networks retained in equalizing time series of the import, where the assumed lag is 5 months. Due to the time series lag, the input layer contains 15 neurons. The Table shows that the networks with 4 -10 neurons in the hidden layer of the neural network were retained. The neural networks use the functions of hyperbolic tangent and logistic function for the activation of the hidden layer. The output layer of neurons is activated using the exponential and identity functions. The correlation coefficient in all data sets achieves very high values in all networks. It is always above 0.96, which indicates the high degree of direct dependence. Based on this parameter it is evident that the retained neural structures represent a very plausible model of the actual time series and are therefore capable of forecasting the future development of the time series. The error was determined using the sum of the least squares, and its level is acceptable regarding the input data (for all networks and data sets). It is also evident from Figure 4 that all equalized time series are able to follow the course of the actual development of the USA import from the PRC. With some minor exceptions, all networks are able to capture not only the development trend, but also seasonal fluctuations.

Import
In order to determine whether the networks are applicable or not, we will further deal with their use for forecasting. We will forecast the development of the USA import from the PRC for the period of August 2019 to December 2020. Concrete data are shown in Table 3. The results shown in the Table represent a possible development of the time series. This is to certain extent confirmed by the graph in Figure 3. Comparing the actual development of the USA import from the PRC and assumed development of the variable over time forecast by means of neural networks with a 5-month lag, it can be concluded that (especially taking into account the Table of the statistics in the case of a 5-month lag in Annex 1), the 5. MLP 15-4-1 is the best rated artificial neural structure.

Export
Within equalizing the export time series, there also were generated 10,000 artificial neural networks, out of which 5 with the best characteristics were retained. For more details, see (Table 4). In the case of export, there are also 15 neurons in the input layer. The Table shows  terms of correlation coefficient achieves the level above 0.97 in the training data set. above 0.96 in the testing data set, and above 0.97 in the validation data set. This indicates high level of direct dependence. Based on this parameter it can be stated that the networks (if they do not suffer from overfitting) will be able to forecast the further development of the USA export to the PRC very accurately (as they are able to equalize the time series in the past). For the error calculation, the least squares method will be used. In the case of export, the error is rather small and thus a quality forecast of the time series can be assumed. Figure 4 shows the comparison of the actual course of the time series and equalized tine series. In the case of export, we will also deal with forecasting the further development of the monitored variable. We will forecast the development of the USA export to the PRC for the period between August 2019 and December 2020. Concrete data are shown in Table 5.  As already stated above, all predictions are similar to each other. This is also to certain extent confirmed by the graph in Figure 5.

Results discussion
Within the research, equalizing of the time series of the USA import from the PRC and the USA export to the PRC was carried out. Time series lag was 5 months in both cases. This eliminated potential extraordinary fluctuations caused from the fluctuations of the time series in individual months. At first, we focused on how multilayer perceptron neural networks are able to equalize time series. In both cases, a total of 10,000 artificial neural networks were generated, and five of them with the best characteristics were retained. All retained artificial neural networks are more or less applicable for forecasting the future development of the USA import from the PRC, the USA export to the PRC, and for forecasting the balance of trade of both countries (from the perspective of the USA). The performance of the networks was always very high, while the error measured was rather small. For each time series, the best network was determined, and this was used for calculating the balance of trade (for more details, see Table 6).  Table 6 demonstrates the potential development of the monitored variables, especially the resulting variable -balance of trade. It forecasts the increase in the USA import from the PRC, decrease in the USA export to the PRC and thus also increasing negative USA-PRC balance of trade. This is even better illustrated by Figure 6. From the figure it is evident that the actual development of all three time series and the forecast development are very similar for all selected neural structures. It better illustrates what has been indicated by the table, that the difference between the USSA import to the PRC and the USA export to the PRC will grow. The balance of trade of both states will thus be even more negative than now.

Conclusion
The objective of the contribution was to forecast the United States of America (USA) and the People´s Republic of China (PRC) balance of trade development when using analysis and machine learning forecasting of the USA import from the PRC and the USA export to the PRC.
Both observed time series were equalized, and the most successful neural network was determined in both cases. On the basis of the difference between the USA export to the PRC and the USA import to the PRC, the balance of trade of both countries was calculated.
It could be stated that the objective of the contribution was achieved as: 1. It has been proved that multilayer perceptron networks are a suitable tool for forecasting the development of the time series if there are no sudden fluctuations. 2. MLP networks are able to capture the trend of the whole time series as well as its seasonal fluctuations. 3. It is necessary to consider the time series lag. 4. Mutual sanctions of both states did not affect the result of machine learning forecasting. 5. In the case of the USA export to the PRC and the USA import from the PRC, equalizing the time series had to (and will always have to be in the future) carried out separately. This way it is possible to improve the accuracy of forecasting the development of the balance of trade, as both time series show a completely different development.
Further research shall be focused on an experiment that would provide information on the most suitable time lag of the time series for this type of task and theses specific variables. It can be different for each variable and also different at sub-intervals of the monitored time series.

Annex 1
Basic statistics of equalized import time series with 5-month lag