Chi-Square Test
[A, B] = CHI2TEST(DATA, N, ALPHA, DIST, X, Y, Z) returns the chi-square statistic for the samples contained in the row vector DATA.
N specifies the number of equal-probability class intervals for the test. ALPHA is the confidence level parameter used to find the critical chi-square value.
DIST is a string containing the probability distribution that we are testing against. See the staitsctics toolbox for supported distributions - 'exp', 'gam', 'unif' are some of them.
X, Y, and Z specify the estimated parameters for the selected DIST. Some distributions require only one of these parameters, and the order that these parameters are provided follows the values given to the cummulative distribution functions UNIFCDF, GAMCDF, EXPCDF, and others.
A is the computed chi-square statistic, and B is the critical tabulated value at the degrees of freedom. The degree of freedom is the number of intervals minus the number of estimated parameters.
In general, if A is less than B, the H0 hypothesis that DATA follows the DIST distribution is accepted.
An attempt to fit some data with the uniform distribution on the interval from 1.5 to 2.9. The test fails, since A > B:
[a, b] = chi2test (data, 10, 0.05, 'unif', 1.5, 2.9)
a =
38.7500
b =
14.0671
See also MLE, CHI2INV, CHI2STAT, HIST, CDF, ICDF, PDF
引用格式
Leonardo Salomone (2025). Chi-Square Test (https://ww2.mathworks.cn/matlabcentral/fileexchange/4779-chi-square-test), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
- AI and Statistics > Statistics and Machine Learning Toolbox > Probability Distributions and Hypothesis Tests > Hypothesis Tests >
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!| 版本 | 已发布 | 发行说明 | |
|---|---|---|---|
| 1.0.0.0 |
