Plot Linear Fit w/ Error Bounds: y=ax+b

  • Context: Undergrad 
  • Thread starter Thread starter kelly0303
  • Start date Start date
  • Tags Tags
    Errors Fit Linear
Click For Summary

Discussion Overview

The discussion revolves around plotting a linear fit of the form ##y=ax+b## with error bounds reflecting the uncertainty in the parameters obtained from the fit. Participants explore how to represent these error bounds graphically, particularly in the context of confidence bands and prediction intervals.

Discussion Character

  • Exploratory, Technical explanation, Conceptual clarification, Debate/contested

Main Points Raised

  • One participant seeks guidance on how to plot upper and lower lines for a 1 sigma band around the linear fit, indicating uncertainty in the parameters.
  • Another participant suggests that the curved band may represent a 95% prediction band, which reflects the confidence that the true line lies within this band.
  • A further explanation is provided using an analogy involving Ohm's Law, where the curved band represents potential variations in the line due to measurement uncertainties.
  • There is a mention of hypothesis testing during regression analysis that yields confidence intervals for the slope and intercept, with a question raised about the potential use of Bayesian methods versus frequentist approaches.

Areas of Agreement / Disagreement

Participants express differing views on the nature of the error bounds, with some proposing a 95% prediction band while others discuss confidence intervals from regression analysis. The discussion remains unresolved regarding the specific formulas and methods to use for plotting the error bounds.

Contextual Notes

Participants reference different statistical approaches (frequentist vs. Bayesian) and the implications of these methods on the interpretation of error bounds, but do not resolve the differences in methodology or application.

Who May Find This Useful

This discussion may be useful for individuals interested in statistical modeling, data analysis, and graphical representation of uncertainty in linear regression contexts.

kelly0303
Messages
573
Reaction score
33
Hello! I made a linear fit, ##y=ax+b##, to some data points and I get the best parameters with their (1 sigma) errors: ##a\pm\delta a## and ##b\pm\delta b##. I want to plot this fit on top of my data points in such a way as to reflect the error on the parameters. The "main" fit is simply ##y=ax+b## with the parameters obtained from the fit, but I would like 2 more lines as un upper and limit to that (like a 1 sigma band). What formula should I use for the upper and lower lines associated to the boundaries of this band? Thank you! (I would like something like this, although I am not sure why their band is curved)
 
Physics news on Phys.org
I believe that the curved band is a 95% prediction band. This is telling us we are 95% confident that the true line that the data came from, lies in the band. Imagine you can pivot the band a little bit and you'll understand why it is curved.

I believe it can be produced using the R statistical software (available as a free download). Take a look at this from stackexchange - https://stats.stackexchange.com/que...tion-of-confidence-bands-in-linear-regression

If you are unfamiliar with R, then I suggest taking a look at Swirl, a free site that helps you to get it downloaded and has some nice tutorials. https://swirlstats.com/students.html
 
  • Like
Likes   Reactions: FactChecker
Think about you hook up a voltage source to a resistor, and you measure current. From Ohm's Law, we expect a straight line. The slope of the line represents the resistance. But due to factors such as temperature, noise, accuracy of your measuring equipment, you get dots which are not collinear. So you do regression and get the best fit line. The curved band would represent other places that the line might actually lie (with 95% confidence) for this resistor, based on the data measurements.
 
Usually during your regression analysis you do your hypothesis tests which give you confidence intervals for both the intercept and the slope. I believe these are used, at least in/with the frequentist approach. Are you maybe using a Bayesian approach?
 

Similar threads

Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 28 ·
Replies
28
Views
3K
  • · Replies 26 ·
Replies
26
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K