Created
May 18, 2011 17:25
-
-
Save waffle2k/979060 to your computer and use it in GitHub Desktop.
Run some simple stats on a bunch of integers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[prod.b]pblair@b009:/mail/log/log01/smtprelay/20110518$ cat ~/stats.pl | |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use lib("/home/pblair/lib"); | |
use Statistics::Descriptive; | |
my $stat = Statistics::Descriptive::Full->new(); | |
while(<>){ | |
$stat->add_data( $_ ); | |
} | |
my $mean = $stat->mean(); | |
my $var = $stat->variance(); | |
my $tm = $stat->trimmed_mean(.25); | |
my $std = $stat->standard_deviation(); | |
$Statistics::Descriptive::Tolerance = 1e-10; | |
printf "Mean: %10.4f Var: %10.4f Std Dev: %10.4f Trimmed mean: %10.4f\n", | |
$mean, | |
$var, | |
$std, | |
$tm ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment