Tests can be:
Test statistics are available for all tests. Methods including "Test" in
in their names perform tests, all other methods return t-statistics. Among
the "Test" methods, double-valued methods return p-values;
boolean-valued methods perform fixed significance level tests.
Significance levels are always specified as numbers between 0 and 0.5
(e.g. tests at the 95% level use alpha=0.05).
Input to tests can be either double[] arrays or
StatisticalSummary instances.
Uses commons-math org.
implementation to estimate exact p-values.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | |
| protected double | Returns: approximate degrees of freedomfirst sample variance v1, double second sample variance v2, double first sample n n1, double second sample n n2)Computes approximate degrees of freedom for 2-sample t-test. |
| public double | Returns: t statisticarray of sample data values sample1, final double[] array of sample data values sample2)Computes a 2-sample t statistic, under the hypothesis of equal subpopulation variances. |
| public double | Returns: t statisticStatisticalSummary describing data from the first sample sampleStats1, final StatisticalSummary StatisticalSummary describing data from the second sample sampleStats2)Computes a 2-sample t statistic, comparing the means of the datasets
described by two |
| protected double | Returns: t test statisticfirst sample mean m1, final double second sample mean m2, final double first sample variance v1, final double second sample variance v2, final double first sample n n1, final double second sample n n2)Computes t test statistic for 2-sample t-test under the hypothesis of equal subpopulation variances. |
| public double | Returns: p-value for t-testarray of sample data values sample1, final double[] array of sample data values sample2)Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the input arrays, under the assumption that the two samples are drawn from subpopulations with equal variances. |
| public boolean | Returns: true if the null hypothesis can be rejected with confidence 1 - alphaarray of sample data values sample1, final double[] array of sample data values sample2, final double significance level of the test alpha)Performs a
two-sided t-test evaluating the null hypothesis that |
| public double | Returns: p-value for t-testStatisticalSummary describing data from the first sample sampleStats1, final StatisticalSummary StatisticalSummary describing data from the second sample sampleStats2)Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the datasets described by two StatisticalSummary instances, under the hypothesis of equal subpopulation variances. |
| protected double | Returns: p-valuefirst sample mean m1, double second sample mean m2, double first sample variance v1, double second sample variance v2, double first sample n n1, double second sample n n2)Computes p-value for 2-sided, 2-sample t-test, under the assumption of equal subpopulation variances. |
| public double | Returns: t statisticarray of sample data values sample1, final double[] array of sample data values sample2)Computes a paired, 2-sample t-statistic based on the data in the input arrays. |
| public double | Returns: p-value for t-testarray of sample data values sample1, final double[] array of sample data values sample2)Returns the observed significance level, or p-value, associated with a paired, two-sample, two-tailed t-test based on the data in the input arrays. |
| public boolean | Returns: true if the null hypothesis can be rejected with confidence 1 - alphaarray of sample data values sample1, final double[] array of sample data values sample2, final double significance level of the test alpha)Performs a paired t-test evaluating the null hypothesis that the
mean of the paired differences between |
| public double | Returns: t statisticcomparison constant mu, final double[] array of values observed) |
| public double | Returns: t statisticcomparison constant mu, final StatisticalSummary DescriptiveStatistics holding sample summary statitstics sampleStats) |
| public double | Returns: t statisticarray of sample data values sample1, final double[] array of sample data values sample2)Computes a 2-sample t statistic, without the hypothesis of equal subpopulation variances. |
| public double | Returns: t statisticStatisticalSummary describing data from the first sample sampleStats1, final StatisticalSummary StatisticalSummary describing data from the second sample sampleStats2)Computes a 2-sample t statistic, comparing the means of the datasets
described by two |
| protected double | Returns: t test statisticsample mean m, final double constant to test against mu, final double sample variance v, final double sample n n)Computes t test statistic for 1-sample t-test. |
| protected double | Returns: t test statisticfirst sample mean m1, final double second sample mean m2, final double first sample variance v1, final double second sample variance v2, final double first sample n n1, final double second sample n n2)Computes t test statistic for 2-sample t-test. |
| public double | Returns: p-valueconstant value to compare sample mean against mu, final double[] array of sample data values sample)Returns the observed significance level, or
p-value, associated with a one-sample, two-tailed t-test
comparing the mean of the input array with the constant |
| public boolean | Returns: p-valueconstant value to compare sample mean against mu, final double[] array of sample data values sample, final double significance level of the test alpha)Performs a
two-sided t-test evaluating the null hypothesis that the mean of the population from
which |
| public double | Returns: p-valueconstant value to compare sample mean against mu, final StatisticalSummary StatisticalSummary describing sample data sampleStats)Returns the observed significance level, or
p-value, associated with a one-sample, two-tailed t-test
comparing the mean of the dataset described by |
| public boolean | Returns: p-valueconstant value to compare sample mean against mu, final StatisticalSummary StatisticalSummary describing sample data values sampleStats, final double significance level of the test alpha)Performs a
two-sided t-test evaluating the null hypothesis that the mean of the
population from which the dataset described by |
| public double | Returns: p-value for t-testarray of sample data values sample1, final double[] array of sample data values sample2)Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the input arrays. |
| public boolean | Returns: true if the null hypothesis can be rejected with confidence 1 - alphaarray of sample data values sample1, final double[] array of sample data values sample2, final double significance level of the test alpha)Performs a
two-sided t-test evaluating the null hypothesis that |
| public double | Returns: p-value for t-testStatisticalSummary describing data from the first sample sampleStats1, final StatisticalSummary StatisticalSummary describing data from the second sample sampleStats2)Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the datasets described by two StatisticalSummary instances. |
| public boolean | Returns: true if the null hypothesis can be rejected with confidence 1 - alphaStatisticalSummary describing sample data values sampleStats1, final StatisticalSummary StatisticalSummary describing sample data values sampleStats2, final double significance level of the test alpha)Performs a
two-sided t-test evaluating the null hypothesis that
|
| protected double | Returns: p-valuesample mean m, final double constant to test against mu, final double sample variance v, final double sample n n)Computes p-value for 2-sided, 1-sample t-test. |
| protected double | Returns: p-valuefirst sample mean m1, final double second sample mean m2, final double first sample variance v1, final double second sample variance v2, final double first sample n n1, final double second sample n n2)Computes p-value for 2-sided, 2-sample t-test. |
| TTest | back to summary |
|---|---|
| public TTest() | |
| checkSampleData | back to summary |
|---|---|
| private void checkSampleData(final double[] data) throws NullArgumentException, NumberIsTooSmallException Check sample data.
| |
| checkSampleData | back to summary |
|---|---|
| private void checkSampleData(final StatisticalSummary stat) throws NullArgumentException, NumberIsTooSmallException Check sample data.
| |
| checkSignificanceLevel | back to summary |
|---|---|
| private void checkSignificanceLevel(final double alpha) throws OutOfRangeException Check significance level.
| |
| df | back to summary |
|---|---|
| protected double df(double v1, double v2, double n1, double n2) Computes approximate degrees of freedom for 2-sample t-test.
| |
| homoscedasticT | back to summary |
|---|---|
| public double homoscedasticT(final double[] sample1, final double[] sample2) throws NullArgumentException, NumberIsTooSmallException Computes a 2-sample t statistic, under the hypothesis of equal
subpopulation variances. To compute a t-statistic without the
equal variances hypothesis, use This statistic can be used to perform a (homoscedastic) two-sample t-test to compare sample means. The t-statistic is
where
with Preconditions:
| |
| homoscedasticT | back to summary |
|---|---|
| public double homoscedasticT(final StatisticalSummary sampleStats1, final StatisticalSummary sampleStats2) throws NullArgumentException, NumberIsTooSmallException Computes a 2-sample t statistic, comparing the means of the datasets
described by two This statistic can be used to perform a (homoscedastic) two-sample t-test to compare sample means. The t-statistic returned is
where
with Preconditions:
| |
| homoscedasticT | back to summary |
|---|---|
| protected double homoscedasticT(final double m1, final double m2, final double v1, final double v2, final double n1, final double n2) Computes t test statistic for 2-sample t-test under the hypothesis of equal subpopulation variances.
| |
| homoscedasticTTest | back to summary |
|---|---|
| public double homoscedasticTTest(final double[] sample1, final double[] sample2) throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException Returns the observed significance level, or
p-value, associated with a two-sample, two-tailed t-test
comparing the means of the input arrays, under the assumption that
the two samples are drawn from subpopulations with equal variances.
To perform the test without the equal variances assumption, use
The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.
A pooled variance estimate is used to compute the t-statistic. See
Usage Note: Preconditions:
| |
| homoscedasticTTest | back to summary |
|---|---|
| public boolean homoscedasticTTest(final double[] sample1, final double[] sample2, final double alpha) throws NullArgumentException, NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException Performs a
two-sided t-test evaluating the null hypothesis that
Returns
A pooled variance estimate is used to compute the t-statistic. See
Examples:
Usage Note: Preconditions:
| |
| homoscedasticTTest | back to summary |
|---|---|
| public double homoscedasticTTest(final StatisticalSummary sampleStats1, final StatisticalSummary sampleStats2) throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException Returns the observed significance level, or
p-value, associated with a two-sample, two-tailed t-test
comparing the means of the datasets described by two StatisticalSummary
instances, under the hypothesis of equal subpopulation variances. To
perform a test without the equal variances assumption, use
The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.
See
Usage Note: Preconditions:
| |
| homoscedasticTTest | back to summary |
|---|---|
| protected double homoscedasticTTest(double m1, double m2, double v1, double v2, double n1, double n2) throws MaxCountExceededException, NotStrictlyPositiveException Computes p-value for 2-sided, 2-sample t-test, under the assumption of equal subpopulation variances. The sum of the sample sizes minus 2 is used as degrees of freedom.
| |
| pairedT | back to summary |
|---|---|
| public double pairedT(final double[] sample1, final double[] sample2) throws NullArgumentException, NoDataException, DimensionMismatchException, NumberIsTooSmallException Computes a paired, 2-sample t-statistic based on the data in the input
arrays. The t-statistic returned is equivalent to what would be returned by
computing the one-sample t-statistic Preconditions:
| |
| pairedTTest | back to summary |
|---|---|
| public double pairedTTest(final double[] sample1, final double[] sample2) throws NullArgumentException, NoDataException, DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException Returns the observed significance level, or p-value, associated with a paired, two-sample, two-tailed t-test based on the data in the input arrays. The number returned is the smallest significance level at which one can reject the null hypothesis that the mean of the paired differences is 0 in favor of the two-sided alternative that the mean paired difference is not equal to 0. For a one-sided test, divide the returned value by 2.
This test is equivalent to a one-sample t-test computed using
Usage Note: Preconditions:
| |
| pairedTTest | back to summary |
|---|---|
| public boolean pairedTTest(final double[] sample1, final double[] sample2, final double alpha) throws NullArgumentException, NoDataException, DimensionMismatchException, NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException Performs a paired t-test evaluating the null hypothesis that the
mean of the paired differences between
Returns
Usage Note: Preconditions:
| |
| t | back to summary |
|---|---|
public double t(final double mu, final double[] observed) throws NullArgumentException, NumberIsTooSmallException
| |
| t | back to summary |
|---|---|
public double t(final double mu, final StatisticalSummary sampleStats) throws NullArgumentException, NumberIsTooSmallException
| |
| t | back to summary |
|---|---|
| public double t(final double[] sample1, final double[] sample2) throws NullArgumentException, NumberIsTooSmallException Computes a 2-sample t statistic, without the hypothesis of equal
subpopulation variances. To compute a t-statistic assuming equal
variances, use This statistic can be used to perform a two-sample t-test to compare sample means. The t-statistic is
where Preconditions:
| |
| t | back to summary |
|---|---|
| public double t(final StatisticalSummary sampleStats1, final StatisticalSummary sampleStats2) throws NullArgumentException, NumberIsTooSmallException Computes a 2-sample t statistic, comparing the means of the datasets
described by two This statistic can be used to perform a two-sample t-test to compare sample means. The returned t-statistic is
where Preconditions:
| |
| t | back to summary |
|---|---|
| protected double t(final double m, final double mu, final double v, final double n) Computes t test statistic for 1-sample t-test.
| |
| t | back to summary |
|---|---|
| protected double t(final double m1, final double m2, final double v1, final double v2, final double n1, final double n2) Computes t test statistic for 2-sample t-test. Does not assume that subpopulation variances are equal.
| |
| tTest | back to summary |
|---|---|
| public double tTest(final double mu, final double[] sample) throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException Returns the observed significance level, or
p-value, associated with a one-sample, two-tailed t-test
comparing the mean of the input array with the constant
The number returned is the smallest significance level
at which one can reject the null hypothesis that the mean equals
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| public boolean tTest(final double mu, final double[] sample, final double alpha) throws NullArgumentException, NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException Performs a
two-sided t-test evaluating the null hypothesis that the mean of the population from
which
Returns
Examples:
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| public double tTest(final double mu, final StatisticalSummary sampleStats) throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException Returns the observed significance level, or
p-value, associated with a one-sample, two-tailed t-test
comparing the mean of the dataset described by
The number returned is the smallest significance level
at which one can reject the null hypothesis that the mean equals
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| public boolean tTest(final double mu, final StatisticalSummary sampleStats, final double alpha) throws NullArgumentException, NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException Performs a
two-sided t-test evaluating the null hypothesis that the mean of the
population from which the dataset described by
Returns
Examples:
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| public double tTest(final double[] sample1, final double[] sample2) throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the input arrays. The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.
The test does not assume that the underlying popuation variances are
equal and it uses approximated degrees of freedom computed from the
sample data to compute the p-value. The t-statistic used is as defined in
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| public boolean tTest(final double[] sample1, final double[] sample2, final double alpha) throws NullArgumentException, NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException Performs a
two-sided t-test evaluating the null hypothesis that
Returns
See
Examples:
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| public double tTest(final StatisticalSummary sampleStats1, final StatisticalSummary sampleStats2) throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException Returns the observed significance level, or p-value, associated with a two-sample, two-tailed t-test comparing the means of the datasets described by two StatisticalSummary instances. The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. For a one-sided test, divide the returned value by 2.
The test does not assume that the underlying population variances are
equal and it uses approximated degrees of freedom computed from the
sample data to compute the p-value. To perform the test assuming
equal variances, use
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| public boolean tTest(final StatisticalSummary sampleStats1, final StatisticalSummary sampleStats2, final double alpha) throws NullArgumentException, NumberIsTooSmallException, OutOfRangeException, MaxCountExceededException Performs a
two-sided t-test evaluating the null hypothesis that
Returns
See
Examples:
Usage Note: Preconditions:
| |
| tTest | back to summary |
|---|---|
| protected double tTest(final double m, final double mu, final double v, final double n) throws MaxCountExceededException, MathIllegalArgumentException Computes p-value for 2-sided, 1-sample t-test.
| |
| tTest | back to summary |
|---|---|
| protected double tTest(final double m1, final double m2, final double v1, final double v2, final double n1, final double n2) throws MaxCountExceededException, NotStrictlyPositiveException Computes p-value for 2-sided, 2-sample t-test. Does not assume subpopulation variances are equal. Degrees of freedom are estimated from the data.
| |