How to calculate uncertainty of linear regression slope based on data uncertainty (possibly in Excel/Mathematica)?
Example:
Let's have data points (0,0), (1,2), (2,4), (3,6), (4,8), ... (8, 16), but each y value has an uncertainty of 4. Most functions I found would calculate the uncertainty as 0, as the points perfectly match the function y=2x. But, as shown on the picture, y=x/2 match the points as well. It's an exaggerated example, but I hope it shows what I need.
EDIT: If I try to explain a bit more, while every point in example has a certain value of y, we pretend we don't know if it's true. For example the first point (0,0) could actually be (0,6) or (0,-6) or anything in between. I'm asking if there is an algorithm in any of the popular problems that takes this in account. In the example the points (0,6), (1,6.5), (2,7), (3,7.5), (4,8), ... (8, 10) still fall in the uncertainty range, so they might be the right points and the line that connects those points has an equation: y = x/2 + 6, while the equation we get from not factoring in the uncertainties has equation: y=2x + 0. So uncertainty of k is 1,5 and of n is 6.
TL;DR: In the picture, there is a line y=2x that's calculated using least square fit and it fits the data perfectly. I'm trying to find how much k and n in y=kx + n can change but still fit the data if we know uncertainty in y values. In my example, uncertainty of k is 1.5 and in n it's 6. In the image there is the 'best' fit line and a line that just barely fits the points.


Generally they aren't constant, but a solution that requires them to be constant would be fine as well, I tried fitting with linearfit, fit, findfit in mathematica and linest (and a custom function that I found that weights values by uncertainties) in excel.
– bedanec Sep 21 '13 at 00:42Fast example: Let's say real weights are 11.63, 23.267, 34.9. But our bad scale can only show with +-5 accuracy, so it shows 10, 20, 30. (Volumes are 1V0, 2V0, 3*V0). If we try to fit with a program, it will show density of 10/V0 and 0 error. But the real value is 11.7.
– bedanec Sep 22 '13 at 21:58