|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A collection of commonly used test statistics and statistical tests.
Method Summary | |
double |
chiSquare(double[] expected,
double[] observed)
Computes the Chi-Square statistic comparing observed and expected freqeuncy counts. |
double |
chiSquareTest(double[] expected,
double[] observed)
Returns the observed significance level, or p-value, associated with a Chi-square goodness of fit test comparing the observed frequency counts to those in the
expected array. |
boolean |
chiSquareTest(double[] expected,
double[] observed,
double 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 alpha . |
double |
t(DescriptiveStatistics sampleStats1,
DescriptiveStatistics sampleStats2)
Computes a 2-sample t statistic , comparing the datasets described by two Univariates without the assumption of equal sample variances. |
double |
t(double[] sample1,
double[] sample2)
Computes a 2-sample t statistic , without the assumption of equal sample variances. |
double |
t(double mu,
DescriptiveStatistics sampleStats)
Computes a t statistic to use in comparing the dataset described by sampleStats to mu . |
double |
t(double mu,
double[] observed)
Computes a t statistic given observed values and a comparison constant. |
double |
tTest(DescriptiveStatistics sampleStats1,
DescriptiveStatistics 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 Univariates. |
boolean |
tTest(DescriptiveStatistics sampleStats1,
DescriptiveStatistics sampleStats2,
double alpha)
Performs a two-sided t-test evaluating the null hypothesis that sampleStats1 and sampleStats2
describe datasets drawn from populations with the same mean, with
significance level alpha . |
double |
tTest(double[] sample1,
double[] 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. |
boolean |
tTest(double[] sample1,
double[] sample2,
double alpha)
Performs a two-sided t-test evaluating the null hypothesis that sample1 and sample2 are drawn
from populations with the same mean, with significance level
alpha . |
double |
tTest(double mu,
DescriptiveStatistics 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 sampleStats
with the constant mu . |
boolean |
tTest(double mu,
DescriptiveStatistics sampleStats,
double alpha)
Performs a two-sided t-test evaluating the null hypothesis that the mean of the population from which the dataset described by stats is drawn equals mu . |
double |
tTest(double mu,
double[] 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 mu . |
boolean |
tTest(double mu,
double[] sample,
double alpha)
Performs a two-sided t-test evaluating the null hypothesis that the mean of the population from which sample is drawn equals mu . |
Method Detail |
public double chiSquare(double[] expected, double[] observed) throws IllegalArgumentException, MathException
observed
and expected
freqeuncy counts.
This statistic can be used to perform Chi-Square tests.
Preconditions:
If any of the preconditions are not met, an
IllegalArgumentException
is thrown.
observed
- array of observed frequency countsexpected
- array of exptected frequency counts
IllegalArgumentException
- if preconditions are not met
MathException
public double chiSquareTest(double[] expected, double[] observed) throws IllegalArgumentException, MathException
observed
frequency counts to those in the
expected
array.
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
IllegalArgumentException
is thrown.
observed
- array of observed frequency countsexpected
- array of exptected frequency counts
IllegalArgumentException
- if preconditions are not met
MathException
public boolean chiSquareTest(double[] expected, double[] observed, double alpha) throws IllegalArgumentException, MathException
alpha
.
Example:
To test the hypothesis that observed
follows
expected
at the 99% level, use
chiSquareTest(expected, observed, 0.01)
Preconditions:
0 < alpha < 0.5
If any of the preconditions are not met, an
IllegalArgumentException
is thrown.
observed
- array of observed frequency countsexpected
- array of exptected frequency countsalpha
- significance level of the test
IllegalArgumentException
- if preconditions are not met
MathException
public double t(double mu, double[] observed) throws IllegalArgumentException, MathException
This statistic can be used to perform a one sample t-test for the mean.
Preconditions:
mu
- comparison constantobserved
- array of values
IllegalArgumentException
- if input array length is less than 2
MathException
public double t(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException
This statistic can be used to perform a two-sample t-test to compare sample means.
Preconditions:
sample1
- array of sample data valuessample2
- array of sample data values
IllegalArgumentException
- if the precondition is not met
MathException
public double tTest(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException
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 as described here
Usage Note:
The validity of the p-value depends on the assumptions of the parametric
t-test procedure, as discussed here
Preconditions:
sample1
- array of sample data valuessample2
- array of sample data values
IllegalArgumentException
- if the precondition is not met
MathException
public boolean tTest(double[] sample1, double[] sample2, double alpha) throws IllegalArgumentException, MathException
sample1
and sample2
are drawn
from populations with the same mean, with significance level
alpha
.
Returns true
iff the null hypothesis that the means are
equal can be rejected with confidence 1 - alpha
. To
perform a 1-sided test, use alpha / 2
Examples:
mean 1 = mean 2
at
the 95% level, use tTest(sample1, sample2, 0.05)
mean 1 < mean 2
at the 99% level, first verify that the measured mean of
sample 1
is less than the mean of sample 2
and then use tTest(sample1, sample2, 0.005)
The test does not assume that the underlying popuation variances are equal and it uses approximated degrees of freedom computed from the sample data as described here
Usage Note:
The validity of the test depends on the assumptions of the parametric
t-test procedure, as discussed here
Preconditions:
0 < alpha < 0.5
sample1
- array of sample data valuessample2
- array of sample data valuesalpha
- significance level of the test
IllegalArgumentException
- if the preconditions are not met
MathException
public boolean tTest(double mu, double[] sample, double alpha) throws IllegalArgumentException, MathException
sample
is drawn equals mu
.
Returns true
iff the null hypothesis can be
rejected with confidence 1 - alpha
. To
perform a 1-sided test, use alpha / 2
Examples:
sample mean = mu
at
the 95% level, use tTest(mu, sample, 0.05)
sample mean < mu
at the 99% level, first verify that the measured sample mean is less
than mu
and then use
tTest(mu, sample, 0.005)
Usage Note:
The validity of the test depends on the assumptions of the one-sample
parametric t-test procedure, as discussed
here
Preconditions:
mu
- constant value to compare sample mean againstsample
- array of sample data valuesalpha
- significance level of the test
IllegalArgumentException
- if the precondition is not met
MathException
public double tTest(double mu, double[] sample) throws IllegalArgumentException, MathException
mu
.
The number returned is the smallest significance level
at which one can reject the null hypothesis that the mean equals
mu
in favor of the two-sided alternative that the mean
is different from mu
. For a one-sided test, divide the
returned value by 2.
Usage Note:
The validity of the test depends on the assumptions of the parametric
t-test procedure, as discussed here
Preconditions:
mu
- constant value to compare sample mean againstsample
- array of sample data values
IllegalArgumentException
- if the precondition is not met
MathException
public double t(double mu, DescriptiveStatistics sampleStats) throws IllegalArgumentException, MathException
sampleStats
to mu
.
This statistic can be used to perform a one sample t-test for the mean.
Preconditions:
observed.getN() > = 2
.
mu
- comparison constantsampleStats
- DescriptiveStatistics holding sample summary statitstics
IllegalArgumentException
- if the precondition is not met
MathException
public double t(DescriptiveStatistics sampleStats1, DescriptiveStatistics sampleStats2) throws IllegalArgumentException, MathException
This statistic can be used to perform a two-sample t-test to compare sample means.
Preconditions:
sampleStats1
- DescriptiveStatistics describing data from the first samplesampleStats2
- DescriptiveStatistics describing data from the second sample
IllegalArgumentException
- if the precondition is not met
MathException
public double tTest(DescriptiveStatistics sampleStats1, DescriptiveStatistics sampleStats2) throws IllegalArgumentException, MathException
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 as described here
Usage Note:
The validity of the p-value depends on the assumptions of the parametric
t-test procedure, as discussed here
Preconditions:
sampleStats1
- DescriptiveStatistics describing data from the first samplesampleStats2
- DescriptiveStatistics describing data from the second sample
IllegalArgumentException
- if the precondition is not met
MathException
public boolean tTest(DescriptiveStatistics sampleStats1, DescriptiveStatistics sampleStats2, double alpha) throws IllegalArgumentException, MathException
sampleStats1
and sampleStats2
describe datasets drawn from populations with the same mean, with
significance level alpha
.
Returns true
iff the null hypothesis that the means are
equal can be rejected with confidence 1 - alpha
. To
perform a 1-sided test, use alpha / 2
Examples:
mean 1 = mean 2
at
the 95% level, use
tTest(sampleStats1, sampleStats2, 0.05)
mean 1 < mean 2
at the 99% level, first verify that the measured mean of
sample 1
is less than the mean of sample 2
and then use tTest(sampleStats1, sampleStats2, 0.005)
The test does not assume that the underlying popuation variances are equal and it uses approximated degrees of freedom computed from the sample data as described here
Usage Note:
The validity of the test depends on the assumptions of the parametric
t-test procedure, as discussed here
Preconditions:
0 < alpha < 0.5
sampleStats1
- DescriptiveStatistics describing sample data valuessampleStats2
- DescriptiveStatistics describing sample data valuesalpha
- significance level of the test
IllegalArgumentException
- if the preconditions are not met
MathException
public boolean tTest(double mu, DescriptiveStatistics sampleStats, double alpha) throws IllegalArgumentException, MathException
stats
is drawn equals mu
.
Returns true
iff the null hypothesis can be
rejected with confidence 1 - alpha
. To
perform a 1-sided test, use alpha / 2
Examples:
sample mean = mu
at
the 95% level, use tTest(mu, sampleStats, 0.05)
sample mean < mu
at the 99% level, first verify that the measured sample mean is less
than mu
and then use
tTest(mu, sampleStats, 0.005)
Usage Note:
The validity of the test depends on the assumptions of the one-sample
parametric t-test procedure, as discussed
here
Preconditions:
mu
- constant value to compare sample mean againstsampleStats
- DescriptiveStatistics describing sample data valuesalpha
- significance level of the test
IllegalArgumentException
- if the precondition is not met
MathException
public double tTest(double mu, DescriptiveStatistics sampleStats) throws IllegalArgumentException, MathException
sampleStats
with the constant mu
.
The number returned is the smallest significance level
at which one can reject the null hypothesis that the mean equals
mu
in favor of the two-sided alternative that the mean
is different from mu
. For a one-sided test, divide the
returned value by 2.
Usage Note:
The validity of the test depends on the assumptions of the parametric
t-test procedure, as discussed here
Preconditions:
mu
- constant value to compare sample mean againstsampleStats
- DescriptiveStatistics describing sample data
IllegalArgumentException
- if the precondition is not met
MathException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |