descriptive-statistics 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2RjNGEwZGM1MjczNmE5NmQ2NDE4OGE0Nzk3MDI5MzAwMDhlNTZlZQ==
4
+ YWY0OGUwNGYzMTE4YmZkOWUzNjllZWJlMmVmMjhkYmZkZjU4MDJmZA==
5
5
  data.tar.gz: !binary |-
6
- ZmQxYWM0YTFkYTkyMDAwZjI3YmU4NTkzMTMxMDE3NTdhYzIzMGQwMQ==
6
+ MzhkNjZlNGY2ODY4OTQ3Njk4ODUwNzlkMDZhNTYwY2I0NzU1ZGRlYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWM0YmM1OGNlMmY2ZTk1Njg5ZmQ0ODU4YTk4ZTljNmUwZjk4YmY3MjRkYjg3
10
- OWFhNmJkNTg5YWVhYmYwYTM5ODBjZmRhNDEyMGE0NTIyY2MxNTU4N2I0YTcx
11
- YjVlY2FjN2E4ZjBlMGRmMjEzZWQ5N2E1MThlNjdmNzVjNzk1NzM=
9
+ ZjIxNDBlODY2ZmIyODY2ZWUwNTc1YzA5OGY1YmVkYmUxN2M2OTE5N2NjYTk4
10
+ ZTlhYTMxN2M4NDUyYTEyODMxMjJhZmZlMGVmODk3OWRiMzU2MTg2YzBmMWQ3
11
+ MTRkYzM4ZTJjNzZkMmJkZTRkOTNmMDY4YzEwYTU2NzNhNWY2MjA=
12
12
  data.tar.gz: !binary |-
13
- YTZkNzNjZTkxODk0YzY5NWYxNGI3NDkxZWMyNTAyMjE4MTI1MmM4NmU2NDZm
14
- ZmIyMzRlOGViMzg3MTU4NjZhYTcwYWY0MjE4ODAwNTdiNDQxYWI3OTgwNzlj
15
- NzMzZDViMWRkYzI0OGMzYmUzMmYxNjJmNjAzZTZlNTEyZmE5MjE=
13
+ NDBjOWVlMTEwODE2NWRiOTIwMTdmODI5MzZlNzIxNjE3ZmQ4NDc1YmM1YWE1
14
+ MTFmNzA2ZDVkMGQwMGMwMzAzZmU0ZjhiMDRhNmViNWIxYTRlMTBkN2RlYjEw
15
+ Mjg4NTg2NGEyOTQ1MWExNGM5ODE1MjMyNGU3YjZlNmY3OGViZWU=
@@ -1,4 +1,2 @@
1
- Y�L��+�����ko��l�c�F�v2>�b��dGY��&�Ϝ��<:xآ���k�2
2
- �GUrl]ە4�R
3
- B���l����
4
- �H�0l#�����8"l�{��&�.Y�v5y���{�����-{Z����b}�����%��m˱�����ǢU����*��?�n�%�<ߤt����^��J�L�6�Z���K¡L�v_ƭP� ��=Y�����`���h��QGGp
1
+ `��
2
+ �fK���2�DZ#0���� �p���^6��+�.�s�����~�=���X�����$P��.�3}��؟[��m/�Y�Ŗ���oF���GJdܢ�U;��а�Ĵ�hIoF�,NF�ߞ�3��қ�&�$���sI2�гi��4wG��� CaF��fy �7�(T�
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- ��(��TQ�ȷsNh�^���~��Cpd���HIZ�����ѯ�;����u@������������uC�(LJ�yJ��,s�9�2�ϖva)��a0.��FBVͣv€r7���d��IY��F3s���m'��S] ��i4��,<2��'|�6mf{�돹=-(¶�e�lz1�٦ZI��СT���y>��4�����\�k�*�XQ:=�A56�����`�OE��$ ~8R- ��!��#؁MT
1
+ �.,�AzG̀�WϢ����Rbva�<���r���2cպ��S� b{���x�����ıI���*j#<�PS���$ [��H:(�=#5�Y6c_1��_6��򣒿�i��P|��9�s�lj�8��:O_hY�ϔ0`(esS#��Oh�:͛�&o���b��!ٷ�;�����ߔ^o���pG�#��Y���q:svm!(�w�.7M�<;�Y.+i8S�Fse\���t��fU^��
@@ -16,7 +16,8 @@ module DescriptiveStatistics
16
16
  private
17
17
 
18
18
  def sum_cubed_deviation
19
- inject(0) {|sum, value| sum + (value - mean) ** 3}
19
+ precalculated_mean = mean
20
+ inject(0) {|sum, value| sum + (value - precalculated_mean) ** 3}
20
21
  end
21
22
 
22
23
  def cubed_standard_deviation
@@ -24,7 +25,8 @@ module DescriptiveStatistics
24
25
  end
25
26
 
26
27
  def sum_quarted_deviation
27
- inject(0) {|sum, value| sum + (value - mean) ** 4}
28
+ precalculated_mean = mean
29
+ inject(0) {|sum, value| sum + (value - precalculated_mean) ** 4}
28
30
  end
29
31
 
30
32
  def quarted_standard_deviation
@@ -32,4 +34,4 @@ module DescriptiveStatistics
32
34
  end
33
35
 
34
36
  end
35
- end
37
+ end
@@ -2,13 +2,15 @@ module DescriptiveStatistics
2
2
  module Spread
3
3
  def variance
4
4
  return if length < 1
5
- sum = self.inject(0) {|accumulator, value| accumulator + (value - mean) ** 2 }
5
+ precalculated_mean = mean
6
+ sum = self.inject(0) {|accumulator, value| accumulator + (value - precalculated_mean) ** 2 }
6
7
  sum / (length.to_f - 1)
7
8
  end
8
9
 
9
10
  def population_variance
10
11
  return if length < 1
11
- sum = self.inject(0) {|accumulator, value| accumulator + (value - mean) ** 2 }
12
+ precalculated_mean = mean
13
+ sum = self.inject(0) {|accumulator, value| accumulator + (value - precalculated_mean) ** 2 }
12
14
  sum / length.to_f
13
15
  end
14
16
 
@@ -19,7 +21,8 @@ module DescriptiveStatistics
19
21
 
20
22
  def relative_standard_deviation
21
23
  return if length < 1
22
- (population_standard_deviation / mean) * 100.0
24
+ precalculated_mean = mean
25
+ (population_standard_deviation / precalculated_mean) * 100.0
23
26
  end
24
27
 
25
28
  def population_standard_deviation
@@ -1,3 +1,3 @@
1
1
  module DescriptiveStatistics
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
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.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Tescher
@@ -35,7 +35,7 @@ cert_chain:
35
35
  V3NaK2F3dzJpU05DNVhGaEEvOHhzSzBCbHRZUkY5blAKSEE0MVV0RHhySmtI
36
36
  TDNOMXo4Z1BNWFNyRlQ0MUZSMndnazgrbDE0UCs3ZzFVVFBpZDJFSXdmdDJ4
37
37
  T2JGZUE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
38
- date: 2014-02-04 00:00:00.000000000 Z
38
+ date: 2014-03-21 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rspec
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.2.0
147
+ rubygems_version: 2.2.2
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Simply calculate descriptive statistics such as measures of central tendency
metadata.gz.sig CHANGED
Binary file