170 likes | 271 Views
Investigating Estonian foreign trade balance with “Mathematica”. Tõnu Tõnso, Tallinn University, tonu@tlu.ee. Problem:. We have some statistical data (Estonian foreign trade balance, exports and imports). Main questions are - how must we inter -
E N D
Investigating Estonian foreign trade balance with “Mathematica” Tõnu Tõnso, Tallinn University, tonu@tlu.ee
Problem: We have some statistical data (Estonian foreign trade balance, exports and imports). Main questions are - how must we inter- polate or approximate these data with functions and witch representation is “ the best”?
These data comes from database of Statistical Office of Estonia. In the database, the data is represented as accurate to one kroon (is represented with one kroon accuracy, but unfortunately sometimes the data is changing behindhand (apparently the source data is corrected and recalculations are made). About data: Typical changes in initial data of a single year vary from few kroons to some twenty million kroons, in some particular cases the later adjustment has been even about hundred million kroons. Consequently, since the source data is approximate, there is no reason to consider the digits less than million.
About refinement of the data: The question arises perhaps it is worth to refine the table and use the data of months and quarters instead of using the data of the year. Unfortunately, when using months or quar-ter’s data, new problems arise — the data becomes influenced by seasonal fluctuations and noise. Estonian economy is so small that for example, when Tallink buys or sells a ship, this single deal is visible on the graphics. On this reason we gave up the idea of refinement of the data.
About trends in economy I: Considering the export and import data graphics of 14 years, it is obvious that you cannot describe it with the single simple rule. Export and import are influenced by changes in foreign trade laws, by economical crises and bank crashes. Those influences are visible on the graphic. Right in the beginning, Estonia unilaterally gave up custom duties and opened owns market to the foreign trades. Until 1992, the foreign trade balance was about equilibrium, but as a result of the one-party open-door policy, the import started increase faster than the export.
About trends in economy II: The first bigger change came in 1996 and 1997. Then the course to the joining to European Union was taken and step-by-step the European requirements were applied to the agriculture, industry and trade. At the same time, European market was still closed to our products. As a result, a lot of our manufacturing enterprises were extinguished and the import grew sharply. The export (mainly to the non-EU countries) grew also, but much slowly. The stock market crash in 1997 and the following bank crashes influenced the foreign trade about two years.
About trends in economy III: The next bigger change came in 1999. The Russian economical crises reached to us, the export of the food products (milk and fish products) decreased almost to nonexistent. Though in 2000-2003 Estonia assiduously app-lied all kind of eurodirec- tives to the manufacturing and trading companies, the EU market still re-mained closed to our products. As a result, the import from EU countries increased, but we were able to export only wood, peat and other natural resources.
About trends in economy IV: There was a kind of shock while joining with EU – it appeared it was not so simple to get to EU market as it had been hoped. To the products imported form non-EU countries (Far Eastern cars and electronics, for example) the custom taxes were added. As a result of it, both the export and import decreased. To sum up, we cannot claim that the period bet-ween 1993 – 2006 was a uniform period with stable conditions. Now question arises – how to describe the data mathematically? How to interpolate and approximate the data so that the method chosen by us would describe the situation adequately and without remarkable distortion?
Lagrange interpolating polynomials: With interpolation we represent a set of points with a curve that passes exactly through all of the points. On the next figure we can see Estonian export and import data with Lagrange interpolating polynomials. As can be seen, the polynomial goes through all of the points and is quite a good representation of the data in an interval of, for example, [1995; 2004]. Outside of this interval, that is, near the endpoints, the polynomial behaves badly. Indeed, high-order interpolating polynomials should be used with caution.
Least squares fitting: Least squares fitting is a mathematical procedure for finding the best-fitting curve to a given set of points by minimizing the sum of the squares of the offsets of the points from the curve. If we use 7-degree polynomials with least squares fitting, we can see results on next figure: The only conclusion we can make from the least-square method is that between 1993 and 2006 Estonian export grow slower than the import and with every year Estonian foreign trade deficit increased. This plot confirms that the polynomial fit to the data is not adequate; the residuals contain more information, in some places the difference between initial data and least square fitting curve is more than ten milliards.
Cubic spline interpolation: If we use cubic spline interpolation, we get “better” results (Figure below). Cubic spline graphics go through all points and they are smooth. Unfortunately, the smoothness of the graphics is not important (economical processes are not smooth). The question arises – is there any functions, which represent the data better than the cubic splines?
Piecewise interpolation with cubic polynomials: If we have many points and thus an interpolating polynomial of a high order, the result may be bad, that is, the polynomial behaves badly, particularly near the endpoints. Often it is better to proceed piecewise: calculate low-order polyno-mials between successive points. If we calculate the piecewise-cubic inter-polating function for the data, the results are a little bit better then cubic splines.
Linear splines : And of course, if we use linear spline interpolation, then the resultant spline is just a polygon– it is very good and simple method.
Comparing I: Cubic splines vrs linear splines: We can compare the graphs of cubic splines with linear splines.
Comparing II: Piecewise cubic interpolation vrs linear splines:
Using “MATHEMATICA ver 4.2: Lagrange interpolating polynomials of the 13th order, least square fitting polynomials of the 7th order, linear and cubic splines and piecewise interpolated cubic polynomials are found from the data and their graphics representation is prepared with computer algebra package Mathematica 4.2. The author tried to compute the numerical differences between different interpolations by calculating definite integral of the absolute value of their difference. Unfortunately, built-in Mathematica functions were surprisingly weak in numerical integration. It shows computer algebra packages work well with classical school examples, but often fail with real-life examples.
Thank you for your attention! Tõnu Tõnso, Tallinn University tonu@tlu.ee