enumerable-stats 1.2.2 → 1.3.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/lib/enumerable_stats/enumerable_ext.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0131e566d1175fe367fb75c840914ae752eea76a1a194a8d35a02d24591d6ad
|
4
|
+
data.tar.gz: bb99194f3965132256bb9cdabed80bf58c5da172f7cd10e4f56277c0417fe7d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 022f98715f44e7788749adb509bbef27bf759d2d09c7d946ebbdf21e34ea6e8a7225e011be6ad39e3260cec3f7daad17c61ecefbd9a197457b0e75d9bd10889c
|
7
|
+
data.tar.gz: d1e0a0052b175fe9fc4175961d0b52248c8cc78c39258048fa7846d9e67c8bd2ff6fe6da365b41284b9b9e2d48c8a9c1fcc165d621a25d9227df88716849ae34
|
@@ -93,6 +93,9 @@ module EnumerableStats
|
|
93
93
|
# treatment = [15, 17, 16, 18, 14]
|
94
94
|
# t_stat = control.t_value(treatment) # => ~-4.2 (negative means treatment > control)
|
95
95
|
def t_value(other)
|
96
|
+
raise ArgumentError, "Cannot compare with an empty collection" if empty? || other.empty?
|
97
|
+
raise ArgumentError, "Parameter must be an Enumerable" unless other.respond_to?(:mean)
|
98
|
+
|
96
99
|
signal = (mean - other.mean)
|
97
100
|
noise = Math.sqrt(
|
98
101
|
((standard_deviation**2) / count) +
|
@@ -144,6 +147,16 @@ module EnumerableStats
|
|
144
147
|
t_stat > critical_value
|
145
148
|
end
|
146
149
|
|
150
|
+
# Alias for greater_than?
|
151
|
+
def >(other, alpha: 0.05)
|
152
|
+
greater_than?(other, alpha: alpha)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Alias for less_than?
|
156
|
+
def <(other, alpha: 0.05)
|
157
|
+
less_than?(other, alpha: alpha)
|
158
|
+
end
|
159
|
+
|
147
160
|
# Tests if this collection's mean is significantly less than another collection's mean
|
148
161
|
# using a one-tailed Student's t-test. Returns true if the test indicates statistical
|
149
162
|
# significance at the specified alpha level.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerable-stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Daniel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
A Ruby gem that extends all Enumerable objects (Arrays, Ranges, Sets, etc.) with essential statistical methods.
|