View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Martin Lee > Statistics-KruskalWallis > Statistics::KruskalWallis



Annotate this POD


New  1
Open  0
View/Report Bugs
Module Version: 0.01   Source  


Statistics::KruskalWallis - Perl module to perform the Kruskall-Wallis test, use to test if differences exist between 3 or more independant groups of unequal sizes.

Also includes the post-hoc Newman-Keuls test, to test if the differences between pairs of the tested group are significant.


    use Statistics::KruskalWallis;
    use strict;

    my @group_1 = (6.4,6.8,7.2,8.3,8.4,9.1,9.4,9.7);
    my @group_2 = (2.5,3.7,4.9,5.4,5.9,8.1,8.2);
    my @group_3 = (1.3,4.1,4.9,5.2,5.5,8.2);

    my $kw = new Statistics::KruskalWallis;

    $kw->load_data('group 1',@group_1);
    $kw->load_data('group 2',@group_2);
    $kw->load_data('group 3',@group_3);

    my ($H,$p_value) = $kw->perform_kruskal_wallis_test;

   print "Kruskal Wallis statistic is $H\n";
   print "p value for test is $p_value\n";

#post hoc my ($q,$p) = $kw->post_hoc('Newman-Keuls','group 1','group 3'); print "Newman-Keuls statistic for groups 1,3 is $q, p value $p\n";

   ($q,$p) = $kw->post_hoc('Newman-Keuls','group 1','group 2');
   print "Newman-Keuls statistic for groups 1,2 is $q, p value $p\n";

   ($q,$p) = $kw->post_hoc('Newman-Keuls','group 2','group 3');
   print "Newman-Keuls statistic for groups 2,3 is $q, p value $p\n";


This module performs the Kruskal Wallis statistical test on data. It takes 3 or more groups of independant data of unequal size, and tests the null hypothesis, that the mean ranks of the groups do not differ.

The facility to perform post-hoc tests on the groups to test differences between pairs of groups is included. So far only the Newman-Keuls test is included, hopefully further tests will be included.


Martin Lee, Star Technology Group ( copyright (c) 2003 Star Technology Group Ltd.

syntax highlighting: