Skip Menu |

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

Report information
The Basics
Id: 23877
Status: rejected
Worked: 10 min
Priority: 0/
Queue: Statistics-Descriptive

People
Owner: SHLOMIF [...] cpan.org
Requestors: vassilii [...] cs.bgu.ac.il
Cc:
AdminCc:

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



Subject: please implement higher moments/skew/kurtosis
Date: Sun, 10 Dec 2006 19:01:35 +0200
To: bug-Statistics-Descriptive [...] rt.cpan.org
From: Vassilii Khachaturov <vassilii [...] cs.bgu.ac.il>
Thanks a lot for the Statistics::Descriptive module. It would be nice if it supported the centered moments higher than 2, and then, while at it, also things like skew/kurtosis. Perhaps the # of higher moments to track could be an optional argument to the ctor. Vassilii
Subject: Re: [rt.cpan.org #23877] a lazy man's version of skew/kurtosis
Date: Thu, 04 Jan 2007 12:01:23 +0200
To: bug-Statistics-Descriptive [...] rt.cpan.org
From: Vassilii Khachaturov <vassilii [...] tarunz.org>
Just to bump it up, let me post a lazy man's version of the computation that I had implemented. It suffers from 2 drawbacks 1) i don't ever cache the results 2) I didn't try to do it online (and hence put it into Sparse), because I was lazy at estimating the accumulated numerical errors. Therefore I am showing it implemented as a subclass of Full, but one can easily just shove the same methods I provide into Full directly (at least, add the caching if you do so). Adding something to Simple in a rewritten online form would be the best, of course. Even better would be to generalize the accumulation of centered higher moments, providing up to which moments one is interested on the construction, maybe, and rewriting the skew/kurtosis in these generic methods' terms. Vassilii { package Statistics::Descriptive::FullWithSkewAndKurtosis; @ISA = qw(Statistics::Descriptive::Full); sub skew { my $self = shift; my $mean = $self->{mean}; my $sd = $self->{standard_deviation}; my $count = $self->{count}; my $skew = 0; for (@{ $self->{data} }) { $skew += ( ($_ - $mean)/$sd ) ** 3 / $count; } return $skew; } sub kurtosis { my $self = shift; my $mean = $self->{mean}; my $sd = $self->{standard_deviation}; my $count = $self->{count}; my $kurt = 0; for (@{ $self->{data} }) { $kurt += ( ($_ - $mean)/$sd ) ** 4 / $count; } return $kurt - 3; } }
On Thu Jan 04 05:01:58 2007, vassilii@tarunz.org wrote: Show quoted text
> Just to bump it up, let me post a lazy man's version of the computation > that I had implemented. It suffers from 2 drawbacks 1) i don't ever > cache the results 2) I didn't try to do it online (and hence put it into > Sparse), because I was lazy at estimating the accumulated numerical
errors. Show quoted text
> > Therefore I am showing it implemented as a subclass of Full, but one can > easily just shove the same methods I provide into Full directly (at > least, add the caching if you do so). Adding something to Simple in a > rewritten online form would be the best, of course. Even better would > be to generalize the accumulation of centered higher moments, providing > up to which moments one is interested on the construction, maybe, and > rewriting the skew/kurtosis in these generic methods' terms. > > Vassilii > > { > package Statistics::Descriptive::FullWithSkewAndKurtosis; > @ISA = qw(Statistics::Descriptive::Full); > sub skew { > my $self = shift; > my $mean = $self->{mean}; > my $sd = $self->{standard_deviation}; > my $count = $self->{count}; > my $skew = 0; > for (@{ $self->{data} }) { > $skew += ( ($_ - $mean)/$sd ) ** 3 / $count; > } > return $skew; > } > > sub kurtosis { > my $self = shift; > my $mean = $self->{mean}; > my $sd = $self->{standard_deviation}; > my $count = $self->{count}; > my $kurt = 0; > for (@{ $self->{data} }) { > $kurt += ( ($_ - $mean)/$sd ) ** 4 / $count; > } > return $kurt - 3; > } > } >
Well, we need something better that will work on ::Sparse too, and use the higher moments in the calculation, and not be so execessive on using "/" again and again. Can you supply a patch (along with suitable unit tests) that implements this? Use the repository here: http://svn.berlios.de/svnroot/repos/web-cpan/Statistics-Descriptive/ Otherwise, I fear I may have to close this bug due to lack of interest Regards, Shlomi Fish
Subject: Re: [rt.cpan.org #23877] please implement higher moments/skew/kurtosis
Date: Fri, 22 May 2009 19:57:40 +0300 (IDT)
To: Shlomi Fish via RT <bug-Statistics-Descriptive [...] rt.cpan.org>
From: Vassilii Khachaturov <vassilii [...] cs.bgu.ac.il>
Hi Shlomi, No, I don't think I'm going to implement this any time soon -- too busy, and, as I said along with the patch submission, I'd need to research into the error accumulation to do it meaningfully. If noone needs it, just close the bug. V.
On Fri May 22 12:58:04 2009, vassilii@cs.bgu.ac.il wrote: Show quoted text
> Hi Shlomi, > > No, I don't think I'm going to implement this any time soon -- too busy,
I see. Show quoted text
> and, as I said along with the patch submission, I'd need to research into > the error accumulation to do it meaningfully.
OK. Show quoted text
> If noone needs it, just close the bug.
Very well - that is what I'm going to do. Regards, Shlomi Fish Show quoted text
> > V. >
This issue was rejected due to lack of interest from other people's besides the original poster, and because the original poster did not have the time to properly implement his suggestions himself. Please do not reply to this report, unless you wish to re-open it, because it will re-open it.