SECTION 15.21 KRUSKAL-WALLIS TEST

The Kruskal-Wallis test tests the null hypothesis that k independent samples, where each sample contains ni, i=1,...,k measurements, are from the same population. See S. Siegel and N. J. Castellan, Nonparametric Statistics, 2nd ed., 1988, pp. 206-215.

Be sure to CALL DFLT before calling KRUSKALW and to include the COMMON/BPRINT/ common block. The call is


        CALL KRUSKALW(X,NJ,NMAX,K,WK,IER)

where

         X     = a  single precision array of
		sample values, dimensioned X(NMAX,K) (input)
         NJ    = array dimensioned NJ(K) containing as elements the number
		of sample values in the ith sample (input)
	NMAX  = the largest element of NJ (input)
	K     = the number of samples (input)
	WK    = The Kruskal-Wallis test statistic (output)	 
	IER   = error return (=-3 input error)	

15.21.1 CONVERTING REAL NUMBERS TO RANKS

Converting real numbers to ranks is normally straightforward, except when ties occur. If this is the case, use

      CALL SORT1A(X,N)
      CALL CNVRT(X,RANKS,N)

where

      
	X     = is a single precision array dimensioned X(N) (input)
         RANKS = is a single precision array dimensioned RANKS(N) (output)
	N     = is the number of elements in the array (input)
SORT1A first sorts the values in X. Upon exiting from CNVRT, RANKS (a REAL array) will contain the ranks.

15.21.2 CALCULATING THE ADJUSTMENT FOR TIES

Several nonparametric tests calculate an adjustment for ties. This is based on the 1 - SUM(ti3 - t)/(n3 - n) over i, where ti is the number of tied elements in the ithgroup of tied elements. (If the ranks are 1, 2.5, 2.5,5,5,5, there are two groups and the values of t are 2 and 3 respectively.) To calculate the adjustment, use

      CALL COUNTTIE(RANKS,TX,N)
      

where RANKS and N have the same meaning as in the previous subsection and TX is the calculated measure.

Return to

|Beginning|SHELL|