0
votes

I have a set of data and I would like to fit a power law function given as

y=a*x**b

Using gnuplot. and I have errors for both x and y directions and I don't know how I fit the function regarding both errors. I used gnuplot to do the fit but doesn't look like promising plus I can not use the error information.

I know fit with Gnuplot by only (y) error, but I don’t know with both errors (x and y).

f(x)=log10(a)+b*(x)   # for fitting 

fit f(x) "file name" using 1:2:3 via a, b
1
Fitting using x and y error will be possible in the 5.0 version, of which currently RC3 was released. - Christoph

1 Answers

0
votes

The answer is: It is not possible to use x and y errors.

The reason is that gnuplot uses the method of least chi-square. This means:

  1. For each (x|y) point of your data, calculate (y-f(x))
  2. Divide by y-error (if given)
  3. square the value
  4. sum up the values for all datapoints. This is the chi-square
  5. alter the parameters of the function and re-calculate the chi-square
  6. repeat, until a minimum of chi-square is found.

This method does not include an x-error, and there are no other methods implemented in gnuplot.

If applicable, you may swap x and y values of your data and so use the error of the former x-value for fitting. But this can not be used always and also treats only one error.