public class ChiSquareIndependenceTest extends HypothesisTest
| Modifier and Type | Class and Description |
|---|---|
static class |
ChiSquareIndependenceTest.Type
the available distributions used for the test
|
| Constructor and Description |
|---|
ChiSquareIndependenceTest(Matrix sample)
Assess whether the two random variables in the contingency table are independent.
|
ChiSquareIndependenceTest(Matrix sample,
int nSims,
ChiSquareIndependenceTest.Type type)
Assess whether the two random variables in the contingency table are independent.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAlternativeHypothesis()
Get the 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.
|
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.
|
double |
pValue()
Get the p-value for the test statistics.
|
double |
statistics()
Get the test statistics.
|
isNullRejected, nGroups, nObs, oneSidedPvaluepublic ChiSquareIndependenceTest(Matrix sample, int nSims, ChiSquareIndependenceTest.Type type)
sample - a contingency tablenSims - the number of simulations when EXACT distribution is usedtype - the type of distributionpublic ChiSquareIndependenceTest(Matrix sample)
sample - a contingency tablepublic String getNullHypothesis()
HypothesisTestgetNullHypothesis in class HypothesisTestpublic String getAlternativeHypothesis()
HypothesisTestgetAlternativeHypothesis in class HypothesisTestpublic double statistics()
HypothesisTeststatistics in class HypothesisTestpublic double pValue()
HypothesisTestpValue in class HypothesisTestpublic static Matrix getExpectedContingencyTable(int[] rowSums, int[] colSums)
rowSums - the row totalscolSums - the 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 statisticsCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.