line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::Role::Statistic; |
2
|
|
|
|
|
|
|
# ABSTRACT: Basic statistics |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1383
|
use App::Sandy::Base 'role'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
7
|
use List::Util 'sum'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
368
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.24'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub with_mean { |
10
|
0
|
|
|
0
|
0
|
|
my ($self, $vet) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
0
|
|
|
|
|
if (ref $vet ne 'ARRAY') { |
13
|
0
|
|
|
|
|
|
croak "vet is not an array ref"; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
return sum(@$vet) / scalar(@$vet); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub with_variance { |
20
|
0
|
|
|
0
|
0
|
|
my ($self, $vet) = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if (ref $vet ne 'ARRAY') { |
23
|
0
|
|
|
|
|
|
croak "vet is not an array ref"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $mean = $self->with_mean($vet); |
27
|
0
|
|
|
|
|
|
my @diff = map { ($_ - $mean) ** 2 } @$vet; |
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return $self->with_mean(\@diff); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub with_stdd { |
33
|
0
|
|
|
0
|
0
|
|
my ($self, $vet) = @_; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if (ref $vet ne 'ARRAY') { |
36
|
0
|
|
|
|
|
|
croak "vet is not an array ref"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return sqrt $self->with_variance($vet); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=encoding UTF-8 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
App::Sandy::Role::Statistic - Basic statistics |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 VERSION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
version 0.24 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHORS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=over 4 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Rafael Mercuri <rmercuri@mochsl.org.br> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=back |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by Teaching and Research Institute from Sírio-Libanês Hospital. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is free software, licensed under: |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |