Eckard Specht wrote:
> gnuplot comes up with a totally wrong regression line (i.e. a negative slope).
> If one scratches one data pair from list, the result is correct.
> I have read in 'help fit' that this misfit can occur if the magnitudes of both
> parameters a, b differ too much. This may be the case here.
Not if the parameters are this different, the default startup values of
1.0 three orders of magnitude from the goal, and, which is the worst
problem here, and the actual value for one of the fitted parameters (b)
is zero, which makes it uncontrollable by the fit:
fit m*x 'lreg3.dat' via m
gives a very nice fit already:
After 5 iterations the fit converged.
final sum of squares of residuals : 2.48482e-007
rel. change during last iteration : -6.69962e-012
degrees of freedom (ndf) : 5
rms of residuals (stdfit) = sqrt(WSSR/ndf) : 0.000222927
variance of residuals (reduced chisquare) = WSSR/ndf : 4.96965e-008
Final set of parameters Asymptotic Standard Error
m = 6.62853e-007 +/- 1.134e-010 (0.01711%)
So the actual result is b=0, which means the magnitude ratio of the
parameters is *infinite*. That will indeed throw off the fit.
> But a simple linear fit should always work. Or not?
Not. It has a higher chance of success, but no guarantee.
> Is it true that the Marquardt-Levenberg algorithm is used for all fits?
> Must I provide 'good' starting values for a, b to get a correct result?
That, and a sensible model. Models in which parameters would fit zero