# How to determine best fit from two?

I'm studying some variances ($\sigma^2$), that in my case, they must depend by velocity squared $v^2$.

So, in my experimental proofs, I have plotted a graph of $\sigma^2/v^2$, and I was hoping to find a horizontal line.

But, my data seem to be constants in $\sigma^2/v$, and now I find myself in times of trouble: I have to choose which one is the best fit.

In each cases ($\sigma^2/v^2$ or $\sigma^2/v$), I obtain a nearly straight line.

So, I look the equation of best fit lines as $y = mx +q$, where $m$ is his angular coefficient.

The angular coefficient $m$ is less, in the case of $\sigma^2/v^2$ (by about an order of magnitude), but in the case of $\sigma^2/v$, the range of the best fit line (from its maximum and minimum in the graph) is relatively more lower.

At this point, to choose the best fit, the best solution is:

• Choose the case where $m$ is lower.
• Or I have to choose the dynamic case (maximum value minus minimum value), where the best fit line is more flat in the graph (not by absolute value)?

Here are an example: in the first graph $m$ is greater (see the equation in the plot), but the line varies of 0.01.

In the second case $m$ is lower, but the line varies of 0.15.

What is the best fit? The first or the second?

EDIT

For Matt L. - Your approximation error $e$ is very similar to the $R^2$ parameter, that I define so (now I use your notation):

$$R^2 = 1 - \frac{\sum_i \left[d_i-f(v_i)\right]^2}{\sum_i \left[d_i-\overline{d_i}\right]^2}$$,

where $\overline{d_i}$ is the average value of $d_i$.

Maybe you would like say that I must simply see where I have the minimum error $e$ or the best fit parameter, e.g. $R^2$.

• I'm afraid that hardly anybody will be able to understand your question due to lack of context. E.g., what is $v$? And please note that "angular coefficient $m$" is probably an Italianism, and most people (including myself) do not know what it means. – Matt L. Feb 12 '15 at 8:51
• @MattL. You have completely reason. Now I rewrite my question, and sorry my poor English. – Giacomo Alessandroni Feb 12 '15 at 9:18

It looks like a straight line is not a great approximation in either case. One thing which is unclear to me is that the y-axis in the top plot is $\sigma^2/v$ whereas in the second plot it is just $\sigma^2$ (as far as I can see), and not $\sigma^2/v^2$ as I expected.

What you need to figure out is what you should actually expect. When you say that $\sigma^2$ should depend on $v^2$ then this doesn't say much. From what you do it looks like that you expect those two quantities to be proportional:

$$\sigma^2=\alpha v^2$$

because then you would ideally have a constant ratio $\sigma^2/v^2$. Is this the case?

Note that if you model $\sigma^2/v$ as a linear function of $v$, then you have

$$\sigma^2/v=mv+q$$

which is equivalent to

$$\sigma^2=mv^2+qv$$

So you actually model $\sigma^2$ by a quadratic function of the variable $v$.

To determine the best fit, it seems natural to compare the normalized approximation errors of the different fits. Given that $d_i$ are your measured data points, and $v_i$ are the discrete velocities corresponding to the data $d_i$, the approximation error can be defined as

$$\epsilon=\frac{\sum_i \left[d_i-f(v_i)\right]^2}{\sum_id_i^2}$$

where $f(v)$ is the approximation function, which could be linear as you've suggested in your question, i.e. $f(v)=mv+q$.

• Sorry, I am reading. In the second graph I plot $\sigma^2 / v^2$. – Giacomo Alessandroni Feb 12 '15 at 11:23
• Of course, if $\sigma^2\propto v^2$ then $\sigma^2/v\propto v$, and $\sigma^2/v^2\propto constant$. This is what I would like demonstrate. But the question is: if I use a poly1 interpolation in the second and third case, I aspect a more flat line in the third case. If I look angular coefficient this is right. And, if I look max - min of the interpolation line this is wrong. Your approximation error is a good idea but... I have to persuade my supervisor, that look the graphs and has a thought different from mine. – Giacomo Alessandroni Feb 12 '15 at 12:13
• In the given range of $v$, the lower line varies by about $1.5\times 10^{-4}$, and not by $1.5$ as you thought! So the variation is of course much smaller than in the top plot (note the $\times 10^{-3}$ on the y-axis of the bottom plot). This is of course obvious from the smaller $m$-value: the variation must be $m\cdot (40-26)=14m$. – Matt L. Feb 12 '15 at 13:22
• Even I think so. But my supervisor say me: "do not look the order of magnitude". At this point I can only accept your answer and tell you thank you for your help. – Giacomo Alessandroni Feb 12 '15 at 14:37