org.statcato.statistics.inferential.nonparametrics
Class KruskalWallisTest

java.lang.Object
  extended by org.statcato.statistics.inferential.nonparametrics.KruskalWallisTest

public class KruskalWallisTest
extends java.lang.Object

Kruskal-Wallis test. A nonparametic test that uses ranks of samples from three or more independent populations to to test the null hypothesis that the independent samples come from population with the same distribution. The independent samples are combined into one sample, are sorted in ascending order and are ranked based on its place in the one sample. The sum of the ranks corresponding to each of the samples are computed and is used in calculating the test statistics H. The Chi-square distribution is used for approximation.

Since:
1.0
Version:
%I%, %G%
Author:
Margaret Yau

Field Summary
 double significance
          Significance of the test
 
Constructor Summary
KruskalWallisTest(java.util.Vector<java.util.Vector<java.lang.Double>> data, double significance)
          Constructor, given samples of data values.
 
Method Summary
 void computeRankSum(java.util.Vector<java.util.Vector<java.lang.Double>> data)
          Computes the sum of ranks for each sample.
 double criticalValue()
          Returns the one-tailed critical value.
 int DOF()
          Returns the degrees of freedom.
 double pValue()
          Returns the p-value.
 double testStatistic()
          Returns the test statistic H = 12 / [N(N+1)] Sum_i (R_i^2/n_i) - 3(N+1).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

significance

public double significance
Significance of the test

Constructor Detail

KruskalWallisTest

public KruskalWallisTest(java.util.Vector<java.util.Vector<java.lang.Double>> data,
                         double significance)
Constructor, given samples of data values.

Parameters:
data - a vector of vector of double values, with each vector of double values representing an independent sample
significance - significance level (between 0 and 1)
Method Detail

testStatistic

public double testStatistic()
Returns the test statistic H = 12 / [N(N+1)] Sum_i (R_i^2/n_i) - 3(N+1).

Returns:
test statistic H

DOF

public int DOF()
Returns the degrees of freedom.

Returns:
degrees of freedom

pValue

public double pValue()
Returns the p-value.

Returns:
p-value

criticalValue

public double criticalValue()
Returns the one-tailed critical value.

Returns:
critical value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

computeRankSum

public void computeRankSum(java.util.Vector<java.util.Vector<java.lang.Double>> data)
Computes the sum of ranks for each sample. Assigns the appropriate rank sum to the private array R[]. Ranks are computed after all samples are combined and sorted in ascending order.

Parameters:
data - vector of Double values