descriptive_statistics 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/descriptive_statistics/class_methods.rb +2 -0
- data/lib/descriptive_statistics/mean.rb +1 -1
- data/lib/descriptive_statistics/median.rb +1 -1
- data/lib/descriptive_statistics/percentile.rb +1 -1
- data/lib/descriptive_statistics/percentile_rank.rb +1 -1
- data/lib/descriptive_statistics/range.rb +1 -1
- data/lib/descriptive_statistics/standard_deviation.rb +1 -1
- data/lib/descriptive_statistics/sum.rb +1 -1
- data/lib/descriptive_statistics/variance.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e981e428e540b52e30081acb0032710f554d3e21
|
4
|
+
data.tar.gz: 77d7e94da2d230552ca0ce4d5207f89c1a5f09a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6cdc1e2960d9d0757d7c9f9a6376f157e00993d2ae3ce750e1e10f63cbc69de989bb9e7e0c60eb860ad890ec3822a8c4abe739edd1859b82ee3942a6d4fe97f
|
7
|
+
data.tar.gz: e2c266d82340739389517c43b32423226209320f7757245eaecf5258b614f2b507d870e2be4f2bbb33f717fb13d566924082a13e25f1af0f451d61c9ab9997a2
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DescriptiveStatistics
|
2
2
|
def percentile(p, collection = self)
|
3
3
|
values = Support::convert(collection)
|
4
|
-
return unless values.size > 0
|
4
|
+
return DescriptiveStatistics.empty_collection_default_value unless values.size > 0
|
5
5
|
|
6
6
|
return values.first unless values.size > 1
|
7
7
|
|
@@ -2,7 +2,7 @@ module DescriptiveStatistics
|
|
2
2
|
# percent of cases that are at or below a score
|
3
3
|
def percentile_rank(p, collection = self)
|
4
4
|
values = Support::convert(collection)
|
5
|
-
return unless values.size > 0
|
5
|
+
return DescriptiveStatistics.empty_collection_default_value unless values.size > 0
|
6
6
|
|
7
7
|
return (((values.sort.rindex{ |x| x <= p } || -1.0) + 1.0)) / values.number * 100.0
|
8
8
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DescriptiveStatistics
|
2
2
|
def standard_deviation(collection = self)
|
3
3
|
values = Support::convert(collection)
|
4
|
-
return unless values.size > 0
|
4
|
+
return DescriptiveStatistics.empty_collection_default_value unless values.size > 0
|
5
5
|
|
6
6
|
Math.sqrt(values.variance)
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module DescriptiveStatistics
|
2
2
|
def variance(collection = self)
|
3
3
|
values = Support::convert(collection)
|
4
|
-
return unless values.size > 0
|
4
|
+
return DescriptiveStatistics.empty_collection_default_value unless values.size > 0
|
5
5
|
|
6
6
|
mean = values.mean
|
7
7
|
values.map{ |sample| (mean - sample) ** 2 }.inject(:+) / values.number
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: descriptive_statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derrick Parkhurst
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-09-
|
15
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
16
16
|
dependencies: []
|
17
17
|
description: Adds descriptive statistics methods to Enumerable module for use on collections
|
18
18
|
or Numeric data
|