Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13638 > unrolled thread

"Error" definition for nonlinear fit deviating from data points

Started bymax.ulbrich@bioss.uni-freiburg.de
First post2013-02-28 04:43 +0000
Last post2013-03-02 08:44 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  "Error" definition for nonlinear fit deviating from data points max.ulbrich@bioss.uni-freiburg.de - 2013-02-28 04:43 +0000
    Re: "Error" definition for nonlinear fit deviating from data points craigloehle@gmail.com - 2013-03-02 08:44 +0000

#13638 — "Error" definition for nonlinear fit deviating from data points

Frommax.ulbrich@bioss.uni-freiburg.de
Date2013-02-28 04:43 +0000
Subject"Error" definition for nonlinear fit deviating from data points
Message-ID<kgmn8s$8he$1@smc.vnet.net>
Hello,

I am doing a fit to a series of data points with NonlinearModelFit. The fit works well but the fitted function does not exactly match the data. Now the standard error from the parameter confidence interval table is very small, which I understand.

A simple example:

data = Table[{x, x + Sin[x]}, {x, 0, 30, 0.01}];
nlf = NonlinearModelFit[data, a*x, a, x];
bf = a*x /. nlf["BestFitParameters"];
Show[Plot[bf, {x, 0, 30}], ListPlot[data]]
nlf[{"ParameterConfidenceIntervalTable"}]

The last result shows a standard error of 0.00075, but the plot shows that the fit and the data deviate a lot. Is there a measure that reflects how the fit deviates from the data? Can this also be expressed as some type of "error" in the parameter estimate?
I.e. is there a way to write a = 1.0 +- xxx where x reflects the deviation of fit and curve?

Thanks a lot for your help,

Max

[toc] | [next] | [standalone]


#13678

Fromcraigloehle@gmail.com
Date2013-03-02 08:44 +0000
Message-ID<kgse5h$jb4$1@smc.vnet.net>
In reply to#13638
On Wednesday, February 27, 2013 10:43:08 PM UTC-6, max.u...@bioss.uni-freiburg.de wrote:
> Hello,
>
>
>
> I am doing a fit to a series of data points with NonlinearModelFit. The fit works well but the fitted function does not exactly match the data. Now the standard error from the parameter confidence interval table is very small, which I understand.
>
>
>
> A simple example:
>
>
>
> data = Table[{x, x + Sin[x]}, {x, 0, 30, 0.01}];
>
> nlf = NonlinearModelFit[data, a*x, a, x];
>
> bf = a*x /. nlf["BestFitParameters"];
>
> Show[Plot[bf, {x, 0, 30}], ListPlot[data]]
>
> nlf[{"ParameterConfidenceIntervalTable"}]
>
>
>
> The last result shows a standard error of 0.00075, but the plot shows that the fit and the data deviate a lot. Is there a measure that reflects how the fit deviates from the data? Can this also be expressed as some type of "error" in the parameter estimate?
>
> I.e. is there a way to write a = 1.0 +- xxx where x reflects the deviation of fit and curve?
>
>
>
> Thanks a lot for your help,
>
>
>
> Max

The value of the fit you see is not the fit of the curve to the data but the error estimate of the parameter a which is constrained quite tightly by the sin wave.  The fit of the curve is obtained with nlf[{"RSquared"}] in your example.
Craig Loehle

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web