I'm sure there's a simple answer to this, but I'm stuck. I have a small set of that data that I am doing a polynomial fit on (data below). When I run (m=4):
Code:
alglib.polynomialfit(x, y, m, out info, out p, out rep);
alglib.polynomialbar2pow(p, out coeffs);
I get the results I am anticipating: {25.426138,0.092663,-0.000658,0.000001}
I would like to be able to weight this data, but when I run the polynomialfitwc function, I get different results. I set all w=1 (an array of equal length to x where all elements =1), and:
Code:
double[] xc = new double[] { 0 }; //constraints = 0
double[] yc = new double[] { 0 };
int[] dc = new int[] { 0 };
These settings give me the following coefficients: {0.000000,1.116681,-0.011579,0.000035}
What am I doing wrong? I'd like to set up the wc function so it returns that same as polynomialfit() if the weights are 1.
Thanks in advance. This package is really impressive.
Data:
X_1 Y_1
6 26
28 27.5
50 28.4
69 29.35
93 29.4
116 29.35
137 29.15
158 28.82
180 28.5