Skip Menu |

This queue is for tickets about the Statistics-Descriptive CPAN distribution.

Report information
The Basics
Id: 62055
Status: resolved
Priority: 0/
Queue: Statistics-Descriptive

People
Owner: Nobody in particular
Requestors: david.breimann [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: percentile method does not work as expected
Date: Mon, 11 Oct 2010 22:35:08 +0200
To: bug-Statistics-Descriptive [...] rt.cpan.org
From: David Breimann <david.breimann [...] gmail.com>
An example: use strict; use warnings; use Statistics::Descriptive; use 5.012; my @data = ( -2, 7, 7, 4, 18, -5 ); my $stat = Statistics::Descriptive::Full->new(); $stat->add_data(@data); say ($stat->percentile(100) // "undef"); # return 18. OK. say ($stat->percentile(0) // "undef"); # return undef instead of "-inf" according to the doc Also see http://stackoverflow.com/questions/3905623/ Thank you Dave
Hi Dave, On Mon Oct 11 16:35:17 2010, david.breimann@gmail.com wrote: Show quoted text
> An example: > > use strict; > use warnings; > use Statistics::Descriptive; > use 5.012; > > my @data = ( -2, 7, 7, 4, 18, -5 ); > my $stat = Statistics::Descriptive::Full->new(); > $stat->add_data(@data); > say ($stat->percentile(100) // "undef"); # return 18. OK. > say ($stat->percentile(0) // "undef"); # return undef instead of > "-inf" according to the doc > > > Also see http://stackoverflow.com/questions/3905623/ > > Thank you > Dave
There appears to be some discrepancy between the documentation and the code and comments. Reading from the comments of percentile: {{{{ ##If the requested percentile is less than the "percentile bin ##size" then return undef. Check description of RFC 2330 in the ##POD below. my $count = $self->count(); return undef if $percentile < 100 / $count; }}}} Since according to that SO thread and my general knowledge it is easier to handle undef() in Perl instead of -inf, I am going to document that -inf will be represented in the percentile as undef. Thanks for the report. I'll correct the documentation and upload a new version on CPAN. Regards, -- Shlomi Fish
On Thu Oct 14 13:33:22 2010, SHLOMIF wrote: Show quoted text
> Since according to that SO thread and my general knowledge it is easier > to handle undef() in Perl instead of -inf, I am going to document that > -inf will be represented in the percentile as undef. > > Thanks for the report. I'll correct the documentation and upload a new > version on CPAN. > > Regards, > > -- Shlomi Fish
The documentation was fixed in the CPAN upload of Statistics-Descriptive-3.0201. Regards, -- Shlomi Fish