lite-statistics 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +62 -58
- data/README.md +9 -3
- data/lib/generators/lite/statistics/install_generator.rb +0 -2
- data/lib/generators/lite/statistics/templates/install.rb +1 -3
- data/lib/lite/statistics.rb +4 -5
- data/lib/lite/statistics/descriptive.rb +31 -7
- data/lib/lite/statistics/monkey_patches.rb +26 -0
- data/lib/lite/statistics/version.rb +1 -1
- data/lite-statistics.gemspec +2 -1
- metadata +18 -5
- data/lib/lite/statistics/configuration.rb +0 -35
- data/lib/lite/statistics/enumerable.rb +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5c18db2a915e224bdbb1a5c050981081c13f34a3d52d657ca9a4722ecabcdb0
|
|
4
|
+
data.tar.gz: a2dfefd9a035cae2c2a8edc94b780a223ef82d0e0bcba30749cb98bd5d2dc894
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4985ecca273499b14fa2e017ca818c2fc9c0462f182f22cad0f5dd09080ff836eaf4b9a27b29defe2eacefaca20618e6684570c674d012edc995d93958277810
|
|
7
|
+
data.tar.gz: 8b2fa9ce8091ffe8947340878875079ec151b23ec530d8fd49c08d7c32cf0353ade26eefc36ca9efd812bd6cb382e4676048875c8980db8f3899fd2f9b15374f
|
data/.rubocop.yml
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
require:
|
|
2
2
|
- rubocop-performance
|
|
3
|
+
- rubocop-rake
|
|
3
4
|
- rubocop-rspec
|
|
4
5
|
AllCops:
|
|
5
|
-
TargetRubyVersion:
|
|
6
|
+
TargetRubyVersion: 3.0
|
|
6
7
|
NewCops: enable
|
|
7
8
|
DisplayCopNames: true
|
|
8
9
|
DisplayStyleGuide: true
|
|
@@ -31,6 +32,8 @@ Metrics/ClassLength:
|
|
|
31
32
|
Enabled: false
|
|
32
33
|
Naming/FileName:
|
|
33
34
|
Enabled: false
|
|
35
|
+
Style/ArgumentsForwarding:
|
|
36
|
+
Enabled: false
|
|
34
37
|
Style/Documentation:
|
|
35
38
|
Enabled: false
|
|
36
39
|
Style/ExpandPathArguments:
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.0.0] - 2021-07-22
|
|
10
|
+
### Changed
|
|
11
|
+
- Update install generator to reflect configuration changes
|
|
12
|
+
### Removed
|
|
13
|
+
- Removed configuration to use explicit inclusions
|
|
14
|
+
|
|
15
|
+
## [1.2.1] - 2021-07-21
|
|
16
|
+
### Changed
|
|
17
|
+
- Improved Railtie support
|
|
18
|
+
|
|
19
|
+
## [1.2.0] - 2021-07-19
|
|
20
|
+
### Added
|
|
21
|
+
- Added Ruby 3.0 support
|
|
22
|
+
|
|
23
|
+
## [1.1.1] - 2019-07-05
|
|
24
|
+
### Changed
|
|
25
|
+
- Linter fixes
|
|
26
|
+
|
|
9
27
|
## [1.1.0] - 2019-06-06
|
|
10
28
|
### Changed
|
|
11
29
|
- Removed underscore of quartile numbers
|
data/Gemfile.lock
CHANGED
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lite-statistics (
|
|
4
|
+
lite-statistics (2.0.0)
|
|
5
5
|
lite-memoize
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
actionpack (6.
|
|
11
|
-
actionview (= 6.
|
|
12
|
-
activesupport (= 6.
|
|
13
|
-
rack (~> 2.0, >= 2.0.
|
|
10
|
+
actionpack (6.1.4)
|
|
11
|
+
actionview (= 6.1.4)
|
|
12
|
+
activesupport (= 6.1.4)
|
|
13
|
+
rack (~> 2.0, >= 2.0.9)
|
|
14
14
|
rack-test (>= 0.6.3)
|
|
15
15
|
rails-dom-testing (~> 2.0)
|
|
16
16
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
17
|
-
actionview (6.
|
|
18
|
-
activesupport (= 6.
|
|
17
|
+
actionview (6.1.4)
|
|
18
|
+
activesupport (= 6.1.4)
|
|
19
19
|
builder (~> 3.1)
|
|
20
20
|
erubi (~> 1.4)
|
|
21
21
|
rails-dom-testing (~> 2.0)
|
|
22
22
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
23
|
-
activesupport (6.
|
|
23
|
+
activesupport (6.1.4)
|
|
24
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
25
|
-
i18n (>=
|
|
26
|
-
minitest (
|
|
27
|
-
tzinfo (~>
|
|
28
|
-
zeitwerk (~> 2.
|
|
29
|
-
ast (2.4.
|
|
25
|
+
i18n (>= 1.6, < 2)
|
|
26
|
+
minitest (>= 5.1)
|
|
27
|
+
tzinfo (~> 2.0)
|
|
28
|
+
zeitwerk (~> 2.3)
|
|
29
|
+
ast (2.4.2)
|
|
30
30
|
builder (3.2.4)
|
|
31
31
|
colorize (0.8.1)
|
|
32
|
-
concurrent-ruby (1.1.
|
|
32
|
+
concurrent-ruby (1.1.9)
|
|
33
33
|
crass (1.0.6)
|
|
34
34
|
diff-lcs (1.4.4)
|
|
35
|
-
erubi (1.
|
|
36
|
-
fasterer (0.
|
|
35
|
+
erubi (1.10.0)
|
|
36
|
+
fasterer (0.9.0)
|
|
37
37
|
colorize (~> 0.7)
|
|
38
38
|
ruby_parser (>= 3.14.1)
|
|
39
39
|
generator_spec (0.9.4)
|
|
40
40
|
activesupport (>= 3.0.0)
|
|
41
41
|
railties (>= 3.0.0)
|
|
42
|
-
i18n (1.8.
|
|
42
|
+
i18n (1.8.10)
|
|
43
43
|
concurrent-ruby (~> 1.0)
|
|
44
|
-
lite-memoize (1.
|
|
45
|
-
loofah (2.
|
|
44
|
+
lite-memoize (1.1.1)
|
|
45
|
+
loofah (2.10.0)
|
|
46
46
|
crass (~> 1.0.2)
|
|
47
47
|
nokogiri (>= 1.5.9)
|
|
48
48
|
method_source (1.0.0)
|
|
49
|
-
mini_portile2 (2.
|
|
50
|
-
minitest (5.14.
|
|
51
|
-
nokogiri (1.
|
|
52
|
-
mini_portile2 (~> 2.
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
mini_portile2 (2.5.3)
|
|
50
|
+
minitest (5.14.4)
|
|
51
|
+
nokogiri (1.11.7)
|
|
52
|
+
mini_portile2 (~> 2.5.0)
|
|
53
|
+
racc (~> 1.4)
|
|
54
|
+
parallel (1.20.1)
|
|
55
|
+
parser (3.0.2.0)
|
|
55
56
|
ast (~> 2.4.1)
|
|
57
|
+
racc (1.5.2)
|
|
56
58
|
rack (2.2.3)
|
|
57
59
|
rack-test (1.1.0)
|
|
58
60
|
rack (>= 1.0, < 3)
|
|
@@ -61,56 +63,57 @@ GEM
|
|
|
61
63
|
nokogiri (>= 1.6)
|
|
62
64
|
rails-html-sanitizer (1.3.0)
|
|
63
65
|
loofah (~> 2.3)
|
|
64
|
-
railties (6.
|
|
65
|
-
actionpack (= 6.
|
|
66
|
-
activesupport (= 6.
|
|
66
|
+
railties (6.1.4)
|
|
67
|
+
actionpack (= 6.1.4)
|
|
68
|
+
activesupport (= 6.1.4)
|
|
67
69
|
method_source
|
|
68
|
-
rake (>= 0.
|
|
69
|
-
thor (
|
|
70
|
+
rake (>= 0.13)
|
|
71
|
+
thor (~> 1.0)
|
|
70
72
|
rainbow (3.0.0)
|
|
71
|
-
rake (13.0.
|
|
72
|
-
regexp_parser (1.
|
|
73
|
-
rexml (3.2.
|
|
73
|
+
rake (13.0.6)
|
|
74
|
+
regexp_parser (2.1.1)
|
|
75
|
+
rexml (3.2.5)
|
|
74
76
|
rspec (3.10.0)
|
|
75
77
|
rspec-core (~> 3.10.0)
|
|
76
78
|
rspec-expectations (~> 3.10.0)
|
|
77
79
|
rspec-mocks (~> 3.10.0)
|
|
78
|
-
rspec-core (3.10.
|
|
80
|
+
rspec-core (3.10.1)
|
|
79
81
|
rspec-support (~> 3.10.0)
|
|
80
|
-
rspec-expectations (3.10.
|
|
82
|
+
rspec-expectations (3.10.1)
|
|
81
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
82
84
|
rspec-support (~> 3.10.0)
|
|
83
|
-
rspec-mocks (3.10.
|
|
85
|
+
rspec-mocks (3.10.2)
|
|
84
86
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
85
87
|
rspec-support (~> 3.10.0)
|
|
86
|
-
rspec-support (3.10.
|
|
87
|
-
rubocop (1.
|
|
88
|
+
rspec-support (3.10.2)
|
|
89
|
+
rubocop (1.18.3)
|
|
88
90
|
parallel (~> 1.10)
|
|
89
|
-
parser (>=
|
|
91
|
+
parser (>= 3.0.0.0)
|
|
90
92
|
rainbow (>= 2.2.2, < 4.0)
|
|
91
|
-
regexp_parser (>= 1.8)
|
|
93
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
92
94
|
rexml
|
|
93
|
-
rubocop-ast (>= 1.0.
|
|
95
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
|
94
96
|
ruby-progressbar (~> 1.7)
|
|
95
|
-
unicode-display_width (>= 1.4.0, <
|
|
96
|
-
rubocop-ast (1.
|
|
97
|
-
parser (>=
|
|
98
|
-
rubocop-performance (1.
|
|
99
|
-
rubocop (>=
|
|
97
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
98
|
+
rubocop-ast (1.8.0)
|
|
99
|
+
parser (>= 3.0.1.1)
|
|
100
|
+
rubocop-performance (1.11.4)
|
|
101
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
100
102
|
rubocop-ast (>= 0.4.0)
|
|
101
|
-
rubocop-
|
|
103
|
+
rubocop-rake (0.6.0)
|
|
104
|
+
rubocop (~> 1.0)
|
|
105
|
+
rubocop-rspec (2.4.0)
|
|
102
106
|
rubocop (~> 1.0)
|
|
103
107
|
rubocop-ast (>= 1.1.0)
|
|
104
|
-
ruby-progressbar (1.
|
|
105
|
-
ruby_parser (3.
|
|
106
|
-
sexp_processor (~> 4.
|
|
107
|
-
sexp_processor (4.15.
|
|
108
|
-
thor (1.0
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
zeitwerk (2.4.1)
|
|
108
|
+
ruby-progressbar (1.11.0)
|
|
109
|
+
ruby_parser (3.16.0)
|
|
110
|
+
sexp_processor (~> 4.15, >= 4.15.1)
|
|
111
|
+
sexp_processor (4.15.3)
|
|
112
|
+
thor (1.1.0)
|
|
113
|
+
tzinfo (2.0.4)
|
|
114
|
+
concurrent-ruby (~> 1.0)
|
|
115
|
+
unicode-display_width (2.0.0)
|
|
116
|
+
zeitwerk (2.4.2)
|
|
114
117
|
|
|
115
118
|
PLATFORMS
|
|
116
119
|
ruby
|
|
@@ -124,7 +127,8 @@ DEPENDENCIES
|
|
|
124
127
|
rspec
|
|
125
128
|
rubocop
|
|
126
129
|
rubocop-performance
|
|
130
|
+
rubocop-rake
|
|
127
131
|
rubocop-rspec
|
|
128
132
|
|
|
129
133
|
BUNDLED WITH
|
|
130
|
-
2.
|
|
134
|
+
2.2.24
|
data/README.md
CHANGED
|
@@ -30,13 +30,19 @@ Or install it yourself as:
|
|
|
30
30
|
|
|
31
31
|
## Configurations
|
|
32
32
|
|
|
33
|
+
Any and all monkey patches must be explicitly included anywhere you want to use it.
|
|
34
|
+
|
|
35
|
+
To globally use the monkey patches, just create an initializer requiring them.
|
|
36
|
+
|
|
33
37
|
`rails g lite:statistics:install` will generate the following file:
|
|
34
38
|
`../config/initalizers/lite_statistics.rb`
|
|
35
39
|
|
|
40
|
+
They can be disabled by commenting any of them out.
|
|
41
|
+
|
|
36
42
|
```ruby
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
# frozen_string_literal: true
|
|
44
|
+
|
|
45
|
+
require 'lite/statistics/monkey_patches'
|
|
40
46
|
```
|
|
41
47
|
|
|
42
48
|
## Descriptive
|
data/lib/lite/statistics.rb
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'lite/
|
|
3
|
+
require 'generators/lite/statistics/install_generator' if defined?(Rails::Generators)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require "lite/statistics/#{filename}"
|
|
7
|
-
end
|
|
5
|
+
require 'lite/memoize' unless defined?(Lite::Memoize)
|
|
8
6
|
|
|
9
|
-
require '
|
|
7
|
+
require 'lite/statistics/version'
|
|
8
|
+
require 'lite/statistics/descriptive'
|
|
@@ -6,13 +6,37 @@ module Lite
|
|
|
6
6
|
|
|
7
7
|
extend Lite::Memoize::Alias
|
|
8
8
|
|
|
9
|
-
CALCULATIONS
|
|
10
|
-
frequencies
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
CALCULATIONS = %i[
|
|
10
|
+
frequencies
|
|
11
|
+
max
|
|
12
|
+
mean
|
|
13
|
+
median
|
|
14
|
+
midrange
|
|
15
|
+
min
|
|
16
|
+
mode
|
|
17
|
+
proportions
|
|
18
|
+
percentile_from_value
|
|
19
|
+
population_coefficient_of_variation
|
|
20
|
+
population_kurtosis
|
|
21
|
+
population_size
|
|
22
|
+
population_skewness
|
|
23
|
+
population_standard_deviation
|
|
24
|
+
population_standard_error
|
|
25
|
+
population_summary
|
|
26
|
+
population_variance
|
|
27
|
+
population_zscores
|
|
28
|
+
range
|
|
29
|
+
sample_coefficient_of_variation
|
|
30
|
+
sample_kurtosis
|
|
31
|
+
sample_size
|
|
32
|
+
sample_skewness
|
|
33
|
+
sample_standard_deviation
|
|
34
|
+
sample_standard_error
|
|
35
|
+
sample_summary
|
|
36
|
+
sample_variance
|
|
37
|
+
sample_zscores
|
|
38
|
+
sum
|
|
39
|
+
value_from_percentile
|
|
16
40
|
].freeze
|
|
17
41
|
|
|
18
42
|
def initialize(collection)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Enumerable
|
|
4
|
+
|
|
5
|
+
EXCLUDED_DESCRIPTIVE_CALCULATIONS = %i[max min sum].freeze
|
|
6
|
+
|
|
7
|
+
Lite::Statistics::Descriptive::CALCULATIONS.each do |name|
|
|
8
|
+
next if EXCLUDED_DESCRIPTIVE_CALCULATIONS.include?(name)
|
|
9
|
+
|
|
10
|
+
define_method(name) { |*args| Lite::Statistics::Descriptive.send(name, self, *args) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
alias average mean
|
|
14
|
+
alias coefficient_of_variation sample_coefficient_of_variation
|
|
15
|
+
alias kurtosis sample_kurtosis
|
|
16
|
+
alias midextreme midrange
|
|
17
|
+
alias percentile percentile_from_value
|
|
18
|
+
alias percentile_rank value_from_percentile
|
|
19
|
+
alias skewness sample_skewness
|
|
20
|
+
alias standard_deviation sample_standard_deviation
|
|
21
|
+
alias standard_error sample_standard_error
|
|
22
|
+
alias summary sample_summary
|
|
23
|
+
alias variance sample_variance
|
|
24
|
+
alias zscores sample_zscores
|
|
25
|
+
|
|
26
|
+
end
|
data/lite-statistics.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
)
|
|
26
26
|
else
|
|
27
27
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
|
28
|
-
|
|
28
|
+
'public gem pushes.'
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# Specify which files should be added to the gem when it is released.
|
|
@@ -46,5 +46,6 @@ Gem::Specification.new do |spec|
|
|
|
46
46
|
spec.add_development_dependency 'rspec'
|
|
47
47
|
spec.add_development_dependency 'rubocop'
|
|
48
48
|
spec.add_development_dependency 'rubocop-performance'
|
|
49
|
+
spec.add_development_dependency 'rubocop-rake'
|
|
49
50
|
spec.add_development_dependency 'rubocop-rspec'
|
|
50
51
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lite-statistics
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Gomez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lite-memoize
|
|
@@ -122,6 +122,20 @@ dependencies:
|
|
|
122
122
|
- - ">="
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
124
|
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: rubocop-rake
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
125
139
|
- !ruby/object:Gem::Dependency
|
|
126
140
|
name: rubocop-rspec
|
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -187,9 +201,8 @@ files:
|
|
|
187
201
|
- lib/generators/lite/statistics/install_generator.rb
|
|
188
202
|
- lib/generators/lite/statistics/templates/install.rb
|
|
189
203
|
- lib/lite/statistics.rb
|
|
190
|
-
- lib/lite/statistics/configuration.rb
|
|
191
204
|
- lib/lite/statistics/descriptive.rb
|
|
192
|
-
- lib/lite/statistics/
|
|
205
|
+
- lib/lite/statistics/monkey_patches.rb
|
|
193
206
|
- lib/lite/statistics/version.rb
|
|
194
207
|
- lite-statistics.gemspec
|
|
195
208
|
homepage: http://drexed.github.io/lite-statistics
|
|
@@ -211,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
211
224
|
- !ruby/object:Gem::Version
|
|
212
225
|
version: '0'
|
|
213
226
|
requirements: []
|
|
214
|
-
rubygems_version: 3.
|
|
227
|
+
rubygems_version: 3.2.24
|
|
215
228
|
signing_key:
|
|
216
229
|
specification_version: 4
|
|
217
230
|
summary: Generate statistics from collections of data points
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Lite
|
|
4
|
-
module Statistics
|
|
5
|
-
|
|
6
|
-
class Configuration
|
|
7
|
-
|
|
8
|
-
attr_accessor :monkey_patches
|
|
9
|
-
|
|
10
|
-
def initialize
|
|
11
|
-
@monkey_patches = true
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class << self
|
|
17
|
-
|
|
18
|
-
attr_writer :configuration
|
|
19
|
-
|
|
20
|
-
def configuration
|
|
21
|
-
@configuration ||= Configuration.new
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def configure
|
|
25
|
-
yield(configuration)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def reset_configuration!
|
|
29
|
-
@configuration = Configuration.new
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
if Lite::Statistics.configuration.monkey_patches
|
|
4
|
-
module Enumerable
|
|
5
|
-
|
|
6
|
-
EXCLUDED_DESCRIPTIVE_CALCULATIONS ||= %i[max min sum].freeze
|
|
7
|
-
|
|
8
|
-
Lite::Statistics::Descriptive::CALCULATIONS.each do |name|
|
|
9
|
-
next if EXCLUDED_DESCRIPTIVE_CALCULATIONS.include?(name)
|
|
10
|
-
|
|
11
|
-
define_method(name) { |*args| Lite::Statistics::Descriptive.send(name, self, *args) }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
alias average mean
|
|
15
|
-
alias coefficient_of_variation sample_coefficient_of_variation
|
|
16
|
-
alias kurtosis sample_kurtosis
|
|
17
|
-
alias midextreme midrange
|
|
18
|
-
alias percentile percentile_from_value
|
|
19
|
-
alias percentile_rank value_from_percentile
|
|
20
|
-
alias skewness sample_skewness
|
|
21
|
-
alias standard_deviation sample_standard_deviation
|
|
22
|
-
alias standard_error sample_standard_error
|
|
23
|
-
alias summary sample_summary
|
|
24
|
-
alias variance sample_variance
|
|
25
|
-
alias zscores sample_zscores
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
end
|