Last active
August 29, 2015 14:13
-
-
Save ceekz/0ad19287e32d0cb514c7 to your computer and use it in GitHub Desktop.
up/down concordance rate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub udcr { | |
my ($X, $Y) = @_; | |
if (scalar(@{$X}) < 2 || scalar(@{$X}) != scalar(@{$Y})) { | |
return; | |
} | |
my $j = 0; | |
for (my $i = 1; $i < scalar(@{$X}); $i++) { | |
my $_x = $X->[$i] - $X->[$i - 1]; | |
my $_y = $Y->[$i] - $Y->[$i - 1]; | |
if ($_x == $_y || $_x * $_y > 0) { | |
$j++; | |
} | |
} | |
return $j / (scalar(@{$X}) - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment