r40359 - in /trunk/libstatistics-descriptive-perl: Changes MANIFEST META.yml Makefile.PL debian/changelog debian/control debian/libstatistics-descriptive-perl.docs debian/rules lib/Statistics/Descriptive.pm t/quantile.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Mon Jul 20 17:57:41 UTC 2009


Author: ansgar-guest
Date: Mon Jul 20 17:56:56 2009
New Revision: 40359

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=40359
Log:
* New upstream release
* Use minimal debian/rules.
* Add myself to Uploaders.
* Bump Standards-Version to 3.8.2 (no changes).
* No longer install README (points to POD documentation).

Added:
    trunk/libstatistics-descriptive-perl/t/quantile.t
      - copied unchanged from r40355, branches/upstream/libstatistics-descriptive-perl/current/t/quantile.t
Modified:
    trunk/libstatistics-descriptive-perl/Changes
    trunk/libstatistics-descriptive-perl/MANIFEST
    trunk/libstatistics-descriptive-perl/META.yml
    trunk/libstatistics-descriptive-perl/Makefile.PL
    trunk/libstatistics-descriptive-perl/debian/changelog
    trunk/libstatistics-descriptive-perl/debian/control
    trunk/libstatistics-descriptive-perl/debian/libstatistics-descriptive-perl.docs
    trunk/libstatistics-descriptive-perl/debian/rules
    trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm

Modified: trunk/libstatistics-descriptive-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/Changes?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/Changes (original)
+++ trunk/libstatistics-descriptive-perl/Changes Mon Jul 20 17:56:56 2009
@@ -1,4 +1,8 @@
 Revision history for Perl extension Statistics::Descriptive.
+
+3.0100      July 20, 2009
+    - Added the quantile method - thanks to Djibril Ousmanou (DJIBEL).
+        - https://rt.cpan.org/Ticket/Display.html?id=47948
 
 3.0000      May 29, 2009
     - Added tests (for ->count, ->sum, ->sumsq, ->min, ->max)

Modified: trunk/libstatistics-descriptive-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/MANIFEST?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/MANIFEST (original)
+++ trunk/libstatistics-descriptive-perl/MANIFEST Mon Jul 20 17:56:56 2009
@@ -12,4 +12,5 @@
 t/freq_distribution-1-rt-34999.t
 t/pod-coverage.t
 t/pod.t
+t/quantile.t
 UserSurvey.txt

Modified: trunk/libstatistics-descriptive-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/META.yml?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/META.yml (original)
+++ trunk/libstatistics-descriptive-perl/META.yml Mon Jul 20 17:56:56 2009
@@ -1,6 +1,6 @@
 ---
 name: Statistics-Descriptive
-version: 3.0000
+version: 3.0100
 author:
   - 'Shlomi Fish <shlomif at iglu.org.il>'
 abstract: Module of basic descriptive statistical functions.
@@ -9,25 +9,27 @@
   homepage: http://web-cpan.berlios.de/modules/Statistics-Descriptive/
   license: http://dev.perl.org/licenses/
   repository: http://svn.berlios.de/svnroot/repos/web-cpan/Statistics-Descriptive/
+build_requires:
+  Benchmark: 0
+  Test::More: 0
+  lib: 0
 requires:
   Carp: 0
   POSIX: 0
   strict: 0
   vars: 0
   warnings: 0
-build_requires:
-  Benchmark: 0
-  Test::More: 0
-  lib: 0
+configure_requires:
+  Module::Build: 0.34
 provides:
   Statistics::Descriptive:
     file: lib/Statistics/Descriptive.pm
-    version: 3.0000
+    version: 3.0100
   Statistics::Descriptive::Full:
     file: lib/Statistics/Descriptive.pm
   Statistics::Descriptive::Sparse:
     file: lib/Statistics/Descriptive.pm
-generated_by: Module::Build version 0.33
+generated_by: Module::Build version 0.34
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
   version: 1.4

