[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] outliers



On Mar 11, 2012, at 3:29 AM, The SuperHitRockStar wrote:
> How did the outlier thing go? I hope all was easy and that your code did the trick. 

Ended up being currency code conversion issues. The morale of that story is "sometimes the data isn't bad, you're reading it wrong. Removing outliers would have made it even more wrong."   :)

Thanks,

Jay Hannah
Project Lead / Programmer
http://www.iinteractive.com
Email: jay.hannah@iinteractive.com
AOL IM: deafferret
Mobile: 1.402.598.7782
Fax: 1.402.691.9496






> From: Jay Hannah <jay.hannah@iinteractive.com>
> To: The SuperHitRockStar <oliverbc@yahoo.com> 
> Sent: Sunday, February 26, 2012 10:36 AM
> Subject: Re: outliers
> 
> Oh. Huh. Here's a simple outlier removal system.
> 
> https://metacpan.org/module/Statistics::Basic#COMPUTED-VECTORS
> 
> :)
> 
> j
> 
> 
> 
> 
> $ cat j.pl
> use Statistics::Basic qw( :all );
> 
> my @a = ( (1,2,3) x 7, 15 );
> 
> my $v1 = vector(@a);
> my $v3 = computed($v1);
> $v3->set_filter(sub {
>   my $m = mean($v1);
>   my $s = stddev($v1);
>   grep { abs($_-$m) <= $s } @_;
> });
> 
> print "$v1\n";
> print "$v3\n";
> 
> 
> $ perl j.pl
> [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 15]
> [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]
> 
>