# Calculating uncertainty using the least squares method.

#### rushton

Can someone point me in the right direction or give me a rundown on how to use the least squares method in calculating the uncertainty in a gradient of a graph?

We have been given a theoretical experiment with data and so on supplied and we need to find the uncertainty of the graph we have been asked to draw.

The two ways we have been asked to do this is either by figuring out the max and min gradients and use these or by the least squares method.

I would just like to learn how to do this. The link they have supplied us to learn this is not active so I thought I might ask here for some guidance.

Many thanks.

Ryan

Related Introductory Physics Homework News on Phys.org

#### danielakkerma

Hello there, welcome to the forum!
As you probably know, the Least square-methodologies are used exclusively for data-fitting.
The first step, for us to help you probably, would be to provide the data set(in the form of list plotting(i.e dot by dot representation)), so that we could point in the proper track.
Next, and this more of an exercise for you, try "guessing" what's the appropriate function/model that could describe the dispersion you see on the scatter plot.
Then, you can conduct the analysis required(weighted or not, is your choice), by following the instructions here, and, the Internet is teeming, generally with various tutorials and advice on the matter.
What I would suggest personally, is not doing this manually. During the course of my studies/research/work, despite my enthusiasm for it, I've learned the hard-way that doing something so loaded with arithmatic is prone to errors, and is very risky given the need to round figures on occasion, which carries penalties of its own.
There are plenty of statistical software that can do this accurately for you; I'd recommend QTIplot(for free usage and viablity), Origin, Mathematica, all of these are great devices.
I hope I've guided you in the proper direction,
Daniel
P.S
You might like to look into this:
http://en.wikipedia.org/wiki/Least_squares_method#Solving_the_least_squares_problem"
And if I recall, at least from my experience no one has been doing this sort of thing by hand since the 60's. Data sets are typically very large, and require extensive manipulation.

Last edited by a moderator:

#### rushton

Yeah I was going to try it manually as I figured thats what our lectures would expect but it makes sense that we should use software to do it.
That helped a great deal, I have read the wiki page but it seemed too complex a lot of it for such a simple 1st year physics experiment. I will have a closer read anyways and get the software you have recommended.
Thanks!!!

#### rushton

Can anyone recommend a free mac version for students?

#### danielakkerma

Hi there,
First of all, I am glad we're of the same opinion with respect to the execution of the whole thing :).
As far as am I aware, Qtiplot is available for Macs but it's not free :((unlike for linux users, where it comes as a precompiled package).
Excel, in its variants, including in OpenOffice, is capable of doing some statistical analysis of your desired ilk. Try it...
Daniel

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving