This implementation handles both known and unknown distributions.
Two samples tests can be used when the distribution is unknown a priori but provided by one sample, or when the hypothesis under test is that the two samples come from the same underlying distribution.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | checkArray(final long[][]
input 2-way table to check in)Checks to make sure that the input long[][] array is rectangular, has at least 2 rows and 2 columns, and has all non-negative entries. |
| public double | Returns: chiSquare test statisticarray of expected frequency counts expected, final long[] array of observed frequency counts observed)Computes the
Chi-Square statistic comparing |
| public double | Returns: chiSquare test statisticarray representation of 2-way table counts)Computes the Chi-Square statistic associated with a
chi-square test of independence based on the input |
| public double | Returns: chiSquare test statisticarray of observed frequency counts of the first data set observed1, long[] array of observed frequency counts of the second data set observed2)Computes a
Chi-Square two sample test statistic comparing bin frequency counts
in |
| public double | Returns: p-valuearray of expected frequency counts expected, final long[] array of observed frequency counts observed)Returns the observed significance level, or
p-value, associated with a
Chi-square goodness of fit test comparing the |
| public boolean | Returns: true iff null hypothesis can be rejected with confidence 1 - alphaarray of expected frequency counts expected, final long[] array of observed frequency counts observed, final double significance level of the test alpha)Performs a
Chi-square goodness of fit test evaluating the null hypothesis that the
observed counts conform to the frequency distribution described by the expected
counts, with significance level |
| public double | Returns: p-valuearray representation of 2-way table counts)Returns the observed significance level, or
p-value, associated with a
chi-square test of independence based on the input |
| public boolean | Returns: true iff null hypothesis can be rejected with confidence 1 - alphaarray representation of 2-way table counts, final double significance level of the test alpha)Performs a
chi-square test of independence evaluating the null hypothesis that the
classifications represented by the counts in the columns of the input 2-way table
are independent of the rows, with significance level |
| public double | Returns: p-valuearray of observed frequency counts of the first data set observed1, long[] array of observed frequency counts of the second data set observed2)Returns the observed significance level, or
p-value, associated with a Chi-Square two sample test comparing
bin frequency counts in |
| public boolean | Returns: true iff null hypothesis can be rejected with confidence 1 - alphaarray of observed frequency counts of the first data set observed1, final long[] array of observed frequency counts of the second data set observed2, final double significance level of the test alpha)Performs a Chi-Square two sample test comparing two binned data sets. |
| ChiSquareTest | back to summary |
|---|---|
| public ChiSquareTest() Construct a ChiSquareTest | |
| checkArray | back to summary |
|---|---|
| private void checkArray(final long[][] in) throws NullArgumentException, DimensionMismatchException, NotPositiveException Checks to make sure that the input long[][] array is rectangular, has at least 2 rows and 2 columns, and has all non-negative entries.
| |
| chiSquare | back to summary |
|---|---|
| public double chiSquare(final double[] expected, final long[] observed) throws NotPositiveException, NotStrictlyPositiveException, DimensionMismatchException Computes the
Chi-Square statistic comparing This statistic can be used to perform a Chi-Square test evaluating the null hypothesis that the observed counts follow the expected distribution. Preconditions:
If any of the preconditions are not met, an
Note This implementation rescales the
| |
| chiSquare | back to summary |
|---|---|
| public double chiSquare(final long[][] counts) throws NullArgumentException, NotPositiveException, DimensionMismatchException Computes the Chi-Square statistic associated with a
chi-square test of independence based on the input
The rows of the 2-way table are
Preconditions:
If any of the preconditions are not met, an
| |
| chiSquareDataSetsComparison | back to summary |
|---|---|
| public double chiSquareDataSetsComparison(long[] observed1, long[] observed2) throws DimensionMismatchException, NotPositiveException, ZeroException Computes a
Chi-Square two sample test statistic comparing bin frequency counts
in
∑[(K * observed1[i] - observed2[i]/K)2 / (observed1[i] + observed2[i])]
where
K = &sqrt;[&sum(observed2 / ∑(observed1)]
This statistic can be used to perform a Chi-Square test evaluating the null hypothesis that both observed counts follow the same distribution. Preconditions:
If any of the preconditions are not met, an
| |
| chiSquareTest | back to summary |
|---|---|
| public double chiSquareTest(final double[] expected, final long[] observed) throws NotPositiveException, NotStrictlyPositiveException, DimensionMismatchException, MaxCountExceededException Returns the observed significance level, or
p-value, associated with a
Chi-square goodness of fit test comparing the The number returned is the smallest significance level at which one can reject the null hypothesis that the observed counts conform to the frequency distribution described by the expected counts. Preconditions:
If any of the preconditions are not met, an
Note This implementation rescales the
| |
| chiSquareTest | back to summary |
|---|---|
| public boolean chiSquareTest(final double[] expected, final long[] observed, final double alpha) throws NotPositiveException, NotStrictlyPositiveException, DimensionMismatchException, OutOfRangeException, MaxCountExceededException Performs a
Chi-square goodness of fit test evaluating the null hypothesis that the
observed counts conform to the frequency distribution described by the expected
counts, with significance level
Example:
Preconditions:
If any of the preconditions are not met, an
Note This implementation rescales the
| |
| chiSquareTest | back to summary |
|---|---|
| public double chiSquareTest(final long[][] counts) throws NullArgumentException, DimensionMismatchException, NotPositiveException, MaxCountExceededException Returns the observed significance level, or
p-value, associated with a
chi-square test of independence based on the input
The rows of the 2-way table are
Preconditions:
If any of the preconditions are not met, an
| |
| chiSquareTest | back to summary |
|---|---|
| public boolean chiSquareTest(final long[][] counts, final double alpha) throws NullArgumentException, DimensionMismatchException, NotPositiveException, OutOfRangeException, MaxCountExceededException Performs a
chi-square test of independence evaluating the null hypothesis that the
classifications represented by the counts in the columns of the input 2-way table
are independent of the rows, with significance level
The rows of the 2-way table are
Example:
Preconditions:
If any of the preconditions are not met, an
| |
| chiSquareTestDataSetsComparison | back to summary |
|---|---|
| public double chiSquareTestDataSetsComparison(long[] observed1, long[] observed2) throws DimensionMismatchException, NotPositiveException, ZeroException, MaxCountExceededException Returns the observed significance level, or
p-value, associated with a Chi-Square two sample test comparing
bin frequency counts in The number returned is the smallest significance level at which one can reject the null hypothesis that the observed counts conform to the same distribution. See
If any of the preconditions are not met, an
| |
| chiSquareTestDataSetsComparison | back to summary |
|---|---|
| public boolean chiSquareTestDataSetsComparison(final long[] observed1, final long[] observed2, final double alpha) throws DimensionMismatchException, NotPositiveException, ZeroException, OutOfRangeException, MaxCountExceededException Performs a Chi-Square two sample test comparing two binned data
sets. The test evaluates the null hypothesis that the two lists of
observed counts conform to the same frequency distribution, with
significance level See
If any of the preconditions are not met, an
| |