Package smile.stat
Interface Hypothesis.chisq
- Enclosing interface:
Hypothesis
public static interface Hypothesis.chisq
Chi-square test.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ChiSqTest
test
(int[][] table) Given a two-dimensional contingency table in the form of an array of integers, returns Chi-square test for independence.static ChiSqTest
test
(int[] bins, double[] prob) One-sample chisq test.static ChiSqTest
test
(int[] bins, double[] prob, int constraints) One-sample chisq test.static ChiSqTest
test
(int[] bins1, int[] bins2) Two-sample chisq test.static ChiSqTest
test
(int[] bins1, int[] bins2, int constraints) Two-sample chisq test.
-
Method Details
-
test
One-sample chisq test. Given the array bins containing the observed numbers of events, and an array prob containing the expected probabilities of events, and given one constraint, a small value of p-value indicates a significant difference between the distributions.- Parameters:
bins
- the observed number of events.prob
- the expected probabilities of events.- Returns:
- the test results.
-
test
One-sample chisq test. Given the array bins containing the observed numbers of events, and an array prob containing the expected probabilities of events, and given the number of constraints (normally one), a small value of p-value indicates a significant difference between the distributions.- Parameters:
bins
- the observed number of events.prob
- the expected probabilities of events.constraints
- the constraints on the degree of freedom.- Returns:
- the test results.
-
test
Two-sample chisq test. Given the arrays bins1 and bins2, containing two sets of binned data, and given one constraint, a small value of p-value indicates a significant difference between the distributions.- Parameters:
bins1
- the observed number of events in first sample.bins2
- the observed number of events in second sample.- Returns:
- the test results.
-
test
Two-sample chisq test. Given the arrays bins1 and bins2, containing two sets of binned data, and given the number of constraints (normally one), a small value of p-value indicates a significant difference between the distributions.- Parameters:
bins1
- the observed number of events in first sample.bins2
- the observed number of events in second sample.constraints
- the constraints on the degree of freedom.- Returns:
- the test results.
-
test
Given a two-dimensional contingency table in the form of an array of integers, returns Chi-square test for independence. The rows of contingency table are labels by the values of one nominal variable, the columns are labels by the values of the other nominal variable, and whose entries are non-negative integers giving the number of observed events for each combination of row and column. Continuity correction will be applied when computing the test statistic for 2x2 tables: one half is subtracted from all |O-E| differences. The correlation coefficient is calculated as Cramer's V.- Parameters:
table
- the contingency table.- Returns:
- the test results.
-