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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67bc0d2458936c421a69879c70fa9eb553e48c7447012e87810ce3c4ab028d66
4
- data.tar.gz: 819fcf5e9446b4f7e4a1d7e75aeb914d4ab6ca6a76e65065877d5c3d3bab3634
3
+ metadata.gz: c0131e566d1175fe367fb75c840914ae752eea76a1a194a8d35a02d24591d6ad
4
+ data.tar.gz: bb99194f3965132256bb9cdabed80bf58c5da172f7cd10e4f56277c0417fe7d0
5
5
  SHA512:
6
- metadata.gz: c5dfe0571aa591684f9ae8cf8e26a472695b6a26c424185878a6e7a9bfd2786ee20c205c2eca0be234a88fb25c895fc0d2cb25a599aabbc569375657b5ee1705
7
- data.tar.gz: cd39ddb06cc2cbc1f204deaece6cce9fcf1835583510559a8dd7d24615df95aac16c9a2ff6bd0ba1678c1dce80c0e7636eae6c121e4b7fd31d418b619fed8604
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.2.2
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-02 00:00:00.000000000 Z
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.