public class ChiSquare4Independence extends HypothesisTest
| Modifier and Type | Class and Description |
|---|---|
static class |
ChiSquare4Independence.Type
the distribution used for the test
|
k, N, pValue, testStatistics| Constructor and Description |
|---|
ChiSquare4Independence(Matrix sample)
Assess whether the two random variable in the contingency table is independent.
|
ChiSquare4Independence(Matrix sample,
int nSim,
ChiSquare4Independence.Type type)
Assess whether the two random variable in the contingency table is independent.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAlternativeHypothesis()
Get a description of the alternative hypothesis.
|
static Matrix |
getExpectedContingencyTable(int[] rowSums,
int[] colSums)
Assume the null hypothesis of independence, we compute the expected frequency of each category.
|
java.lang.String |
getNullHypothesis()
Get a description of the null hypothesis.
|
static double |
pearsonStat(Matrix O,
Matrix E,
boolean YatesContinuityCorrection)
Compute the Pearson's cumulative test statistic, which asymptotically approaches a χ2 distribution.
|
isNullRejected, oneSidedPvalue, pValue, statisticspublic ChiSquare4Independence(Matrix sample, int nSim, ChiSquare4Independence.Type type)
sample - a contingency tablenSim - number of simulation when EXACT distribution is usedtype - the type of distributionpublic ChiSquare4Independence(Matrix sample)
sample - a contingency tablepublic java.lang.String getNullHypothesis()
HypothesisTestgetNullHypothesis in class HypothesisTestpublic java.lang.String getAlternativeHypothesis()
HypothesisTestgetAlternativeHypothesis in class HypothesisTestpublic static Matrix getExpectedContingencyTable(int[] rowSums, int[] colSums)
rowSums - row totalscolSums - column totalspublic static double pearsonStat(Matrix O, Matrix E, boolean YatesContinuityCorrection)
O - the observation matrixE - the expectation matrixYatesContinuityCorrection - true if to minus 0.5 for each observation in the test statistics