# Homework Help: Uncertainty when using a line of best fit

1. Sep 21, 2004

### Soilwork

I was just wondering if somebody knows how you find the uncertainty of a value obtained from a line of best fit.
In my case I had to estimate the charge left on a capacitor, but to do this I had to integrate from t=120 to t=infinity using the exponential line of best fit.
I have no clue how to find the uncertainty of a value obtained using this method and was just hoping that someone could help me out.
Thanks for any help :)

2. Sep 21, 2004

### ZapperZ

Staff Emeritus
You neglected to describe HOW the best fit line was obtained. Did you draw it by hand, or did you use a fitting routine/package for this? If you did the latter, then the routine SHOULD also give you a quantity either called the "goodness of fit" or sometime an "R" value. Look it up. In many instances, the closer R is to "1", the better the fit. A "goodness of fit" value sometime gives you an average based on a least-square method. In this case, the smaller the average, the better the fit. Thus, it depends very much on what routine is being used.

If the routine or software you used did not give any of these numbers, I suggest you throw it out of the window, especially when even a cumbersome software like Excel has one.

Zz.

3. Sep 21, 2004

### Soilwork

I used excel and it does give you the R^2 value.
It's 0.999, but how would you find the uncertainty associated with a value obtained from a definite integral of that line?

4. Sep 21, 2004

### ZapperZ

Staff Emeritus
There are two different possible uncertainty here. First, if you found an analytic expression for the best-fit line, then if you did a definite integral analytically using that line, then there is no uncertainty associated with the answer when compared to the best-fit line. However, there is an overall uncertainty in the value of the integral since it is based on experimental data. This is more difficult to arrive at exactly and often, we only quote the percentage. So, since your best fit line has roughly 0.1% uncertainty, I would say that the value of your integral would carry roughly that order of magnitude of uncertainty.

Now, if you actually integrated the line NUMERICALLY (not sure why), or if you integrated the data numerically, then again, the software or the routine will spit out an error or uncertainty value.

Zz.

P.S. I should qualify the answer I gave above by saying that this is what *I* would do in the same situation if I'm trying to estimate the uncertainty based on a common practice of estimating such things. I can't say if this is what you are told or required to have based on class work or anything like that. In practice, a lot of these things are simply good guesstimates.

Zz.

Last edited: Sep 21, 2004
5. Sep 21, 2004

### Soilwork

Thanks a lot for your help.
I will estimate the uncertainty as the magnitude of the uncertainty in the line.
I really appreciate it :)

6. Feb 26, 2010

### memeluke

Yes, I am aware that I am committing a cultural taboo by posting on a dead forum (which, in my humble option, is an outmoded rule for today's search engine society), but I found this forum after doing a Google search while trying to find the answer to the exact same problem for a physics lab report and I want to share a really simple solution that you can do with Excel 2007 (that they clearly didn't have in 2004).

How to use the "Data Analysis- Regression Statistics" Feature in Excel 2007:

First to turn on the Analysis Toolpak (it's not on by default):
1) Go to the Microsoft Office button top left of your window.
2) Click on the "Excel Options" button on the bottom right of the menu window.
4) Click the "Go..." button
5) Check "Analysis Toolpak" if it's not already and hit "ok"

Now to use it:
1) Go to the data tab of Excel
2) Click on the newly appeared (if you just turned it on with the steps above) "Data Analysis" button in the 'Analysis' section of the toolbar
3) Select "Regression" from the tools list and click OK
4) Set your input Y and X Range
5) Adjust/select any other settings options you want
6) Click "OK"

A bunch of data will appear- it's lot of good data that you can use for projects in lots of different subjects, but what you're interested in is the X-variable coefficient (the slope of your best fit line) [in B18 if you opened the data in a new tab/workbook] AND the X-variable standard error (the "uncertainty" of the slope of the best fit line) [should be in C18 if you opened the data in a new tab/notebook]

Pretty easy, huh?
I know that it's too late for user Soilwork since he/she has probably already graduated, but I hope this helped anyone else that comes across this looking for the same same thing!

Last edited: Feb 26, 2010
7. Feb 26, 2010