Subject: | multiple objects foobars percentile |
When using multiple Statistics::Descriptive objects, results of of the percentile sub are
unpredictable.
=== BEGIN EXAMPLE ===
#!/usr/bin/perl
use Statistics::Descriptive;
$s1 = Statistics::Descriptive::Full->new();
$s2 = Statistics::Descriptive::Full->new();
for (1..10) {
$s1->add_data($_);
$s2->add_data($_);
}
$s2->add_data($_) for (11..20);
printf "%s\t%s\t%s\n", "perc", "set 1", "set 2";
printf "%s\t%d\t%d\n", $_ . "%", $s1->percentile($_), $s2->percentile($_) foreach (25, 75);
=== END EXAMPLE ===
I would expect this to produce
3 and 8 for s1 and 5 and 15 for s2, however it generates:
perc set 1 set 2
25% 3 2
75% 8 7