How to run a chi-square test?

8 次查看(过去 30 天)
Wenlong
Wenlong 2012-10-24
Hi all,
I am trying to run a chi-square test on my data.
I have a vector of eigenvalues from PCA and they are ordering in descending order. I want to test the linear trend in the eigenvalue vector. However, the Matlab help says that the chi2gof just test the data is from the normal distribution.
So, my question is, is there any way to adapt chi2gof function in my test of linear trend? Or I should look for other functions?
Thank you very much.
Best wishes
Wenlong

回答(1 个)

Ilya
Ilya 2012-10-24
chi2gof tells you how closely the observed distribution resembles your theoretical guess. You don't have a distribution yet. To test for a linear trend, you can fit your data to a straight line by least squares.
Start by inspecting the fit visually. A formal test is often not necessary. If you need a formal test, you can assume, as is often done, that the residuals are normally distributed.
Here is doc on linear models:
Here is a section showing how to examine the model quality:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by