3
$\begingroup$

I have some data:

x={1,2,3,4,5,6,7,8,9,10}
y={3.05,21.05,69.05,162.05,315.05,543.05,861.05,1284.05,1827.05,2505.05}

That I plot with ListPlot. I have two functions that I would like to check which one of them best fits my data. The functions are:

f1[x_]:=0.5 x + (4/2) x^3
f2[x_]:=0.5 x + (5/2) x^3 + 80

and I plot them along with data points that I have I get a plot: enter image description here

Function f2 is plotted red, and function f1 is plotted blue. Function f2 is seems to be the best fit to data points, but is there a way in which I can in Mathematica check this, not by using something like FindFit or NonlinearModelFit, but instead calculating say distances between points and plots and see which function gets data points closer to it. Is this a correct way of thinking about fitting? Is there a code that allows checking how close are data points to some model function, or two of them or even more?

$\endgroup$
  • 1
    $\begingroup$ The answer will depend on the error bars. Are they the same for all data points? Or are they proportional to the values? Or something else? $\endgroup$ – Roman Jul 8 at 12:34
4
$\begingroup$

One possible way is to use RootMeanSquare on errors when f1 /@ x and f2 /@ x are used as predictions for y:

RootMeanSquare /@ {f1 /@ x - y, f2 /@ x - y}

{222.43, 79.95}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.