blib/lib/App/RecordStream/Aggregator/Variance.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 3 totaltotal 87.8% 36 / 41 CC 1 SCAR 1.1
CC
1
Cov
97%
long_usage
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/App/RecordStream/Aggregator/Average.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/Correlation.pm »
1 package App::RecordStream::Aggregator::Variance;
2  
3 7 our $VERSION = "4.0.23";
4  
5 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use App::RecordStream::Aggregator::Ord2Univariate;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use App::RecordStream::Aggregator;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 7 ▶use App::RecordStream::DomainLanguage::Registry;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 7 ▶use base 'App::RecordStream::Aggregator::Ord2Univariate';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 #sub new -- passed through
15  
16 #sub new_from_valuation -- passed through
17  
18 sub squish
19 {
20 1 ▶ my ($this, $cookie) = @_;
Subroutine squish: called CC=1 SCAR=0.0
Pod undocumented
21  
22 1 my ($sum1, $sumx, $sumx2) = @$cookie;
23  
24 1 return ($sumx2 / $sum1) - ($sumx / $sum1) ** 2;
25 }
26  
27 sub long_usage
28 {
29 0 ▶ return <<EOF;
Subroutine long_usage: not called CC=1 SCAR=6.9
Pod undocumented
30 Usage: var,<field1>
31 Variance of specified fields.
32  
33 This is computed as Var(X) = E[(X - E[X])^2]. Variance is an indication of
34 deviation from average value.
35 EOF
36 }
37  
38 sub short_usage
39 {
40 1 ▶ return "find variance of provided field";
Subroutine short_usage: called CC=1 SCAR=0.0
Pod undocumented
41 }
42  
43 7 App::RecordStream::Aggregator->register_implementation('var', __PACKAGE__);
44 7 App::RecordStream::Aggregator->register_implementation('variance', __PACKAGE__);
45  
46 7 App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'var', 'VALUATION');
47 7 App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'variance', 'VALUATION');
48  
49 7 1;
« blib/lib/App/RecordStream/Aggregator/Average.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/Correlation.pm »