1Statistics::Basic::StdDUesve(r3)Contributed Perl DocumenSttaattiiosntics::Basic::StdDev(3)
2
3
4
6 Statistics::Basic::StdDev - find the standard deviation of a list
7
9 Invoke it this way:
10
11 my $stddev = stddev(1,2,3);
12
13 Or this way:
14
15 my $v1 = vector(1,2,3);
16 my $std = stddev($v1);
17
18 And then either query the values or print them like so:
19
20 print "The stddev of $v1: $std\n";
21 my $sq = $std->query;
22 my $s0 = 0+$std;
23
24 Create a 20 point "moving" stddev like so:
25
26 use Statistics::Basic qw(:all nofill);
27
28 my $sth = $dbh->prepare("select col1 from data where something");
29 my $len = 20;
30 my $std = stddev()->set_size($len);
31
32 $sth->execute or die $dbh->errstr;
33 $sth->bind_columns( my $val ) or die $dbh->errstr;
34
35 while( $sth->fetch ) {
36 $std->insert( $val );
37 if( defined( my $s = $std->query ) ) {
38 print "StdDev: $s\n";
39 }
40
41 # This would also work:
42 # print "StdDev: $s\n" $std->query_filled;
43 }
44
46 new()
47 The constructor takes a list of values, a single array ref, or a
48 single Statistics::Basic::Vector as arguments. It returns a
49 Statistics::Basic::StdDev object.
50
51 Note: normally you'd use the mean() constructor, rather than
52 building these by hand using "new()".
53
54 query_mean()
55 Returns the Statistics::Basic::Mean object used in the standard
56 deviation computation.
57
58 _OVB::import()
59 This module also inherits all the overloads and methods from
60 Statistics::Basic::_OneVectorBase.
61
63 This object is overloaded. It tries to return an appropriate string
64 for the calculation or the value of the computation in numeric context.
65
66 In boolean context, this object is always true (even when empty).
67
69 Paul Miller "<jettero@cpan.org>"
70
71 I am using this software in my own projects... If you find bugs,
72 please please please let me know. :) Actually, let me know if you find
73 it handy at all. Half the fun of releasing this stuff is knowing that
74 people use it.
75
77 Copyright 2012 Paul Miller -- Licensed under the LGPL
78
80 perl(1), Statistics::Basic, Statistics::Basic::_OneVectorBase,
81 Statistics::Basic::Vector
82
83
84
85perl v5.28.1 2012-01-23 Statistics::Basic::StdDev(3)