Next Article in Journal
Robust Registration of Medical Images in the Presence of Spatially-Varying Noise
Previous Article in Journal
Improved Scheduling Algorithm for Synchronous Data Flow Graphs on a Homogeneous Multi-Core Systems
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Data Fitting with Rational Functions: Scaled Null Space Method with Applications of Fitting Large Scale Shocks on Economic Variables and S-Parameters

1
School of Business Administration, Pennsylvania State University Harrisburg, Middletown, PA 17057, USA
2
School of Science, Engineering and Technology, Pennsylvania State University Harrisburg, Middletown, PA 17057, USA
*
Author to whom correspondence should be addressed.
Algorithms 2022, 15(2), 57; https://doi.org/10.3390/a15020057
Submission received: 29 December 2021 / Revised: 7 February 2022 / Accepted: 8 February 2022 / Published: 9 February 2022

Abstract

:
Curve fitting discrete data (x, y) with a smooth function is a complex problem when faced with sharply oscillating data or when the data are very large in size. We propose a straightforward method, one that is often overlooked, to fit discrete data ( s , y s ) with rational functions. This method serves as a solid data fitting choice that proves to be fast and highly accurate. Its novelty lies on scaling positive explanatory data to the interval [0, 1], before solving the associated linear problem A x = 0 . A rescaling is performed once the fitting function is derived. Each solution in the null space of A provides a rational fitting function. Amongst them, the best is chosen based on a pointwise error check. This avoids solving an overdetermined nonhomogeneous linear system A x = b with a badly conditioned and scaled matrix A. With large data, the latter can lack accuracy and be computationally expensive. Furthermore, any linear combination of at least one solution in the basis of the null space produces a new fitting function, which gives the flexibility to choose the best rational function that fits the constraints of specific problems. We tested our method with many economic variables that experienced sharp oscillations owing to the effects of COVID-19-related shocks to the economy. Such data are intrinsically difficult to fit with a smooth function. Deriving such continuous model functions over a desired period is important in the analysis and prediction algorithms of such economic variables. The method can be expanded to model behaviors of interest in other applied sciences, such as electrical engineering, where the method was successfully fitted into network scattering parameter measurements with high accuracy.

1. Introduction

Fitting data with smooth functions, polynomials, rational functions, and others is an increasingly growing topic of interest in the fields of data science, machine learning, all engineering disciplines, political and social sciences, medicine and pharmaceutical sciences, economics, finance, and many others. The fitting function is considered a mathematical continuous model obtained from discrete experimental measurements. A few examples of the vital applications are data recovery in imaging, extrapolation, converting discrete frequency measurements to a continuous time-domain simulation in electrical and mechanical systems via Fourier transform, data mining, machine learning, neural networks, and statistical predictors algorithms used in stock prices predictions software.
There are various fitting methods in the literature, and they all have advantages and disadvantages. In ref. [1], a survey of many fitting methods with rational functions is presented along with performance comparative examples. Some of the fitting techniques are: Bode’s asymptotic approximation [2], the Levy method [3], iteratively reweighted least squares [4,5], the Sanathanan–Koerner method [6], the Noda method, Vector Fitting along with its improvement [7,8], the Levenberg–Marquardt method and its updates [5,9,10], and the Damped Gauss–Newton method [4].
These methods solve the problem of finding a rational curve fitting function f that takes the general form from discrete measurements s , y s , which is substituted in the above equation for z , f z . A linear system A x = b is then derived to solve for the coefficients a i   and   b i .
Most of the mentioned rational approximation techniques are iterative and rely on a clever choice of an initial guess. The behavior and size of data control the success or failure of the methods. With sharply oscillating data, convergence fails or performs slowly. Also, accuracy of the approximation would not be achieved with a less refined initial guess [11].
Furthermore matrix A is badly scaled with high magnitudes of s and N, which also affects convergence and accuracy. The presented method in this work is a noniterative method, and therefore we do not incorporate an initial guess. Moreover, scaling explanatory data s to the interval [0, 1] before deriving the linear system solves the badly scaled matrix A issue, and therefore results in higher stability and accuracy compared to that of methods that did not scale measurement s. We believe that the scaling process is what set the presented method apart from others, coupled with the use of the “extraordinary SVD method” as described in the work of Martin and Porter [12] to solve a homogeneous system.
In Section 2, we present the mathematical derivation of the method. In Section 3, we apply scaled null space technique to model various economic variables that experienced sudden shocks due to COVID-19 impact on US economy during the recession that started in March 2020. We believe that since the model could fit the data for such a period of unstable trends in the economic variables, it is expected to perform better with data that does not manifest such strong oscillations. We used our method to model two stock market indices: Dow Jones Index Average (DJIA) and Standard and Poor’s 500 (S&P 500); two US treasury bonds yields: the 3-month treasury bond and 10-year treasury bond; and unemployment rate. Although the actual data go through large shocks, our model is accurate in approximating the data with low residual errors. In Section 4, we compare the results of our proposed method with the Matlab rationalfit method and the results with the unscaled version of our method. In the same section, we present a recovery example of the sine function from sampled points selected from its curve. Finally, we discuss in Section 5 limitations of the presented method, a proposed approach to overcome failure to accurately fit the data, and an example to approximate very large data of sinusoidal behavior.

2. Methodology: Null Space on Scaled Independent Variable

The goal of the method presented in this section is to fit discrete data measurements ( s ,   y s ) with a real valued rational function f where s is the explanatory variable and y s is the response variable. We consider the fitting function f to be in the form
f z = a 0 + a 1 z + a 2 z 2 + a N z N b 0 + b 1 z + b 2 z 2 + b N z N  
for real value z. When the responses y s are complex numbers, as in many engineering systems, the fitting technique can be broken down into fitting separately the real and imaginary parts of y s .
Before we proceed with the derivations, we normalize the explanatory variable data s in the infinity norm sense. So, all values s will be replaced with s s m a x , where s m a x is the maximum value among all |s|. This scaling process allow all powers of s to be contained in the interval [0, 1] for positive s. For each value s, Equation (1) becomes:
          y s ( b 0 + b 1 s + b 2 s 2 + b N s N ) ( a 0 + a 1 s + a 2 s 2 + a N s N ) = 0
which gives
b 0 y s + b 1 s y s + b 2 s 2 y s + b N s N y s a 0 a 1 s a 2 s 2 a N s N = 0
The unknowns are the coefficients in the vector b 0 , b 1 , b 2 , , b N , a 0   , a 1   , a 2 a N . Once we solve for the coefficients, a fitting function is defined.
Suppose we have m data (s,   y s ). Each pair of measurement gives an equation, and therefore we obtain a homogeneous system of m equations represented in matrix form:
A x = 0
where x = b 0 , b 1 , b 2 , , b N , a 0   , a 1   , a 2 a N ’ and A is the coefficient matrix with size m by 2N + 2. Each couple (s,   y s ) defines a row in the matrix A,
( y s     y s s       y s s 2   y s s N   1   s     s 2 s N   )
The benefit of scaling by 1/ s m a x , where all powers of s are contained in the interval [0, 1], is evident. This avoids a badly scaled coefficient matrix A, especially for higher s and N.
The set of vector solutions x = x 1 , x 2 , , x r form a basis of the null space of A, null(A). With the proper choice of the degree N, each solution vector x i   ,   1 i r gives a rational fitting function f i . The best rational function f is picked by calculating the minimum of the errors | f i y s | , where f i is the evaluation vector with inputs s using Equation (1), and y s is the vector of the data responses y s .
In other words, the index n, that gives the best fitting function f n is defined by
| | f n y s | | = min 1 i r | | f i y s | |
The vector f n contains the coefficients of the model function f n .
This process is our preferred error minimization method between the response observations y s and the function coefficients in f i . The users can choose an alternative minimization norm such as the 2-norm for instance. Next, we horizontally stretch the fitting function by a factor of s m a x to be defined on the original interval containing the raw unscaled variable s , i.e., the fitting function is giving by
f z = f n s m a x z
To solve Equation (2) we used MATLAB built-in function null(A), which is based on the singular value decomposition (SVD) of matrix A. When A is very large the economy-sized MATLAB svd(A,”econ”) can be used. This method also extends for negative values of s , in which case scaled values s s m a x will be contained in the interval [−1, 1], and so are all powers of s. The existence of infinitely many solutions is guaranteed when the system 2 is underdetermined m < 2 N + 2 . In fact, the dimension of the null space is always at most 2 N + 2 m . When the system is overdetermined or A is a square matrix m 2 N + 2 , we need enough linearly dependent equations for the solutions to exist, precisely at most 2 N + 1 linearly independent equations. If the latter condition is not satisfied, we should increase the degree N until either we have an underdetermined system or 2 N + 1 linearly independent equations if the system remains overdetermined. In general, the degree of the polynomials N is higher with more fluctuating data. It is also higher with a larger amount of data.

3. Results and Discussion

Modeling discrete data responses with a continuous smooth function can be used as a future predictor, when fit, to anticipate similar behavior in economics, finance, public health, sociology, etc. [13]. It can also be used as a base to derive momentum oscillators and be implemented in learning algorithms crucial to profitability of technical stock trading, for instance [14,15,16,17].
In this section, we apply our method on examples from the shock that hits the economy early in the onset of COVID-19 pandemic. During the early onset of COVID-19 in March and April of 2020, financial markets were very volatile given the uncertainty about the future. Financial literature showed that uncertainty about the near-term or long-term future leads to large spreads in bond markets and high volatility in the financial markets. In [18], the authors even show that stock market uncertainty has important cross-market pricing influences and that stock-bond diversification benefits increase with stock market uncertainty. In addition, Federal Reserve intervened to calm the markets by lowering the key interest rate and creating various special lending programs to provide liquidity for the financial system and for local and state governments. All these unique developments created a chaotic scenario for many of the economic variables to experience huge swings. Indeed, the effects of COVID-19 developments and policy responses on the US stock market and bond markets are without historical precedent [19]. We choose this period given its large uncertainty about the future and its erratic oscillations in all economic and financial variables during this period. We included examples from Dow Jones Index Average (DJIA), Standard and Poor’s 500 (S&P 500), two treasury rates such as 3-month treasury bond rate and 10-year treasury bond rate, and unemployment rate. We collected data from publicly available sources such as Federal Reserve Economic Data, which is published by Federal Reserve Bank of St. Louis [20].
For each data sample, a graph of the fitting function versus raw observations is presented along with a pointwise error plot. The method was capable of fitting data with frequent zigzagging, especially in the DJIA and S&P 500 index examples.
In the following examples the error figures represent the absolute value of the difference between the response observations y s and the corresponding values of the fitting function, e r r o r = f s y s . As in Equation (1) in the previous section, we denote N, the order of the polynomials in the numerator, and the denominator of the fitting function f.
In Figure 1 and Figure 2, we show how the stock market indices reacted to the news of the COVID-19 pandemic. DJIA is one of the oldest and most commonly used equity indices in the market, representing a price weighted index of 30 large companies. The figures show that DJIA lost more than 32% of its value within a few days in mid-March, and it was able to recover most of it back within a couple of weeks. The figures include only business days since there are no data for stock market and bond market during the weekends.
In Figure 2, we show the trend of S&P 500, which tracks the performance of 500 large companies listed on the stock exchanges in the US. Even here we can see a drop of about 28% in the value of the index and a quick recovery of most of that loss within a few weeks. Our model is able to predict with low error these zigzagging trends.
In Figure 3 and Figure 4, we show the trend of the two treasury bond rates. We chose to focus on these two bonds rates because one is very short-term (3 months) and one is long-term (10 years). The short-term one is the cost of borrowing on money markets for a short period, while the long-term one is a proxy for the cost of investment. Many companies choose to borrow for investment and borrow based on the cost of borrowing for a long-term project, which is usually at a higher premium compared to that of the treasury bond.
In February 2020, the interest rates of the two bonds were similar, and many financial economists were predicting a potential economic crisis due to expectations of lower long-term interest rates. After the announcement of the pandemic by the World Health Organization on 11 March 2020, Federal Reserve slashed its own key interest rate and started purchasing treasury bonds. This movement led to drastic changes in the interest rates as seen in Figure 3 and Figure 4. However the effect was much larger on the short-term interest rates as the markets expected the shock to be short-lived. Our models predict the trend within low errors as seen on the right side of the figures.
Our last example with economic data is the unemployment rate, and we can see the data and the error fitting of our model in Figure 5. Given that the unemployment rate data are monthly, we expand our sample from January 2019 to August 2021. The unemployment rate was decreasing to historical lows until COVID-19 hit. Due to forced shutdowns the number of layoffs increased dramatically, going from 3.5% to 14.8%. As the economy started reopening slowly, we saw the unemployment rate coming down slowly. Our model was able to cope with the sharp spike of the unemployment rate and approximated the responses within very small errors, as shown in Figure 5.
We tested our model with extreme cases where the actual historical data have experienced large fluctuations. We showed that our model is able to predict with an extremely low number of errors (as low as 0) that the 10-year treasury bond rate, in which there were instances of large swings in data, showed approximately 100% fluctuation within a few days (see Figure 4). If the model can perform at this level, in extreme cases like the ones shown above, one can expect even higher accuracy (lower errors) in the case of relatively lower fluctuations as presented in the next sections.

4. A Comparative Performance of the Model

In this section, we present two examples to perform a comparison between a Matlab bult-in function rationalfit and our method.

4.1. Comparison on Network Scattering Parameters Data S 11

The first comparative example is concerned with fitting network scattering parameter data. Network scattering parameters are powerful tools for the analysis and design of high-frequency and microwave networks, and they can be tested by users in a guided example with Matlab Radio Frequency toolbox [21,22]. As stated in Matlab R2021b release documentation, rationalfit approximates data using stable rational function object and is based on vector fitting method [1], along with its improvement [23]. The original paper [1] gained popularity in the electrical engineering community, with high number of paper citations and patent. The data in this example are the same used by the author to illustrate its robust performance in fitting S-parameters. We compared the model functions obtained by both schemes to fit the real and imaginary parts of the responses   S 11 along with their corresponding errors, Figure 6, Figure 7, Figure 8 and Figure 9.
A more in-depth comparison is presented below in Figure 7 with a pointwise error plot of each method and a difference plot between the errors (error with rationalfit minus error with scaled null space).
Next, we show a similar profile when we fit the imaginary part of the responses in terms of frequencies. These comparisons are reported in Figure 8 and Figure 9. First, we report the fitting of both methods with scaled null space and with Matlab rationfit method in Figure 8.
In Figure 9, we show a pointwise comparison that illustrates the error plot and the difference between the magnitude of the errors (error with rationalfit minus error with scaled null space).

4.2. Comparison on Sinusoidal Behaving Data

The second comparative example begins with fitting a sample (x, y) of 201 points uniformly spaced, extracted from the sine function over the interval 0 ,   5 π . This example shows high accuracy of fitting sinusoidal behaving data that arise in many applications, Figure 10. In addition, we show the capability of the fitting function to recover, with high precision, data not included in the sample, Figure 11. In fact, every real value in 0 ,   5 π not listed in the 201 sample points is recovered with high accuracy by the fitting function provided by scaled null space method. The sine function and the rational fitting function are almost overlapping everywhere in 0 ,   5 π . In other words, if the sine function was unknown and was only represented by a sample of 201 data uniformly distributed over 0 ,   5 π , then scaled null space method would have recovered the sine function with high accuracy over the entire interval 0 ,   5 π . MATLAB rationalfit did not return an adequate fitting of the same data, Figure 12. Furthermore, at the end of this subsection, we fit the same data   S 11 with the unscaled version of our method to highlight the importance of the scaling procedure, Figure 13.
Lastly, we show the performance of our method without scaling the frequencies s by 1 s m a x in Figure 13. As we discussed in Section 2, the coefficient matrix A is badly scaled due to the high powers s i for large s and i . We used the same s-parameters data presented above for accuracy comparison with scaled null space method.

5. Fitting Large Data and Limitations

There are challenges that face fitting experimental data (x, y) with smooth functions. These challenges impede many successful curve fitting methods from being universal, meaning the capability of performing smoothing of any data (x, y) regardless of their complexity. One of the challenges is the behavior of the data, especially data manifesting frequent sharp oscillations, as in the examples of stock prices. The latter limitation is intrinsic as the data have many corners and the fitting function is smooth. Another limitation is the large size of the data leading to large scale linear systems with very large coefficient matrices that could be ill-conditioned or badly scaled. Furthermore, large data exacerbate convergence failure and speed issues in iterative fitting methods such as Levenberg–Marquardt. Fitting with a smooth function data with both limitations present simultaneously is a very complicated problem. Our method fails to provide adequate accuracy when both conditions meet in certain data, as any fitting method would do. The highest number our method was successful to fit is one-million-and-one ( 10 6 + 1 ) pairs (x, y) extracted from the sine function over 0 ,   5 π (Figure 14), with pointwise errors less than 7.4 × 10 12 over all the one-million-and-one points. These small residuals show a clear advantage of our method when fitting very large data that behave smoothly enough. Matlab rationalfit failed to fit 201 data extracted from the same function as discussed in the previous example.
As a proposed remedy, when the method fails to return a desired precision, the user should resort to partitioning the data over subintervals and fit them over each one. The overall fitting function is a piecewise continuous function with negligible jump discontinuities. In other words, let us consider the partition of the data over x into n subintervals
I i = x i ,   x i + 1 ,   1 i n 1 ,       I n = x n ,   x n + 1 .
Let f i be a good rational fit over I i obtained either by our method or any other method. The overall fitting function f writes:
f = i = 1 n f i   χ I i
where χ I i is the characteristic function χ I i x = 1 ,   i f   x I i 0 , i f   x   I i   .
The jump discontinuities ε i = f i x i + 1 f i x i ,   1 i n are small when the functions f i perform well the curve fitting over I i . In many practical applications, such derivation is sufficient as in numerical integration of a function given as discrete pairs (x, y) for instance.

