# How to do a chi squared test on a linear fit

1. Nov 23, 2013

### Stickybees

I'm getting a bit confused with the stats of a chi squared test, everyone in physics labs seems to use this as a test but I don't know why it's appropriate?

My main question is how would I take a linear equation in say excel which has been fitted to a series of (x,y) data points (I do have the errors for each point but excel doesn't use this) and fit use a chi squared test on this? (excel gives me an R2 value)

I have tried to find programs to do this automatically but none seem to be free.

Thanks for any help!

2. Nov 23, 2013

### chiro

Hey Stickybees.

You need to tell us the test statistic you are using (in terms or your data) as well as the hypothesis you are testing. Without these things there is bound to be some ambiguity in what you are talking about.

3. Nov 24, 2013

### Stephen Tashi

As chiro suggests, you have to say exactly what you are trying to accomplish. The phrase "Chi square test" by itself doesn't describe a goal. If you want to do what other people are doing, ask some of them about it. Find out the name of the software they are using - the documentation of the software might be available online, even if you can't get the software.

A "Pearsons" Chi square statistic is used to quantify the probability of some observed data under the assumption that it comes from some given distribution. If you want to use that test, you must specify what the data is and what the distribution is. A common assumption in fitting a straight line to data is that the "errors" or "residuals" in the y-values of the data are distributed as independent samples from a normal distribution distribution. Is that the assumption you wish to test?