I am trying to fit some data using higher order polynomials. The data has 15000 points with ranges as below:
X (independent): Min Value = 100000, Max Value = 6000000
Y (dependent): Min Val = 150,000, Max Val = 560,000
I am using the GELS least squares driver (SVD method). For the coefficient matrix, I am scaling each value by the respective column average. I still calculate x^20 for all x observations, then calculate the average and then scale the column values.
For a polynomial of order 20, I get results from the code and these values differ starting at 2nd or 3rd decimal place, as compared to values obtained using a commercially available statistical analysis software, which give more accurate predictions.
How can I improve the accuracy of the least squres fit? I see the following issues, but havent found a solution yet:
1. When I calculate the powers (x^16, x^17...etc), for the coefficient matrix, there may be some precision issues.
2. Is my scaling correct? Or should I use something like ( x - mean_x)/ (stddev_x) [ I just found this via Google]. In this case, how do I get the correct coefficients back?
Thank you for your advice.