|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.stats.test.HypothesisTest
com.numericalmethod.suanshu.stats.test.distribution.pearson.ChiSquare4Independence
public class ChiSquare4Independence
Pearson's chi-square test of independence assesses whether paired observations on two variables, expressed in a contingency table, are independent of each other.
| Nested Class Summary | |
|---|---|
static class |
ChiSquare4Independence.Type
the distribution used for the test |
| Field Summary |
|---|
| Fields inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest |
|---|
k, N, pValue, testStatistics |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
java.lang.String |
alternativeHypothesis()
Get a description of the alternative hypothesis. |
static Matrix |
expectedContingencyTable(int[] rowSums,
int[] colSums)
Assume the null hypothesis of independence, we compute the expected frequency of each category. |
java.lang.String |
nullHypothesis()
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. |
| Methods inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest |
|---|
oneSidedPvalue, pValue, rejectNull, testStatistics |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public 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 table| Method Detail |
|---|
public java.lang.String nullHypothesis()
HypothesisTest
nullHypothesis in class HypothesisTestpublic java.lang.String alternativeHypothesis()
HypothesisTest
alternativeHypothesis in class HypothesisTest
public static Matrix expectedContingencyTable(int[] rowSums,
int[] colSums)
rowSums - row totalscolSums - column totals
public static double pearsonStat(Matrix O,
Matrix E,
boolean YatesContinuityCorrection)
O - the observation matrixE - the expectation matrixYatesContinuityCorrection - true iff to minus 0.5 for each observation in the test statistics
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||