How do I find a good fit

I have the following data set: A plot of it looks like this:
This looks, to an untrained observer like a slightly-smaller-than a semicircle, but trying to fit this using NonlinearModelFit[] produces fairly junky output $$\sqrt{715787.\, -1.40519 (x-1742.99)^2}+1875.84$$ Any ideas for how to do this better?

Replay

Using

(x - a)^2/b^2 + (y - c)^2/d^2 == 1

for the equation of an ellipse (as at least 4 parameters are needed for approximating this data) the following code provides an approximation to the data:

nlm = NonlinearModelFit[data, c + (d Sqrt[-a^2 + b^2 + 2 a x - x^2])/b,
{{a, 128}, {b, 128}, {c, 0}, {d, 126}}, x]
Show[ListPlot[data], Plot[nlm[x], {x, 1, 256}, PlotStyle -> Red]]
nlm["BestFitParameters"] // Normal
(* {a -> 128., b -> 135.977, c -> -54.5663, d -> 176.943} *)

However (and this might just be a semantics issue) I'm calling this an "approximation" to the data rather than a "fit" in that there really is no random error and apparent features of the data are ignored in the approximation. But it is a subject matter decision as to whether the approximation is good enough. I certainly wouldn't take the standard errors of the parameter estimates seriously.

To help decide on whether the approximation is good enough plotting the residuals vs. the predictor variable can be informative as to the size of the approximation error and if there are any patterns that might be eliminated with a more complex prediction function.

ListPlot[nlm["FitResiduals"], Joined -> True]

Category: fitting Time: 2016-07-29 Views: 0
Tags: fitting