6. Conclusions and Future Expansion

The presented method in this work has a few advantages. First, it fits with rational functions, which are proven to be reliable at coping with many data behaviors. Second, the mathematics of finding the best fitting rational function is straight forward and is based primarily on solving a homogeneous linear system or finding the null space of a matrix, which can be performed efficiently in numerous ways [11]. Lastly, generating a null space base is efficiently computed via the “Extraordinary SVD” method as described in the work of Martin and Porter [12]. This will take away much of the burden in solving an overly determined, nonhomogeneous system Ax = b with optimization techniques; a task that is more challenging when the matrix A is badly scaled and conditioned, which is the case when trying to solve for the coefficients in f s   via a nonhomogeneous system [1]. The latter limitation was the drive behind straying away from a direct approach when fitting with rational functions [1,2].
In this paper, we proposed a robust method to fit data ( s , y s ) with rational functions. We transformed the problem to a null space problem on scaled explanatory data. The presented method has a few advantages: First, we fit data with rational functions that are flexible in coping with different data behaviors. Second, the underlying null space problem is much easier to solve, as it entails computing a one-time SVD decomposition of a matrix that is not badly scaled due to controlling the terms s i via scaling the independent variable s . Third, the method provides high levels of efficiency and accuracy in the computations mainly because it attempts to solve for the exact solutions instead of iterative approximation schemes. As we showed through numerous examples, null space method succeeded to model many vital behaviors expressed as discrete measurements with high accuracy. As a potential future expansion of this work, we are interested in exploring prediction capabilities of the rational functions in many artificial intelligence algorithms in which cubic splines are used to smooth the data [24]. We are intrigued to explore whether cubic splines method replaced by our rational fit method would enhance prediction. We are also interested in deriving a numerical integration method to approximate a b f x d x based on fitting the integrand expressed discretely as x i ,   f x i .

Author Contributions

Conceptualization, T.M. and I.H.; data curation, I.H.; formal analysis, T.M.; investigation, T.M.; methodology, T.M.; software, T.M.; validation T.M. and I.H.; writing—original draft preparation, T.M. and I.H.; writing—review and editing, T.M. and I.H.; visualization, T.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The data used in this study are publicly available in various official sources, and all are already collected at Federal Reserve Economic Data, which is published by Federal Reserve Bank of St. Louis at https://fred.stlouisfed.org, accessed on 3 September 2021.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Bañuelos-Cabral, G.; Gustavsen, B. Rational Fitting Techniques for the Modeling of Electric Power Components and Systems Using MATLAB Environment; IntechOpen: London, UK, 2017. [Google Scholar] [CrossRef] [Green Version]
  2. Bode, H. Network Analysis and Feedback Amplifier Design; Van Nostrand: New York, NY, USA, 1945; ISBN 978-0882752426. [Google Scholar]
  3. Levy, E.C. Complex curve fitting. IRE Trans. Autom. Control 1959, AC-4, 37–44. [Google Scholar] [CrossRef]
  4. Björck, A. Numerical Methods for Least Squares Problems, 1st ed.; SIAM: Philadelphia, PA, USA, 1996. [Google Scholar]
  5. Dennis, J.E., Jr.; Schnabel, R. Numerical Methods for Unconstrained Optimization and Nonlinear Equations, 1st ed.; SIAM: Philadelphia, PA, USA, 1996; ISBN 978-0898713640. [Google Scholar]
  6. Sanathanan, C.K.; Koerner, J. Transfer function synthesis as a ratio of two complex polynomials. IEEE Trans. Autom. Control 1963, 8, 56–58. [Google Scholar] [CrossRef]
  7. Gustavsen, B.; Semlyen, A. Rational Approximation of frequency domain responses by vector fitting. IEEE Trans. Power Deliv. 1999, 14, 1052–1061. [Google Scholar] [CrossRef] [Green Version]
  8. Gustavsen, B. Improving the Pole Relocating Properties of Vector Fitting. IEEE Trans. Power Deliv. 2006, 21, 1587–1592. [Google Scholar] [CrossRef]
  9. Levenberg, K. A method for the solution of certain problems in least squares. Q. Appl. Math. 1944, 2, 164–168. [Google Scholar] [CrossRef] [Green Version]
  10. Marquardt, D. An algorithm for least squares estimation on nonlinear parameters. SIAM J. Appl. Math. 1963, 11, 431–441. [Google Scholar] [CrossRef]
  11. Cox, A.J.; Higham, N.J. Accuracy and Stability of the Null Space Method for Solving the Equality Constrained Least Squares Problem. BIT Numer. Math. 1999, 39, 34–50. [Google Scholar] [CrossRef]
  12. Martin, C.D.; Porter, M.A. The Extraordinary SVD. Am. Math. Mon. 2012, 119, 838–851. [Google Scholar] [CrossRef]
  13. Mathiasen, P. Prediction Functions. Scand. J. Stat. 1978, 6, 1–21. [Google Scholar]
  14. Qian, N. On the momentum term in gradient descent learning algorithms. Neural Netw. 1999, 12, 145–151. [Google Scholar] [CrossRef]
  15. Chan, L.; Jegadeesh, N.; Lakonishok, J. Momentum strategies. J. Financ. 1996, 51, 1681–1711. [Google Scholar] [CrossRef]
  16. Chang, P.H.K.; Osler, C.L. Methodical madness: Technical analysis and the irrationality of exchange-rate forecasts. Econ. J. 1999, 109, 636–661. [Google Scholar] [CrossRef]
  17. Schulmeister, S. Profitability of technical stock trading: Has it moved from daily to intraday data? Rev. Financ. Econ. 2009, 18, 190–201. [Google Scholar] [CrossRef] [Green Version]
  18. Connolly, R.; Stivers, C.; Sun, L. Stock Market Uncertainty and the Stock-Bond Return Relation. J. Financ. Quant. Anal. 2005, 40, 161–194. [Google Scholar] [CrossRef] [Green Version]
  19. Baker, S.R.; Bloom, N.; Davis, S.J.; Kost, K.; Sammon, M.; Viratyosin, T. The Unprecedented Stock Market Reaction to COVID-19. Rev. Asset Pricing Stud. 2020, 10, 742–758. [Google Scholar] [CrossRef]
  20. Federal Reserve Economic Data of Federal Reserve Bank of St. Louis. Available online: https://fred.stlouisfed.org (accessed on 3 September 2021).
  21. Mathworks. Available online: https://www.mathworks.com/help/rf/ref/rationalfit.html?searchHighlight=rationalfit&s_tid=srchtitle_rationalfit_2 (accessed on 26 December 2021).
  22. Mavaddat, R. Network Scattering Parameters. In Advanced Series in Circuits and Systems; World Scientific Publishing: Singapore, 1996; Volume 2, ISBN 9810223056. [Google Scholar]
  23. Zeng, R.; Sinsky, J. Modified Rational Function Modeling Technique for High-Speed Circuits. In Proceedings of the 2006 IEEE MTT-S International Microwave Symposium Digest, San Francisco, CA, USA, 11–16 June 2006; IEEE: Piscataway, NJ, USA, 2006. [Google Scholar]
  24. Zielesny, A. From Curve Fitting to Machine Learning an Illustrative Guide to Scientific Data Analysis and Computational Intelligence, 2nd ed.; Springer International Publishing: Cham, Switzerland, 2016; Volume 109, ISBN 978-3-319-81313-4. [Google Scholar] [CrossRef]
