ministat 1.0.0 → 1.1.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.
data.tar.gz.sig ADDED
Binary file
data/History.txt CHANGED
@@ -1,4 +1,4 @@
1
- == 0.9.0 / 2007-08-02
1
+ == 1.0.0 / 2007-11-11
2
2
 
3
3
  * 1 major enhancement
4
4
  * Birthday!
data/Manifest.txt CHANGED
@@ -4,13 +4,6 @@ README.txt
4
4
  Rakefile
5
5
  bin/ministat
6
6
  lib/ministat.rb
7
- package/History.txt
8
- package/Manifest.txt
9
- package/README.txt
10
- package/Rakefile
11
- package/bin/package
12
- package/lib/package.rb
13
- package/test/test_package.rb
14
7
  test/data/1.dat
15
8
  test/data/2.dat
16
9
  test/test_ministat.rb
data/Rakefile CHANGED
@@ -11,7 +11,8 @@ Hoe.new('ministat', MiniStat::VERSION) do |p|
11
11
  p.summary = 'A small and simple library to generate statistical info on single-variable datasets.'
12
12
  p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
13
13
  p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
14
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
14
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
15
+ p.remote_rdoc_dir = ''
15
16
  end
16
17
 
17
18
  # vim: syntax=Ruby
data/lib/ministat.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'mathn'
2
2
 
3
3
  module MiniStat
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  class Data
6
6
  attr_reader :data
7
7
 
@@ -10,6 +10,14 @@ module MiniStat
10
10
  @sorted = true
11
11
  end
12
12
 
13
+ def <<(obj)
14
+ throw "#{obj.to_s} is not numeric" unless obj.to_f
15
+ @data << obj
16
+ # force computation!
17
+ @q1 = @q3 = @iqr = @outliers = @std_dev = @variance =
18
+ @mode = @harmonic_mean = @geometric_mean = nil
19
+ end
20
+
13
21
  # Return the median of your dataset. Naive implementaion
14
22
  # -- does a sort on the data.
15
23
  def median(data=@data)
@@ -60,7 +68,7 @@ module MiniStat
60
68
 
61
69
  # Computes arthmetic mean (most common average).
62
70
  def mean(data=@data)
63
- (data.inject(0) {|i,j| i += j}) / data.size
71
+ @mean = (data.inject(0) {|i,j| i += j}) / data.size
64
72
  end
65
73
 
66
74
  # Computes mode and a histogram.
@@ -124,4 +132,4 @@ module MiniStat
124
132
  DATA_STR
125
133
  end
126
134
  end
127
- end
135
+ end
@@ -22,6 +22,13 @@ class TestMiniStat < Test::Unit::TestCase
22
22
  @error = 0.001
23
23
  end
24
24
 
25
+ def test_enum
26
+ ms = MiniStat::Data.new([1])
27
+ assert ms.mean == 1
28
+ ms << 2
29
+ assert ms.mean == 1.5
30
+ end
31
+
25
32
  def test_iqr
26
33
  assert(@ms1.iqr - 25 < @error)
27
34
  end
metadata CHANGED
@@ -1,33 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: ministat
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2007-11-11 00:00:00 -08:00
8
- summary: A small and simple library to generate statistical info on single-variable datasets.
9
- require_paths:
10
- - lib
11
- email: dean@ero.com
12
- homepage: " by Dean Hudson"
13
- rubyforge_project: ministat
14
- description: "== FEATURES/PROBLEMS: * Pure Ruby * It's small and simple * It's probably good enough * I haven't profiled it against large data sets * Naive median implementation requires a sort, but it could be done in linear time. Patches welcome. * Missing tests for harmonic and geometric mean -- the stats package I was generating test data with didn't have them. == SYNOPSIS: require 'ministat' data = [1,2,3,4,5,6,7,7,6,5,4,4] puts MiniStat::Data.new(data).to_s"
4
+ version: 1.1.0
5
+ platform: ""
6
+ authors:
7
+ - Dean Hudson
15
8
  autorequire:
16
- default_executable:
17
9
  bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
25
- platform: ruby
26
- signing_key:
27
10
  cert_chain:
28
- post_install_message:
29
- authors:
30
- - Dean Hudson
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDJjCCAg6gAwIBAgIBADANBgkqhkiG9w0BAQUFADA5MQ0wCwYDVQQDDARkZWFu
14
+ MRMwEQYKCZImiZPyLGQBGRYDZXJvMRMwEQYKCZImiZPyLGQBGRYDY29tMB4XDTA3
15
+ MTExMTIxMDUyOFoXDTA4MTExMDIxMDUyOFowOTENMAsGA1UEAwwEZGVhbjETMBEG
16
+ CgmSJomT8ixkARkWA2VybzETMBEGCgmSJomT8ixkARkWA2NvbTCCASIwDQYJKoZI
17
+ hvcNAQEBBQADggEPADCCAQoCggEBALaFLGaIMK1QdFGuO8RfaYTiSwac2GHdEaMb
18
+ p9s8n0zf+tpRMY8NigtrEnJCEvUSMMRhQ1kfxxFYBNbzKh281utzxPmmP7kGFfRD
19
+ e9EW1ZTrDPC564ZEE15blpbMEi2aIwLc2BMajLkAm2szjQJcvknwnxzkKPI1qFTb
20
+ 8EsDY0rJbgXv9agthbgeXCplg16LKxUKjBYvsEWyiE+DgogIMrgJ3nlR2MOCufLm
21
+ gIrhOH0+RUbhR6c8D+KMkb/ecMhuYJ4gK30C2013J7TM7cPj//9Rb0vrmFXzV3ce
22
+ qOESBIu1Ig2Ni9n/otr/bHvkKxdGU7SVeu3uvJX++iKfEMpDleUCAwEAAaM5MDcw
23
+ CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFK/N1WFuLd0IX64NCuNS
24
+ EwukScaTMA0GCSqGSIb3DQEBBQUAA4IBAQAUNmyZYE62GPVkxZnrjH+rI3YkcTYK
25
+ fCWGy67mPo1utCKptzki7rHcpD0d6tlGKqBqkBis1HgIBSrxRV7oEK4UYvbd5jN3
26
+ yUoj670OYuNJpYNnX6Iutv3dEwpcK92zGhTxQqKEjhjvtLFCsQQ8kB2pD+luxPzL
27
+ XHfIWVfPxvVErhBKL2BulZoHJeR4af0ycfZjDAbIbuBoYtnyN6Ao8pI3fctd83DU
28
+ UkMkLYctGf1HBjckiVT2aIOnbMiq2ZbsjXZil3LUBifYtRXJFxphEH/PohNttnlh
29
+ 0exsBRogOA9ZeNEwstSUQ4t1X3FLmOpayH1iM25aKmmaGbCeA6TVEd/5
30
+ -----END CERTIFICATE-----
31
+
32
+ date: 2008-01-08 00:00:00 -08:00
33
+ default_executable:
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ version_requirement:
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.3.0
43
+ version:
44
+ description: "== FEATURES/PROBLEMS: * Pure Ruby * It's small and simple * It's probably good enough * I haven't profiled it against large data sets * Naive median implementation requires a sort, but it could be done in linear time. Patches welcome. * Missing tests for harmonic and geometric mean -- the stats package I was generating test data with didn't have them. == SYNOPSIS: require 'ministat' data = [1,2,3,4,5,6,7,7,6,5,4,4] puts MiniStat::Data.new(data).to_s"
45
+ email: dean@ero.com
46
+ executables:
47
+ - ministat
48
+ extensions: []
49
+
50
+ extra_rdoc_files:
51
+ - History.txt
52
+ - Manifest.txt
53
+ - README.txt
31
54
  files:
32
55
  - History.txt
33
56
  - Manifest.txt
@@ -35,41 +58,35 @@ files:
35
58
  - Rakefile
36
59
  - bin/ministat
37
60
  - lib/ministat.rb
38
- - package/History.txt
39
- - package/Manifest.txt
40
- - package/README.txt
41
- - package/Rakefile
42
- - package/bin/package
43
- - package/lib/package.rb
44
- - package/test/test_package.rb
45
61
  - test/data/1.dat
46
62
  - test/data/2.dat
47
63
  - test/test_ministat.rb
48
- test_files:
49
- - test/test_ministat.rb
64
+ has_rdoc: true
65
+ homepage: " by Dean Hudson"
66
+ post_install_message:
50
67
  rdoc_options:
51
68
  - --main
52
69
  - README.txt
53
- extra_rdoc_files:
54
- - History.txt
55
- - Manifest.txt
56
- - README.txt
57
- - package/History.txt
58
- - package/Manifest.txt
59
- - package/README.txt
60
- executables:
61
- - ministat
62
- extensions: []
63
-
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ version:
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0"
83
+ version:
64
84
  requirements: []
65
85
 
66
- dependencies:
67
- - !ruby/object:Gem::Dependency
68
- name: hoe
69
- version_requirement:
70
- version_requirements: !ruby/object:Gem::Version::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: 1.3.0
75
- version:
86
+ rubyforge_project: ministat
87
+ rubygems_version: 0.9.5
88
+ signing_key:
89
+ specification_version: 2
90
+ summary: A small and simple library to generate statistical info on single-variable datasets.
91
+ test_files:
92
+ - test/test_ministat.rb
metadata.gz.sig ADDED
Binary file
data/package/History.txt DELETED
@@ -1,5 +0,0 @@
1
- == 1.0.0 / 2007-11-06
2
-
3
- * 1 major enhancement
4
- * Birthday!
5
-
data/package/Manifest.txt DELETED
@@ -1,7 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.txt
4
- Rakefile
5
- bin/package
6
- lib/package.rb
7
- test/test_package.rb
data/package/README.txt DELETED
@@ -1,48 +0,0 @@
1
- package
2
- by FIX (your name)
3
- FIX (url)
4
-
5
- == DESCRIPTION:
6
-
7
- FIX (describe your package)
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- * FIX (list of features or problems)
12
-
13
- == SYNOPSIS:
14
-
15
- FIX (code sample of usage)
16
-
17
- == REQUIREMENTS:
18
-
19
- * FIX (list of requirements)
20
-
21
- == INSTALL:
22
-
23
- * FIX (sudo gem install, anything else)
24
-
25
- == LICENSE:
26
-
27
- (The MIT License)
28
-
29
- Copyright (c) 2007 FIX
30
-
31
- Permission is hereby granted, free of charge, to any person obtaining
32
- a copy of this software and associated documentation files (the
33
- 'Software'), to deal in the Software without restriction, including
34
- without limitation the rights to use, copy, modify, merge, publish,
35
- distribute, sublicense, and/or sell copies of the Software, and to
36
- permit persons to whom the Software is furnished to do so, subject to
37
- the following conditions:
38
-
39
- The above copyright notice and this permission notice shall be
40
- included in all copies or substantial portions of the Software.
41
-
42
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/package/Rakefile DELETED
@@ -1,17 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'rubygems'
4
- require 'hoe'
5
- require './lib/package.rb'
6
-
7
- Hoe.new('package', Package::VERSION) do |p|
8
- p.rubyforge_name = 'package'
9
- # p.author = 'FIX'
10
- # p.email = 'FIX'
11
- # p.summary = 'FIX'
12
- # p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
13
- # p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
14
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
15
- end
16
-
17
- # vim: syntax=Ruby
data/package/bin/package DELETED
File without changes
@@ -1,3 +0,0 @@
1
- class Package
2
- VERSION = '1.0.0'
3
- end
File without changes