Hello!
I'm really happy with how easy it seems to be to make nonlinear model fits using your library!
However, when I tried to compare the precision to "handmade" calibration for a few datapoints, I noticed that I don't get any parameter-errors! The covariance-matrix is also filled with 0. The state is 2, though, and the returned parameters seem to be nice.
I noticed this appears especially, if in theory I have more of a linear equation system than a fit: e.g. 3 points and 3 parameters.
However, the real solution is that one parameter is not contributing to the function-value!
e.g. I have datapoints like
Code:
real_2d_array x=[[1,0],[2,0],[3,0]];
real_1d_array y=[0,2.01,4];
real_1d_array c=[1,1,0];
real_1d_array cu=[1e8,1e8,0];
real_1d_array cd=[-1e8,1e8,0];
cu and cd are constraints to make the last parameter fixed.
Then I use your libary like in he examples:
Code:
double epsf = 0;
double epsx = 1e-10;
ae_int_t maxits = 0;
ae_int_t info;
lsfitstate state;
lsfitreport rep;
double diffstep = 1e-7;
int differentturns=0;
lsfitcreatef(x, y, c, diffstep, state);
lsfitsetcond(state, epsf, epsx, maxits);
lsfitsetbc(state, cd, cu);
alglib::lsfitfit(state, function_cx_1_func);
lsfitresults(state, info, c, rep);
with the function
Code:
void function_cx_1_func(const real_1d_array &c, const real_1d_array &x, double &func, void *ptr)
{
func = c[0]*pow(x[0]+c[1],2)/pow(1+c[2]*x[1],2);
}
As you can see, the solution would be c=[2,1,0].
This is also working, but rep.errpar[0] and so on is 0.
But how can it be 0 if there are 3 datapoints and effectively only 2 parameters to fit?
If I would add another datapoint, I would be given a parameter-error.
The only solution I currently see would be analyzing the data before fitting and reformatting x and c in case all x[i][1] would be 0.
But what would happen, if another parameter would get 0? I guess I won't get parameter-errors then either...
Is there anything I missed when using the alglib library or is this even a mathematical problem I'm not aware of? ^^