3

There was an excellent answer to a similar question here but I'm interested in adapting it to plot fit results.

Specifically, if I have non-linear data that I'm attemting to fit with

 mm(x) = (V*x)/(x+Km)

 fit mm(x) "mm data.txt" u 1:2:3 via V,Km

which spits the result out in a 'fit' file. The results are the variables +/- their variance

Final set of parameters            Asymptotic Standard Error
=======================            ==========================
V               = 0.00544444       +/- 0.0001935    (3.554%)
Km              = 42.239           +/- 8.092        (19.16%)

Is it possible to plot the fitted data, the fit as a line, and a smooth, filled region whose bounaries are 2x the SE?

I was thinking I could simply create new data files by evaluating the fit function using (V+2*SEV, Km+2*SEKm) or (V-2*SEV, Km-2*SEKm) then plotting them as filled, smooth confidence bands as listed in the above answer but I would be interested to know if there's a more elegant way.

Community
  • 1
  • 1
Pentaquark
  • 53
  • 5

1 Answers1

1

I am not sure whether this feature is officially documented, but the file fit.c from the source distribution of Gnuplot reveals that the error estimates are available in terms of variables which are constructed by appending the suffix _err to the parameter name (more specifically, see, e.g., line 918 in the 5.0.5 release).

In your case, you could therefore do the fit and then directly use in subsequent plotting commands the variables V and Km for the parameter estimates as well as V_err and Km_err for the error estimates....

ewcz
  • 12,819
  • 1
  • 25
  • 47
  • 2
    Yes, this is documented, see `help fit`. In version 5 there is an option to enables/disable this `set fit errorvariables`. – Christoph Dec 12 '16 at 16:16
  • Ah, indeed, I must have missed that! By the way, the documentation states that "If activated by using `set fit errorvariables`" - however, it looks like it is enabled by default... – ewcz Dec 13 '16 at 11:08