1Statistics::Basic::VariUasnecre(C3o)ntributed Perl DocumSetnattaitsitoincs::Basic::Variance(3)
2
3
4

NAME

6       Statistics::Basic::Variance - find the variance of a list
7

SYNOPSIS

9       Invoke it this way:
10
11           my $variance = variance(1,2,3);
12
13       Or this way:
14
15           my $v1  = vector(1,2,3);
16           my $var = var($v1);
17
18       And then either query the values or print them like so:
19
20           print "The variance of $v1: $variance\n";
21           my $vq = $var->query;
22           my $v0 = 0+$var;
23
24       Create a 20 point "moving" variance 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 $var = var()->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               $var->insert( $val );
37               if( defined( my $v = $var->query ) ) {
38                   print "Variance: $v\n";
39               }
40
41               # This would also work:
42               # print "Variance: $v\n" if $var->query_filled;
43           }
44

METHODS

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::Variance 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 variance
56           computation.
57
58       _OVB::import()
59           This module also inherits all the overloads and methods from
60           Statistics::Basic::_OneVectorBase.
61

AUTHOR

63       Paul Miller "<jettero@cpan.org>"
64
65       I am using this software in my own projects...  If you find bugs,
66       please please please let me know. :) Actually, let me know if you find
67       it handy at all.  Half the fun of releasing this stuff is knowing that
68       people use it.
69

OVERLOADS

71       This object is overloaded.  It tries to return an appropriate string
72       for the calculation or the value of the computation in numeric context.
73
74       In boolean context, this object is always true (even when empty).
75
77       Copyright 2012 Paul Miller -- Licensed under the LGPL
78

SEE ALSO

80       perl(1), Statistics::Basic, Statistics::Basic::_OneVectorBase,
81       Statistics::Basic::Vector
82
83
84
85perl v5.34.0                      2022-01-21    Statistics::Basic::Variance(3)
Impressum