ruby-statistics 2.1.3 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6612502f03d8077d0158d997a42dfbc4d1002f2ab01ce2b7bdb5fbd510187e3e
4
- data.tar.gz: 14fb04073b5b788dfa9e93aa586daef050dd105c2d2f8bdd17db30ad1fbcf144
3
+ metadata.gz: 2d24a4f34c93f3fe503d089759c1ebe9c0c8f046365a7a05fe98e1fe774a2fb9
4
+ data.tar.gz: e2f203c5a6b9787e40b32124823232e02262cc67bcf834a32cdf65d856f3ca49
5
5
  SHA512:
6
- metadata.gz: '09590f836a59563819a1a847830e5dc2ee3554415cadc81c35b2a0f43ab1af87204f028659e8aa2f30a14b58c69c3e4f65db5e722d0a00ced5d92faa1e7dce82'
7
- data.tar.gz: 2e66a26c23bf1f05cb9de40e992b302c4f0fef13aa70b4e509de479cb15b9700d4032f5d548aa45110f161ef9dac417f9b1872479a02dca0e729a051be2a4fc8
6
+ metadata.gz: a66b711b99291f06b57cbca0b103bc68c702e29e8f9191bff3b141c5cc382733a12bd077311110db2a5e38af41df0d9d7879c1fd0da9f5eedc0de257dd08dc2e
7
+ data.tar.gz: e6d3405f7e0c6e81c6f935f3197e9111005fb8242bc95409670b895b59fe17645e8edff0708f28e790eac8997c8f52bddd79d52d6ff6c03298332505d3117d4d
@@ -3,31 +3,48 @@ name: Ruby
3
3
  on: [push]
4
4
 
5
5
  jobs:
6
- build:
6
+ build: # Latest ruby
7
7
 
8
8
  runs-on: ubuntu-latest
9
9
 
10
10
  steps:
11
- - uses: actions/checkout@v2.3.4
12
- - name: Set up Ruby 2.6
13
- uses: actions/setup-ruby@v1.1.2
11
+ - uses: actions/checkout@v3
12
+ - name: Set up Ruby 3.1
13
+ uses: ruby/setup-ruby@v1.120.0
14
14
  with:
15
- ruby-version: 2.6.x
15
+ ruby-version: 3.1.2
16
16
  - name: Build and test with Rake
17
17
  run: |
18
18
  gem install bundler
19
19
  bundle install --jobs 2 --retry 1
20
20
  bundle exec rake
21
+
21
22
  build_2_7:
22
23
 
23
24
  runs-on: ubuntu-latest
24
25
 
25
26
  steps:
26
- - uses: actions/checkout@v2.3.4
27
+ - uses: actions/checkout@v3
27
28
  - name: Set up Ruby 2.7
28
- uses: actions/setup-ruby@v1.1.2
29
+ uses: ruby/setup-ruby@v1.120.0
30
+ with:
31
+ ruby-version: 2.7.6
32
+ - name: Build and test with Rake
33
+ run: |
34
+ gem install bundler
35
+ bundle install --jobs 2 --retry 1
36
+ bundle exec rake
37
+
38
+ build_3_0:
39
+
40
+ runs-on: ubuntu-latest
41
+
42
+ steps:
43
+ - uses: actions/checkout@v3
44
+ - name: Set up Ruby 3.0
45
+ uses: ruby/setup-ruby@v1.120.0
29
46
  with:
30
- ruby-version: 2.7.x
47
+ ruby-version: 3.0.4
31
48
  - name: Build and test with Rake
32
49
  run: |
33
50
  gem install bundler
data/README.md CHANGED
@@ -5,11 +5,9 @@
5
5
  A basic ruby gem that implements some statistical methods, functions and concepts to be used in any ruby environment without depending on any mathematical software like `R`, `Matlab`, `Octave` or similar.
6
6
 
7
7
  Unit test runs under the following ruby versions:
8
- * Ruby 2.5.1.
9
- * Ruby 2.6.0.
10
- * Ruby 2.6.3.
11
- * Ruby 2.6.5.
12
- * Ruby 2.7.
8
+ * Ruby 2.7.6.
9
+ * Ruby 3.0.4.
10
+ * Ruby 3.1.2.
13
11
 
14
12
  We got the inspiration from the folks at [JStat](https://github.com/jstat/jstat) and some interesting lectures about [Keystroke dynamics](http://www.biometric-solutions.com/keystroke-dynamics.html).
15
13
 
data/lib/math.rb CHANGED
@@ -46,7 +46,10 @@ module Math
46
46
 
47
47
  def self.lower_incomplete_gamma_function(s, x)
48
48
  # The greater the iterations, the better. That's why we are iterating 10_000 * x times
49
- self.simpson_rule(0, x.to_r, (10_000 * x.round).round) do |t|
49
+ iterator = (10_000 * x.round(1)).round
50
+ iterator = 100_000 if iterator.zero?
51
+
52
+ self.simpson_rule(0, x.to_r, iterator) do |t|
50
53
  (t ** (s - 1)) * Math.exp(-t)
51
54
  end
52
55
  end
@@ -101,9 +104,9 @@ module Math
101
104
 
102
105
  d = 1.0 + numerator * d
103
106
  d = tiny if d.abs < tiny
104
- d = 1.0 / d
107
+ d = 1.0 / d.to_r
105
108
 
106
- c = 1.0 + numerator / c
109
+ c = 1.0 + numerator / c.to_r
107
110
  c = tiny if c.abs < tiny
108
111
 
109
112
  cd = (c*d).freeze
@@ -5,7 +5,3 @@ module Statistics
5
5
  end
6
6
  end
7
7
 
8
- # If Distribution is not defined, setup alias.
9
- if defined?(Statistics) && !(defined?(Distribution))
10
- Distribution = Statistics::Distribution
11
- end
@@ -1,3 +1,3 @@
1
1
  module Statistics
2
- VERSION = "2.1.3"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - esteban zapata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-04 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 3.1.4
167
+ rubygems_version: 3.3.7
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: A ruby gem for som specific statistics. Inspired by the jStat js library.