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 (mlee@startechgroup.co.uk) copyright (c) 2003 Star Technology Group Ltd.
To install Statistics::KruskalWallis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Statistics::KruskalWallis
CPAN shell
perl -MCPAN -e shell install Statistics::KruskalWallis
For more information on module installation, please visit the detailed CPAN module installation guide.