ruby-statistics 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/statistics/statistical_test/t_test.rb +10 -3
- data/lib/statistics/version.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: 298bc7d8dff1aeabc7db9c11fe9d7987f16bde40
|
4
|
+
data.tar.gz: 1d796e62c18052f87fc2616b4c1a5f777080c1ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98e8c58f34668e839be9689c74debd75bd7a6869372536d7e9927a63f77fca59ab05e06b413705f0d286094292cb566c01e6fe71145cdd7d2152fc930829910e
|
7
|
+
data.tar.gz: 37b78191adb8d659f21134346a8a415c5bd7bd8a7dd99b2c1f8d7793a2ea741c43e60d8235a7d5fcc2bc0284b24e8e58e8404e0b4b4401ee3bc60f7e1afc8b8b
|
@@ -39,9 +39,16 @@ module Statistics
|
|
39
39
|
(sample_left_mean - sample_right_mean).abs/standard_error.to_f
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
t_distribution = Distribution::TStudent.new(degrees_of_freedom)
|
43
|
+
probability = t_distribution.cumulative_function(t_score)
|
44
|
+
|
45
|
+
# Steps grabbed from https://support.minitab.com/en-us/minitab/18/help-and-how-to/statistics/basic-statistics/supporting-topics/basics/manually-calculate-a-p-value/
|
46
|
+
# See https://github.com/estebanz01/ruby-statistics/issues/23
|
47
|
+
p_value = if tails == :two_tail
|
48
|
+
2 * (1 - t_distribution.cumulative_function(t_score.abs))
|
49
|
+
else
|
50
|
+
1 - probability
|
51
|
+
end
|
45
52
|
|
46
53
|
{ t_score: t_score,
|
47
54
|
probability: probability,
|
data/lib/statistics/version.rb
CHANGED
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.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- esteban zapata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|