How to do a chi squared test on a linear fit

In summary, the conversation discussed the confusion around the use of a chi squared test in physics labs and the question of its appropriateness. The person asking the question is curious about using a linear equation in Excel and fitting it to a series of data points, but is unsure how to incorporate the errors for each point and use a chi squared test. They have also searched for programs to automate this process, but have not found any that are free. In order to use a chi squared test, they need to specify the test statistic and the hypothesis they are testing, as well as the data and distribution assumptions.
  • #1
Stickybees
36
0
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!
 
Physics news on Phys.org
  • #2
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
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?
 

FAQ: How to do a chi squared test on a linear fit

What is a chi squared test on a linear fit?

A chi squared test on a linear fit is a statistical method used to determine the goodness of fit of a linear regression model. It measures the difference between the observed data and the expected data from the linear regression model.

When should a chi squared test be used for a linear fit?

A chi squared test should be used for a linear fit when there is a linear relationship between the independent and dependent variables and the data follows a normal distribution.

How is a chi squared test calculated for a linear fit?

The chi squared test for a linear fit is calculated by finding the sum of the squared differences between the observed data and the expected data from the linear regression model, divided by the expected data. This value is then compared to a critical value from a chi squared table to determine the significance of the fit.

What does a significant chi squared test result indicate for a linear fit?

A significant chi squared test result for a linear fit indicates that the linear regression model does not accurately fit the observed data. This could be due to a non-linear relationship between the variables or a violation of the assumptions of the test.

Can a chi squared test be used for non-linear regression models?

No, a chi squared test is only suitable for linear regression models. For non-linear regression models, other tests such as the F-test or the coefficient of determination (R-squared) should be used to assess the goodness of fit.

Similar threads

Replies
7
Views
304
Replies
1
Views
1K
Replies
8
Views
2K
Replies
1
Views
1K
Replies
7
Views
2K
Replies
26
Views
2K
Back
Top