|
Java Statistical Classes | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--jsc.onesample.WilcoxonTest
Wilcoxon's signed-rank test for the median of a symmetric distribution. Given a sample from a population, this tests the null hypothesis that the population's distribution has a specified median against the alternative hypotheses that it is different (NOT_EQUAL), less than (LESS_THAN), or greater than (GREATER_THAN) the specified median.
This class also provides the Wilcoxon matched pairs test. Suppose we have two samples of paired observations from populations X and Y. The null hypothesis is that X and Y have the same average against the alternative hypotheses that the averages of X and Y are different (NOT_EQUAL), or the average of X is less than the average of Y (LESS_THAN), or the average of X is greater than the average of Y (GREATER_THAN).
| Constructor Summary | |
WilcoxonTest(double[] x,
double median)
Create significance test results. |
|
WilcoxonTest(double[] x,
double median,
H1 alternative)
Create significance test results. |
|
WilcoxonTest(double[] x,
double median,
H1 alternative,
boolean includeZeros)
Create significance test results. |
|
WilcoxonTest(double[] x,
double median,
H1 alternative,
double tolerance,
boolean includeZeros,
boolean normalApprox)
Create significance test results. |
|
WilcoxonTest(PairedData data)
Create significance test results for matched pairs test. |
|
WilcoxonTest(PairedData data,
H1 alternative)
Create significance test results for matched pairs test. |
|
WilcoxonTest(PairedData data,
H1 alternative,
boolean includeZeros)
Create significance test results for matched pairs test. |
|
WilcoxonTest(PairedData data,
H1 alternative,
double tolerance,
boolean includeZeros,
boolean normalApprox)
Create significance test results. |
|
| Method Summary | |
double |
approxSP()
Approximate significance probability of Wilcoxon's signed-rank test. |
double |
exactSP()
Exact significance probability of Wilcoxon's signed-rank test. |
int |
getN()
Returns the effective sample size for the test. |
double[] |
getSignedRanks()
Returns the array of signed ranks used for the test. |
double |
getSP()
Returns the value of the significance probability. |
double |
getTestStatistic()
Returns value of test statistic. |
double |
getZ()
Calculate the approximate normal test statistic, z. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public WilcoxonTest(double[] x,
double median,
H1 alternative,
double tolerance,
boolean includeZeros,
boolean normalApprox)
The exact significance probability can be calculated for most data sets, but the computation may be slow for very large samples, greater than 500 say, when using the the normal approximation to the null distribution of Wilcoxon's statistic may be preferable.
The tolerance parameter applies to differences between observations, and between observations and the hypothesized median. For the purposes of ranking, any two values are treated as equal if the absolute difference between them is less than or equal to the tolerance. If the absolute difference between an observation and the hypothesized median is less than or equal to the tolerance, then the difference is treated as zero and will be ignored if the includeZeros parameter is false.
x - the sample data.median - the value of the median under the null hypothesis.alternative - code indicating the alternative hypothesis: LESS_THAN, NOT_EQUAL, or GREATER_THAN.tolerance - the tolerance for tied ranks and zero differences.includeZeros - if true, observations that are equal to the hypothesized median are included.normalApprox - if true, a normal approximation is used to calculate the significance probability.
IllegalArgumentException - if all observations equal median and includeZeros is false.
public WilcoxonTest(double[] x,
double median,
H1 alternative,
boolean includeZeros)
x - the sample data.median - the value of the median under the null hypothesis.alternative - code indicating the alternative hypothesis: LESS_THAN, NOT_EQUAL, or GREATER_THANincludeZeros - if true, observations that are equal to the hypothesized median are included.
public WilcoxonTest(double[] x,
double median,
H1 alternative)
x - the sample data.median - the value of the median under the null hypothesis.alternative - code indicating the alternative hypothesis: LESS_THAN, NOT_EQUAL, or GREATER_THAN.
public WilcoxonTest(double[] x,
double median)
x - the sample data.median - the value of the median under the null hypothesis.
public WilcoxonTest(PairedData data,
H1 alternative,
double tolerance,
boolean includeZeros,
boolean normalApprox)
The exact significance probability can be calculated for most data sets, but the computation may be slow for very large samples, greater than 500 say, when using the the normal approximation to the null distribution of Wilcoxon's statistic may be preferable.
The tolerance parameter applies to ranking the differences, and deciding which are effectively zero.
data - the paired data of samples X and Y.alternative - code indicating the alternative hypothesis: LESS_THAN, NOT_EQUAL, or GREATER_THANtolerance - the tolerance for tied ranks and zero differences.includeZeros - if true, differences that are zero are included.normalApprox - if true, a normal approximation is used to calculate the significance probability.
IllegalArgumentException - if all differences are zero and includeZeros is false.
public WilcoxonTest(PairedData data,
H1 alternative,
boolean includeZeros)
data - the paired data of samples X and Y.alternative - code indicating the alternative hypothesis: LESS_THAN, NOT_EQUAL, or GREATER_THANincludeZeros - if true, differences that are zero are included.
IllegalArgumentException - if all differences are zero and includeZeros is false.
public WilcoxonTest(PairedData data,
H1 alternative)
data - the paired data of samples X and Y.alternative - code indicating the alternative hypothesis: LESS_THAN, NOT_EQUAL, or GREATER_THAN
IllegalArgumentException - if all differences are zero.public WilcoxonTest(PairedData data)
data - the paired data of samples X and Y.
IllegalArgumentException - if all differences are zero.| Method Detail |
public double approxSP()
public double exactSP()
public int getN()
public double[] getSignedRanks()
public double getSP()
getSP in interface SignificanceTestpublic double getTestStatistic()
getTestStatistic in interface SignificanceTestpublic double getZ()
|
Java Statistical Classes | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||