Statis...:StdDev(3pm)
β¨ Statistics::Basic::StdDev π
okay so bestie, this page lives in the User Contributed Perl Documentation section of the manual (the 3pm girlies, you know the ones), and it's all about finding the standard deviation of a list. yes. the actual math. we're doing stats today and we're gonna slay it π
π¦ NAME π¦
Statistics::Basic::StdDev β find the standard deviation of a list. that's it, that's the whole job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
ok so you can invoke it this way:
my $stddev = stddev(1,2,3);
or, if you're feeling extra, this way:
my $v1 = vector(1,2,3);
my $std = stddev($v1);
and then you either query the values or print them, like so:
print "The stddev of $v1: $std\n";
my $sq = $std->query;
my $s0 = 0+$std;
want a 20 point "moving" stddev? periodt. here's the vibe:
use Statistics::Basic qw(:all nofill);
my $sth = $dbh->prepare("select col1 from data where something");
my $len = 20;
my $std = stddev()->set_size($len);
$sth->execute or die $dbh->errstr;
$sth->bind_columns( my $val ) or die $dbh->errstr;
while( $sth->fetch ) {
$std->insert( $val );
if( defined( my $s = $std->query ) ) {
print "StdDev: $s\n";
}
# This would also work:
# print "StdDev: $s\n" $std->query_filled;
}
ngl the commented-out line is living rent free in there and it absolutely still counts. lowkey iconic π
π METHODS π
π new()
the constructor, bestie. she takes a list of values, a single array ref, or a single Statistics::Basic::Vector as arguments, and she hands you back a Statistics::Basic::StdDev object. no notes.
Note: normally you'd use themean()constructor, rather than building these by hand usingnew(). fr fr, don't do it the manual way unless you have a reason.
π query_mean()
returns the Statistics::Basic::Mean object that's used in the standard deviation computation. it's giving supporting cast but honestly she's the main character of the math π
π _OVB::import()
this module also inherits all the overloads and methods from Statistics::Basic::_OneVectorBase. so like, the whole family tree comes with it. genetics, bestie π§¬
π OVERLOADS π
this object is overloaded, okay? she's versatile. she tries to return an appropriate string for the calculation, or the value of the computation in numeric context. depending on the situation she just knows what you need. main character energy β¨
in boolean context, this object is always true (even when empty). so like, even an empty stddev is out here being true to herself. we love a confident queen π
π«Ά AUTHOR π«Ά
Paul Miller <jettero@cpan.org>
and he says: I am using this software in my own projects... If you find bugs, please please please let me know. :) β the triple "please" is sending me π β Actually, let me know if you find it handy at all. Half the fun of releasing this stuff is knowing that people use it.
bestie literally just wants to hear from you. tell him the module ate. it's the polite thing to do π
β COPYRIGHT β
Copyright 2012 Paul Miller -- Licensed under the LGPL
π§ SEE ALSO π§
perl(1)Statistics::BasicStatistics::Basic::_OneVectorBaseStatistics::Basic::Vector
go read all of them. the whole friend group is worth your time π¦
and that's the page, bestie π this one came to you courtesy of perl v5.36.0, dated 2022-11-19, from the Statis...:StdDev(3pm) manual. go forth and compute your standard deviations with your whole chest πΈβ¨π
π¦ where this page comes from
- debian bookworm: libstatistics-basic-perl 1.6611-3 Β· LGPL-2.1-only
- debian trixie: libstatistics-basic-perl 1.6611-3 Β· LGPL-2.1-only
- ubuntu noble: libstatistics-basic-perl 1.6611-3 Β· LGPL-2.1-only
- ubuntu resolute: libstatistics-basic-perl 1.6611-3 Β· LGPL-2.1-only
- ubuntu stonking: libstatistics-basic-perl 1.6611-3 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms