Skip to content

Instantly share code, notes, and snippets.

@ceekz
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceekz/0ad19287e32d0cb514c7 to your computer and use it in GitHub Desktop.
Save ceekz/0ad19287e32d0cb514c7 to your computer and use it in GitHub Desktop.
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