Modified: trunk/libstatistics-descriptive-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/Makefile.PL?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/Makefile.PL (original)
+++ trunk/libstatistics-descriptive-perl/Makefile.PL Mon Jul 20 17:56:56 2009
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.33
+# Note: this file was auto-generated by Module::Build::Compat version 0.34
 use ExtUtils::MakeMaker;
 WriteMakefile
 (

Modified: trunk/libstatistics-descriptive-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/debian/changelog?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/debian/changelog (original)
+++ trunk/libstatistics-descriptive-perl/debian/changelog Mon Jul 20 17:56:56 2009
@@ -1,8 +1,16 @@
-libstatistics-descriptive-perl (3.0000-2) UNRELEASED; urgency=low
+libstatistics-descriptive-perl (3.0100-1) unstable; urgency=low
 
+  [ Nathan Handler ]
   * debian/watch: Update to ignore development releases.
 
- -- Nathan Handler <nhandler at ubuntu.com>  Sat, 06 Jun 2009 01:37:18 +0000
+  [ Ansgar Burchardt ]
+  * New upstream release
+  * Use minimal debian/rules.
+  * Add myself to Uploaders.
+  * Bump Standards-Version to 3.8.2 (no changes).
+  * No longer install README (points to POD documentation).
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Mon, 20 Jul 2009 19:55:38 +0200
 
 libstatistics-descriptive-perl (3.0000-1) unstable; urgency=low
 

Modified: trunk/libstatistics-descriptive-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/debian/control?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/debian/control (original)
+++ trunk/libstatistics-descriptive-perl/debian/control Mon Jul 20 17:56:56 2009
@@ -5,8 +5,8 @@
 Build-Depends-Indep: perl, libtest-pod-perl, libtest-pod-coverage-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Carlo Segre <segre at debian.org>, Russ Allbery <rra at debian.org>,
- Ryan Niebur <ryanryan52 at gmail.com>
-Standards-Version: 3.8.1
+ Ryan Niebur <ryanryan52 at gmail.com>, Ansgar Burchardt <ansgar at 43-1.org>
+Standards-Version: 3.8.2
 Homepage: http://search.cpan.org/dist/Statistics-Descriptive/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libstatistics-descriptive-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libstatistics-descriptive-perl/

Modified: trunk/libstatistics-descriptive-perl/debian/libstatistics-descriptive-perl.docs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/debian/libstatistics-descriptive-perl.docs?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/debian/libstatistics-descriptive-perl.docs (original)
+++ trunk/libstatistics-descriptive-perl/debian/libstatistics-descriptive-perl.docs Mon Jul 20 17:56:56 2009
@@ -1,2 +1,1 @@
-README
 UserSurvey.txt

Modified: trunk/libstatistics-descriptive-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/debian/rules?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/debian/rules (original)
+++ trunk/libstatistics-descriptive-perl/debian/rules Mon Jul 20 17:56:56 2009
@@ -1,23 +1,3 @@
 #!/usr/bin/make -f
-
-build: build-stamp
-build-stamp:
-	dh build
-	touch $@
-
-clean:
+%:
 	dh $@
-
-install: install-stamp
-install-stamp: build-stamp
-	dh install
-	touch $@
-
-binary-arch:
-
-binary-indep: install
-	dh $@
-
-binary: binary-arch binary-indep
-
-.PHONY: binary binary-arch binary-indep install clean build

Modified: trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm?rev=40359&op=diff
==============================================================================
--- trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm (original)
+++ trunk/libstatistics-descriptive-perl/lib/Statistics/Descriptive.pm Mon Jul 20 17:56:56 2009
@@ -10,7 +10,7 @@
 		  ##Perl5.  01-03 weren't bug free.
 use vars (qw($VERSION $Tolerance));
 
-$VERSION = '3.0000';
+$VERSION = '3.0100';
 
 $Tolerance = 0.0;
 
@@ -409,6 +409,38 @@
         $self->_median($self->_calc_new_median());
     }
     return $self->_median();
+}
+
+sub quantile {
+    my ( $self, $QuantileNumber ) = @_;
+
+    unless ( defined $QuantileNumber and $QuantileNumber =~ m/^0|1|2|3|4$/ ) {
+       carp("Bad quartile type, must be 0, 1, 2, 3 or 4\n");
+       return;
+    }
+    
+    $self->sort_data();
+
+    return $self->_data->[0] if ( $QuantileNumber == 0 );
+
+    my $count = $self->count();
+
+    return $self->_data->[ $count - 1 ] if ( $QuantileNumber == 4 );
+
+    my $K_quantile = ( ( $QuantileNumber / 4 ) * ( $count - 1 ) + 1 );
+    my $F_quantile = $K_quantile - POSIX::floor($K_quantile);
+    $K_quantile = POSIX::floor($K_quantile);
+
+    # interpolation
+    my $aK_quantile     = $self->_data->[ $K_quantile - 1 ];
+    return $aK_quantile if ( $F_quantile == 0 );
+    my $aKPlus_quantile = $self->_data->[$K_quantile];
+    
+    # Calcul quantile
+    my $quantile = $aK_quantile
+      + ( $F_quantile * ( $aKPlus_quantile - $aK_quantile ) );
+
+    return $quantile;
 }
 
 sub _real_calc_trimmed_mean
@@ -916,6 +948,35 @@
 If the percentile method is called in a list context then it will
 also return the index of the percentile.
 
+=item $x = $stat->quantile($Type);
+
+Sorts the data and returns estimates of underlying distribution quantiles based on one 
+or two order statistics from the supplied elements.
+
+This method use the same algorithm as Excel and R language (quantile B<type 7>).
+
+The generic function quantile produces sample quantiles corresponding to the given probabilities.
+
+B<$Type> is an integer value between 0 to 4 :
+
+  0 => zero quartile (Q0) : minimal value
+  1 => first quartile (Q1) : lower quartile = lowest cut off (25%) of data = 25th percentile
+  2 => second quartile (Q2) : median = it cuts data set in half = 50th percentile
+  3 => third quartile (Q3) : upper quartile = highest cut off (25%) of data, or lowest 75% = 75th percentile
+  4 => fourth quartile (Q4) : maximal value
+
+Exemple : 
+
+  my @data = (1..10);
+  my $stat = Statistics::Descriptive::Full->new();
+  $stat->add_data(@data);
+  print $stat->quantile(0); # => 1
+  print $stat->quantile(1); # => 3.25
+  print $stat->quantile(2); # => 5.5
+  print $stat->quantile(3); # => 7.75
+  print $stat->quantile(4); # => 10
+
+
 =item $stat->median();
 
 Sorts the data and returns the median value of the data.




More information about the Pkg-perl-cvs-commits mailing list