g08aff

g08aff © Numerical Algorithms Group, 2002.

Purpose

G08AFF Kruskal-Wallis one-way analysis of variance on k samples of unequal size

Synopsis

[h,p,ifail] = g08aff(x,lx<,ifail>)

Description

 
 The Kruskal-Wallis test investigates the differences between 
 scores from k independent samples of unequal sizes, the ith 
 sample containing l  observations. The hypothesis under test, H ,
                    i                                           0
 often called the null hypothesis, is that the samples come from 
 the same population, and this is to be tested against the 
 alternative hypothesis H  that they come from different 
                         1                              
 populations.
 
 The test proceeds as follows:
 
 (a)   The pooled sample of all the observations is ranked. 
       Average ranks are assigned to tied scores.
 
 (b)   The ranks of the observations in each sample are summed, to
       give the rank sums R , for i=1,2,...,k.
                           i      
 
 (c)   The Kruskal-Wallis' test statistic H is computed as:
                                       2
                                  k   R 
                             12   --   i
                        H= ------ >   ---3(L+1),
                           L(L+1) --  l 
                                  i=1  i
                k                                    
                --                                   
       where L= >  l , i.e., L is the total number of 
                --  i                                
                i=1                                  
       observations. If there are tied scores, H is corrected by 
       dividing by:
                                  --  3
                                  > (t -t)
                                  --   
                              1- ---------
                                    3
                                   L -L
       where t is the number of tied scores in a group and the 
       summation is over all tied groups.
 
 G08AFF returns the value of H, and also an approximation, p, to 
 the probability of a value of at least H being observed, H  is 
                                                           0   
                                       2                       
 true. (H approximately follows a (chi)    distribution). H  is 
                                       k-1                 0   
 rejected by a test of chosen size (alpha) if p<(alpha). The 
 approximation p is acceptable unless k=3 and l , l  or l <=5 in 
                                               1   2     3      
 which case tables should be consulted or k=2 (in which case the 
 Median test (see G08ACF) or the Mann-Whitney U test (see G08AGF) 
 is more appropriate).
 

Parameters

g08aff

Required Input Arguments:

x (:)                                 real
lx (:)                                integer

Optional Input Arguments:                       <Default>

ifail                                 integer  -1

Output Arguments:

h                                     real
p                                     real
ifail                                 integer