NAME

Statistics::RankCorrelation - Compute the rank correlation between two vectors

SYNOPSIS

use Statistics::RankCorrelation qw(binary spearman);

$n = binary(
    [1,   2, 3,   4,      5],
    [0.1, 2, 1.3, 0.004, 50]
);

$n = spearman(
    [1,   2, 3,   4,      5],
    [0.1, 2, 1.3, 0.004, 50]
);

DESCRIPTION

This module computes the rank correlation coefficient between two samples.

This can be thought of as vector similarity in terms of a single value.

As an example, this metric is employed in the study of musical contour similarity and "sample agreement".

EXPORTED FUNCTIONS

binary $VECTOR1, $VECTOR2
$n = binary($u, $v);

Return the "rank correlation" number, which is a single dimensional measure of the values between two vectors.

This returns a measure in the range [-1 .. 1] and is computed using matrices of binary data representing "higher or lower" values in the original vectors.

Please consult the binary item under the SEE ALSO section.

spearman $VECTOR1, $VECTOR2
$n = spearman($u, $v);

Return the "rank correlation" number, which is a single dimensional measure of the values between two vectors.

Please consult the spearman item under the SEE ALSO section.

PRIVATE FUNCTIONS

_pad_vectors()
($u, $v) = _pad_vectors($u, $v);

Append zeros to either input vector for all values in the other that do not have a corresponding value. That is, "pad" the tail of the shorter vector with zero values.

_correlation_matrix()
$matrix = _correlation_matrix($u);

Return the correlation matrix for a single vector.

This function builds a square, binary matrix that represents "higher or lower" value within the vector itself.

SEE ALSO

For the binary function:

http://www2.mdanderson.org/app/ilya/Publications/JNMRcontour.pdf

For the spearman function:

http://www.pinkmonkey.com/studyguides/subjects/stats/chap6/s0606801.asp

TO DO

Remember how to export without using the bloated Exporter module.

Implement other rank correlation measures (as referred to in the SEE ALSO literature).

Add more literature references!

Add the ability to compare more than two phrases simultaneously?

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2003, Gene Boggs

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.