Figure 1. Fitting Dow Jones Index Average (DJIA) values during 2020 stock market crash. Fitting function of Dow Jones Index values from 1 March 2020 to 15 April 2020. N = 80, error range is [3.7289 × 10 11 , 3.2482 × 10 5 ].
Figure 1. Fitting Dow Jones Index Average (DJIA) values during 2020 stock market crash. Fitting function of Dow Jones Index values from 1 March 2020 to 15 April 2020. N = 80, error range is [3.7289 × 10 11 , 3.2482 × 10 5 ].
Algorithms 15 00057 g001
Figure 2. Fitting S&P 500 index values during 2020 stock market crash. Fitting function of S&P500 Index values from 1 March 2020 to 15 April 2020. N = 65, error range is [3.7289 × 10 11 , 3.2482 × 10 5 ].
Figure 2. Fitting S&P 500 index values during 2020 stock market crash. Fitting function of S&P500 Index values from 1 March 2020 to 15 April 2020. N = 65, error range is [3.7289 × 10 11 , 3.2482 × 10 5 ].
Algorithms 15 00057 g002
Figure 3. Fitting function of 3-month treasury bond rate from 1 March 2020 to 15 April 2020. N = 48, error range is [0, 1.6031 × 10 10 ].
Figure 3. Fitting function of 3-month treasury bond rate from 1 March 2020 to 15 April 2020. N = 48, error range is [0, 1.6031 × 10 10 ].
Algorithms 15 00057 g003
Figure 4. Fitting 10-year treasury bond rate from 1 March 2020 to 15 April 2020. N = 60, error range is [0, 8.459 × 10 10 ].
Figure 4. Fitting 10-year treasury bond rate from 1 March 2020 to 15 April 2020. N = 60, error range is [0, 8.459 × 10 10 ].
Algorithms 15 00057 g004
Figure 5. Fitting unemployment rate. Fitting function of unemployment rate since 1 January 2019 to 1 August 2019. N = 80, error range is [0, 1.32 × 10 8 ].
Figure 5. Fitting unemployment rate. Fitting function of unemployment rate since 1 January 2019 to 1 August 2019. N = 80, error range is [0, 1.32 × 10 8 ].
Algorithms 15 00057 g005
Figure 6. (a) Fitting the real part of   s 11 parameter with scaled null space method on the left and with Matlab rationalfit on the right. Number of measurement data ( s , Re(   s 11 )) is m = 202. We observe higher accuracy in fitting with scaled null space method. (b) We magnified (a) to show differences between two methods.
Figure 6. (a) Fitting the real part of   s 11 parameter with scaled null space method on the left and with Matlab rationalfit on the right. Number of measurement data ( s , Re(   s 11 )) is m = 202. We observe higher accuracy in fitting with scaled null space method. (b) We magnified (a) to show differences between two methods.
Algorithms 15 00057 g006aAlgorithms 15 00057 g006b
Figure 7. A pointwise comparison of fitting errors in the example above. Left-hand side graph shows absolute value of errors of our method scaled null space versus Matlab rationalfit. Right-hand side graph represents difference between errors in rationalfit and our method, where positive y values indicate how much rationalfit is less accurate, and negative y values show how much our method is less accurate. Range of errors in rationalfit is [1.5492 × 10 5 , 0.0212], while with scaled null space range is [2.7089 × 10 14 , 0.0198], which clearly exhibits a better accuracy, especially over most of frequencies.
Figure 7. A pointwise comparison of fitting errors in the example above. Left-hand side graph shows absolute value of errors of our method scaled null space versus Matlab rationalfit. Right-hand side graph represents difference between errors in rationalfit and our method, where positive y values indicate how much rationalfit is less accurate, and negative y values show how much our method is less accurate. Range of errors in rationalfit is [1.5492 × 10 5 , 0.0212], while with scaled null space range is [2.7089 × 10 14 , 0.0198], which clearly exhibits a better accuracy, especially over most of frequencies.
Algorithms 15 00057 g007
Figure 8. (a) Fitting imaginary part of s 11 parameter with scaled null space method on left and with Matlab rationalfit on right. Number of measurement data ( s , Im(   s 11 )) is m = 202. Again, a higher accuracy is achieved when fitting with scaled null space method. (b) We have zoomed up (a) to show the differences between the two methods.
Figure 8. (a) Fitting imaginary part of s 11 parameter with scaled null space method on left and with Matlab rationalfit on right. Number of measurement data ( s , Im(   s 11 )) is m = 202. Again, a higher accuracy is achieved when fitting with scaled null space method. (b) We have zoomed up (a) to show the differences between the two methods.
Algorithms 15 00057 g008
Figure 9. A pointwise comparison of fitting errors in example above. Left-hand side graph shows absolute value of errors of our method scaled null space versus Matlab rationalfit. Right-hand side graph represents difference between errors in rationalfit and our method, where positive y values indicate how much rationalfit is less accurate and negative y values show how much our method is less accurate. Range of errors in rationalfit is [2.5593 × 10 6 , 0.0190], while with scaled null space range is [8.8818 × 10 16 , 0.0190], which emphasizes advantage in accuracy with our method.
Figure 9. A pointwise comparison of fitting errors in example above. Left-hand side graph shows absolute value of errors of our method scaled null space versus Matlab rationalfit. Right-hand side graph represents difference between errors in rationalfit and our method, where positive y values indicate how much rationalfit is less accurate and negative y values show how much our method is less accurate. Range of errors in rationalfit is [2.5593 × 10 6 , 0.0190], while with scaled null space range is [8.8818 × 10 16 , 0.0190], which emphasizes advantage in accuracy with our method.
Algorithms 15 00057 g009
Figure 10. Fitting discrete sample of 201 uniformly selected datapoints from sine function over 0 ,   5 π with scaled null space method. Residual errors range from 0 to 5.6377 × 10 13 , and polynomials have degree N = 40.
Figure 10. Fitting discrete sample of 201 uniformly selected datapoints from sine function over 0 ,   5 π with scaled null space method. Residual errors range from 0 to 5.6377 × 10 13 , and polynomials have degree N = 40.
Algorithms 15 00057 g010
Figure 11. Approximation of sine function over interval 0 ,   5 π using 201 uniformly selected sample points. Both functions are almost overlapping over whole interval 0 ,   5 π   as shown in top plot. Bottom graph is a magnified window to manifest a little contrast and visualize with more certainty high recovery accuracy. This example shows that fitting function a solid continuous representation of given discrete distribution.
Figure 11. Approximation of sine function over interval 0 ,   5 π using 201 uniformly selected sample points. Both functions are almost overlapping over whole interval 0 ,   5 π   as shown in top plot. Bottom graph is a magnified window to manifest a little contrast and visualize with more certainty high recovery accuracy. This example shows that fitting function a solid continuous representation of given discrete distribution.
Algorithms 15 00057 g011
Figure 12. Fitting same discrete sample of 201 uniformly selected datapoints from sine function over 0 ,   5 π with MATLAB rationalfit. Residual errors are significant over most of points in 0 ,   5 π .
Figure 12. Fitting same discrete sample of 201 uniformly selected datapoints from sine function over 0 ,   5 π with MATLAB rationalfit. Residual errors are significant over most of points in 0 ,   5 π .
Algorithms 15 00057 g012
Figure 13. Left graphs show fitting functions via null space method without scaling frequencies s to interval [0, 1]. Error plots on right side suggest failure to obtain an accurate curve fitting without scaling process.
Figure 13. Left graphs show fitting functions via null space method without scaling frequencies s to interval [0, 1]. Error plots on right side suggest failure to obtain an accurate curve fitting without scaling process.
Algorithms 15 00057 g013
Figure 14. Fitting a very large data set ( 10 6 + 1 ) sampled from sine function with accuracy that is comparable with samples in hundreds in size, as lower error plot shows. It might be difficult to see fitting function in red on top plot at first look due to extreme small errors and high number of data represented by blue dots.
Figure 14. Fitting a very large data set ( 10 6 + 1 ) sampled from sine function with accuracy that is comparable with samples in hundreds in size, as lower error plot shows. It might be difficult to see fitting function in red on top plot at first look due to extreme small errors and high number of data represented by blue dots.
Algorithms 15 00057 g014
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Hoxha, I.; Meklachi, T. Data Fitting with Rational Functions: Scaled Null Space Method with Applications of Fitting Large Scale Shocks on Economic Variables and S-Parameters. Algorithms 2022, 15, 57. https://doi.org/10.3390/a15020057

AMA Style

Hoxha I, Meklachi T. Data Fitting with Rational Functions: Scaled Null Space Method with Applications of Fitting Large Scale Shocks on Economic Variables and S-Parameters. Algorithms. 2022; 15(2):57. https://doi.org/10.3390/a15020057

Chicago/Turabian Style

Hoxha, Indrit, and Taoufik Meklachi. 2022. "Data Fitting with Rational Functions: Scaled Null Space Method with Applications of Fitting Large Scale Shocks on Economic Variables and S-Parameters" Algorithms 15, no. 2: 57. https://doi.org/10.3390/a15020057

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop