Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
up/down concordance rate
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