Errors of the slope and intercept of a regression line

Click For Summary

Discussion Overview

The discussion revolves around calculating the errors in the slope and intercept of a regression line when dealing with data that has varying error bars on the y-values. Participants explore numerical methods and resources for addressing this issue, focusing on weighted least squares and alternative approaches to fitting lines.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Exploratory

Main Points Raised

  • One participant inquires about a numerical method to calculate the errors on the slope and intercept of a regression line that accounts for varying y-error bars.
  • Another participant suggests using weighted least squares, indicating that weights should be the inverse of the square of the errors in the y-values.
  • A participant expresses confusion about how to specifically calculate the slope error from the weighted least squares method and notes that the provided wiki entry lacks clarity.
  • References to literature, such as Bevington's "Data Reduction and Error Analysis in the Physical Sciences" and "Numerical Recipes in C," are provided as resources for understanding error calculations in fitting parameters.
  • Another source is mentioned, which includes equations for standard errors in the slope and intercept, found on MathWorld.
  • An alternative approach is proposed, suggesting the drawing of lines of best fit that represent the maximum and minimum possible slopes, although this method is noted to be less rigorous.

Areas of Agreement / Disagreement

Participants express varying levels of understanding and clarity regarding the calculation of slope errors, with no consensus on a single method or approach. Multiple viewpoints on how to handle the problem remain present.

Contextual Notes

Some participants highlight limitations in the clarity of existing resources and the potential for confusion in applying the weighted least squares method. The discussion reflects a range of assumptions about the data and methods used.

h_userd23
Messages
3
Reaction score
0
I have set of date with error bars of different length on my y values. I want to know what the error is on the slope and intercept of my line of best fit through this data. Is there a numerical way to calculate this that takes into account the fit of the regression line and the y error bars?
 
Physics news on Phys.org
h_userd23 said:
I have set of date with error bars of different length on my y values. I want to know what the error is on the slope and intercept of my line of best fit through this data. Is there a numerical way to calculate this that takes into account the fit of the regression line and the y error bars?

See: http://en.wikipedia.org/wiki/Weighted_least_squares#Weighted_least_squares

Weights are 1/(error)^2, where "error" is the uncertainty in the y-value
 
Thanks for the response, but how do you calculate the slope error from that?
 
h_userd23 said:
Thanks for the response, but how do you calculate the slope error from that?

The wiki entry is not very clear.

If you can pick up a copy of Bevington, "Data Reduction and Error Analysis in the Physical Sciences" there is a very nice discussion of calculating the errors on the fitting parameters for least-squares with weights. Another source is Press, Teukolsy, Vetterling and Flannery, "Numerical Recipes in C".

Look at http://mathworld.wolfram.com/LeastSquaresFitting.html for another discussion of this. (Eqs. 34, 35) give equations for the standard errors in the slope and intercept.
 
An alternative approach which may be acceptable is to draw lines of 'best fit' that have the maximum and minimum possible value for the slope. Although this is not as rigorous as the method shown in the post above it is an easy alternative (especially if you also have uncertainty in the independent variable). For example, take the first and last data points on the graph and draw the line which just nicks the error bars to form the greatest and least slope. You can show these as dotted lines on the graph as well.
 
Thanks everyone this has been a great help!
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
8K
  • · Replies 30 ·
2
Replies
30
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K