Here is an attempt at implementing the Hampel identifier method that is mentioned in the article. However, reliable identification of outliers is problematic with so few datapoints.
#!/usr/bin/env perl use strict; use warnings; use Statistics::Descriptive; use List::Util qw/min max/; my $stat = Statistics::Descriptive::Full->new(); #my @data = (4, 4, 3, 2); # "A" data #my @data = (1, 5, 6); # "B" data #my @data = (1, 80000, 2, 4, 1200); # "C" data my @data = (0.1, 1500, 1700, 2100, 3200); # "D" data print "Starting data: ", join(", ", @data), "\n\n"; $stat->add_data(@data); # References # http://exploringdatablog.blogspot.com/2013/02/finding-outliers-in-nu +merical-data.html # https://en.wikipedia.org/wiki/Median_absolute_deviation my $median = $stat->median(); my @abs_res = map { abs($median - $_) } @data; my $abs_res_stat = Statistics::Descriptive::Full->new(); $abs_res_stat->add_data(@abs_res); my $MAD = $abs_res_stat->median(); my $t = 3; my $lower_limit = $median-$t*$MAD; my $upper_limit = $median+$t*$MAD; print " Median: $median\n"; print " MAD: $MAD\n"; print " t: $t\n\n"; print "Lower limit: $lower_limit\n"; print "Upper Limit: $upper_limit\n\n"; my @filtered_data; foreach my $datum (@data) { my $is_outlier = (($datum < $lower_limit) or ($datum > $upper_limi +t)) ? 1 : 0; unless($is_outlier) { push @filtered_data, $datum }; } print "Filtered data: ", join(", ", @filtered_data), "\n\n"; print "Minimum value of filtered data is: ", min(@filtered_data), "\n +"; exit;

In reply to Re^2: How to best eliminate values in a list that are outliers by kevbot
in thread How to best eliminate values in a list that are outliers by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.