NAME

Statistics::ANOVA::Page - Nonparametric analysis of variance by ranks for trend across repeatedly measured variables (Page and sign tests).

VERSION

This is documentation for Version 0.02 of Statistics::ANOVA::Page.

SYNOPSIS

 use Statistics::ANOVA::Page;
 my $page = Statistics::ANOVA::Page->new();
 $page->load({1 => [2, 4, 6], 2 => [3, 3, 12], 3 => [5, 7, 11, 16]}); # note ordinal datanames
 my $l_value = $page->observed(); # or expected(), variance()
 my ($z_value, $p_value) = $page->zprob_test(ccorr => 2, tails => 1);
 # or without pre-loading:
 $l_value = $page->observed(data => {1 => [2, 4, 6], 2 => [5, 3, 12]});
 # or for subset of loaded data:
 $l_value = $page->observed(lab => [1, 3]);

DESCRIPTION

Calculates Page statistics for nonparametric analysis of variance across given orders of repeatedly measured variables. Ranks are computed exactly as for the Friedman test, but the ranks are weighted according to the ordinal position of the group/level to which they pertain. Also, the test of significance is based on a standardized value, with the p-value read off the normal distribution. Similarly to the relationship between the Kruskal-Wallis and Jonckheere-Terpstra tests for non-dependent observations, the Friedman test returns the same value regardless of the ordinality of the variables as levels, but the Page test is of ranks in association with the ordinality of the variables (as levels rather than groups). These are weighted according to their Perl sort { $a <=> $b} order, so they should have sort-able names that reflect the ordering of the variables.

With only two groups, the test statistic is equivalent to that provided by a sign test.

Build tests include comparison of return values with published data, viz. from Hollander and Wolfe (1999, p. 286ff); passing these tests means the results agree.

SUBROUTINES/METHODS

new

 $page = Statistics::ANOVA::Page->new();

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

load, add, unload

 $page->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.

observed

 $val = $page->observed(); # data pre-loaded
 $val = $page->observed(data => $hashref_of_arefs);

Returns the observed statistic L based on within-group rankings of the data weighted according to the ordinal position of the variable (by its numerical name) to which they pertain.

Optionally, if the data have not been pre-loaded, send as named argument data.

observed_r

 $val = $page->observed_r(); # data pre-loaded
 $val = $page->observed_r(data => $hashref_of_arefs);

This implements a "l2r" transformation: Hollander and Wolfe (1999) describe how Page's L-statistic is directly related to Spearman's rank-order correlation coefficient (see Statistics::RankCorrelation), based on the observed and predicted order of each associated group/level per observation.

expected

 $val = $page->expected(); # data pre-loaded
 $val = $page->expected(data => $hashref_of_arefs);

Returns the expected value of the L statistic for the given data.

variance

 $val = $page->variance(); # data pre-loaded
 $val = $page->variance(data => $hashref_of_arefs);

Return the variance expected to occur in the L values for the given data.

zprob_test

 $p_val = $page->zprob_test(); # data pre-loaded
 $p_val = $page->zprob_test(data => $hashref_of_arefs);
 ($z_val, $p_val) = $page->zprob_test(); # get z-score too

Calculates an expected L value and variance, to provide a normalized L for which the p-value is read off the normal distribution. This is appropriate for "large" samples. Optional arguments are tails and ccorr as in Statistics::Zed.

chiprob_test

 $p_val = $page->chiprob_test(); # data pre-loaded
 $p_val = $page->chiprob_test(data => $hashref_of_arefs);
 ($chi_val, $df, $num, $p_val) = $page->chiprob_test();

Calculates a chi-square statistic based on the observed value of L, the number of ranked variables, and the number of replications; as per Page(1963, Eq. 4). This is a two-tailed test; if the optional argument tails => 1, the returned probability, read off the chi-square distribution, is halved. Called in scalar context, returns the p-value alone. Called in list context, returns the chi-square value, the degrees-of-freedom, number of observations, and then the p-value.

chiprob_str

 $str = $page->chiprob_str(data => HOA, correct_ties => 1);

Performs chiprob_test and returns a string of the conventional reporting form, e.g., chi^2(df, N = total observations) = chi_value, p = p_value.

DIAGNOSTICS

Chi-square probability test not available given limited number of observations

croaked if the denominator value to calculate the chi-square statistic is not defined or zero, which would arise if there is only one between-group level, or zero observations within the levels.

Equal number of observations required for calculating ranks within groups

croaked via Statistics::Data::Rank *_ranks_within methods given that they need to have the same number of observations per group; as when the different factor levels are repeatedly measured on the same replicants. Most methods require this to be the case.

REFERENCES

Hollander, M., & Wolfe, D. A. (1999). Nonparametric statistical methods. New York, NY, US: Wiley.

Page, E. B. (1963). Ordered hypotheses for multiple treatments: A significance test for linear ranks. Journal of the American Statistical Association, 58, 216-230. doi: 10.1080/01621459.1963.10500843. [JSTOR]

DEPENDENCIES

List::AllUtils : provides the handy sum0() function

Math::Cephes : used for probability functions.

Statistics::Data : used as a base for caching and retrieving data.

Statistics::Data::Rank : used to implement cross-case ranking.

Statistics::Zed : for z-testing with optional continuity correction and tailing.

AUTHOR

Roderick Garton, <rgarton at cpan.org>

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-statistics-anova-page-0.02 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Statistics-ANOVA-Page-0.02. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

    perldoc Statistics::ANOVA::Page

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2015-2017 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 http://dev.perl.org/licenses/ for more information.