Statistics::ANOVA::Compare - Comparison procedures for ANOVA


This is documentation for Version 0.01, released February 2015.

The methods here reproduce those previously incorporated as part of Statistics::ANOVA itself.


 use Statistics::ANOVA::Compare;
 my $cmp = Statistics::ANOVA::Compare->new();
 $cmp->load(HOA); # hash of arefs preferably
 my $href = $cmp->run(parametric => BOOL, independent => BOOL);



 $cmp = Statistics::ANOVA::Compare->new();

New object for accessing methods and storing results. This "isa" Statistics::Data object.

load, add, unload

 $cmp->load(1 => [1, 4], 2 => [3, 7]);

The given data can now be used by any of the following methods. This is inherited from Statistics::Data, and all its other methods are available here via the class object. Only passing of data as a hash of arrays (HOA) is supported for now. Alternatively, give each of the following methods the HOA for the optional named argument data.


Performs all possible pairwise comparisons, with Bonferroni control of experiment-wise error-rate. The particular tests depend on whether or not you want parametric (default) or nonparametric tests, and if the observations have been made independently (between groups, the default) or by repeated measures.

If parametric => 1 (default), it firstly checks if the variances are unequal> (p < .05) by the O'Brien method, and runs indep_param_by_contrasts. If the variances are equal, runs param_pairwise_eqvar. Alternatively, you get unadjusted use of the mean-square error, with no prior test of equality-of-variances, if the parameter adjust_e => 0. On the other hand, force the procedure to use separate variances, as if unequal variances, if adjust_e => 2.

If parametric => 1, performs non-parametric pairwise comparison. This derives the z-value and associated p-value for the standardized (a) Wilcoxon (between-groups) sum-of-ranks if independent => 1 (Dwass-Steel procedure), or (b) (merely) paired t-tests (TO DO: Friedman-type (within-groups) sum-of-ranks) if independent => 0.

Nominality is always assumed; there is no accounting for ordinality of the variables.

The p-value is 2-tailed, by default, unless otherwise specified, as above. If the value of the argument adjust_p equals 1, then the probability values themselves will be adjusted according to the number of comparisons, alpha will remain as given or at .05. The correction is:

    p' = 1 – (1 – p)N

where p is the probability returned by the relevant comparison procedure, and N is the number of pairwise comparisons performed.

By default, returns a hashref of hashrefs, the outer hash keyed by the pairs compared (as a comma-separated string), each with a hashref with keys named t_value, p_value, df, sig (= 1 or 0 depending on its being below or greater than/equal to alpha).

Alternatively, if the value of str => 1, you just get back a referenced array of strings that describe the results, e.g., G1 - G2: t(39) = 2.378, 2p = 0.0224.

Give a value of 1 to dump to automatically print these strings to STDOUT. (Distinct from earlier versions, there is no default dump to STDOUT of the results.)

The output strings are appended with an asterisk if the logical value of the optional attribute flag equals 1 and the p_value is less than the Bonferroni-adjusted alpha level. This alpha level, relative to the given or default alpha of .05, for the number of paired comparisons, is printed at the end of the list.

An alternative (actually, legacy from earlier version) is to use t-tests, rather than F-tests, and this you get if the argument use_t => 1. The module uses Perl's Statistics t-test modules for this purpose, with no accounting for the variance issue.


TO DO: use run() for now

Performs parametric pairwise comparison by F-tests on each possible pair of observations, with respect to the value of independent. This assumes that the variances are unequal, and uses the variance of each sample in the pair in the error-term of the F-value, and the denominator degrees-of-freedom is adjusted accordingly.


TO DO: use run() for now

Performs parametric pairwise comparison by F-tests on each possible pair of observations, with respect to the value of independent. This assumes that the variances are equal, so that the mean-square error ($aov->{'ms_w'}) is used in the error-term of the F-value.


Roderick Garton, <rgarton at>


Please report any bugs or feature requests to bug-statistics-anova-compare-0.01 at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Statistics::ANOVA::Compare

You can also look for information at:


Copyright 2015 Roderick Garton.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.