How to run a chi-square test?
8 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Ilya
on 24 Oct 2012
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:
http://www.mathworks.com/help/stats/parametric-regression-basics.html http://www.mathworks.com/help/stats/linear-regression-1.html
Here is a section showing how to examine the model quality:
0 Comments
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!