Linest Function in Excel

693 Views Asked by At

I have a linear fit as a result of some data and the fit gives me the value of the slope and the value of y-intercept. From this information, how do I calculate the uncertainty in slope and y-intercept? I looked at several resource and it was suggested that it is just the standard uncertainty in the slope between individual data points but that does not seem reasonable to me. The other method suggested was to calculate the best, maximum and minimum fit, given the error bars, and to calculate difference divided by 2. But this method seems very hand waving and not objective.

So my question is: Is there a better way to calculate the slope uncertainty and y-intercept?

Secondly, How does the Linest function in Excel calculates the uncertainty in slope and y-intercept?

1

There are 1 best solutions below

0
On BEST ANSWER

For a given best linear fit $ y=mx+c $ for $n$ data set $(x_i, y_i)$ which gives $m$ slope and $c$ y-intercept the errors in $m$ and $c$ can be calculated by the following equations,

$$ \text{Error in } m = \sqrt{\frac{\sum_{i=1}^{n} (y-y_i)^2}{n-2}} \times \sqrt{\frac{n}{n\sum_{i=1}^{n} x_i^2-(\sum_{i=1}^{n}x_i)^2}} \\ \text{Error in } c = \sqrt{\frac{\sum_{i=1}^{n} (y-y_i)^2}{n-2}} \times \sqrt{\frac{\sum_{i=1}^{n} x_i^2}{n\sum_{i=1}^{n} x_i^2-(\sum_{i=1}^{n}x_i)^2}} $$

This is how Linest function in Excel calculates the errors as I verified in my calculations. I was not able to understand, however, how these formulae are derived from the relations for $m$ and $c$ as calculated from least square routine. May be someone can shed some light on it.