Does the statistic mean :: The descriptive method of percentiles is documented?

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". see doc below

Statistics :: Descriptive document .

+3
source share
1 answer

The same result on ActiveState 5.12.2 64-bit on the Windows platform. You answered your question: it does not work as described.

#!/usr/bin/perl -w
use strict;
use warnings;
use Statistics::Descriptive;
use Math::Bigint;

use 5.012;

my @data = ( -2, 7, 7, 4, 18, -5 );
my $stat = Statistics::Descriptive::Full->new();
$stat->add_data(@data);
say(Math::BigInt->is_inf($stat->percentile(0)));

returns 0

Edit: as rafl points out, on Windows it perl -e "print(9**9**9);"will be 1.#INFinstead inf. Since inf, apparently, it is not yet implemented in my version, the Statistics package will not be able to return infand returns undefined.

Edit2: As it turns out, OP works on Linux and may return inf, probably the error is related to the package Statistics::Descriptive.

+3

Source: https://habr.com/ru/post/1768962/


All Articles