statsample 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �����%y�ӵ���T���:�l�bt ��郧�%t���§�A�n�?2��JRw��ov��t[a 4�Ӏ%�_i�N
1
+
2
+ �YH��P���&�D�ֆ=T����z���p��?^u)�~�)�
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.11.1 / 2010-05-04
2
+ * Removed Matrix almost all Matrix extensions and replaced by dependency on 'extendmatrix' gem
3
+ * Added dependency to gsl >=1.12.109. Polychoric with joint method fails without this explicit dependency
1
4
  === 0.11.0 / 2010-04-16
2
5
  <b>New features:</b>
3
6
  * Added Statsample::Anova::TwoWay and Statsample::Anova::TwoWayWithVectors
data/Rakefile CHANGED
@@ -37,7 +37,7 @@ h=Hoe.spec('statsample') do
37
37
  #self.testlib=:minitest
38
38
  self.rubyforge_name = "ruby-statsample"
39
39
  self.developer('Claudio Bustos', 'clbustos@gmail.com')
40
- self.extra_deps << ["spreadsheet","~>0.6.0"] << ["svg-graph", "~>1.0"] << ["reportbuilder", "~>1.0"] << ["minimization", "~>0.2.0"] << ["fastercsv"] << ["dirty-memoize", "~>0.0"] << ["statistics2", "~>0.54"]
40
+ self.extra_deps << ["spreadsheet","~>0.6.0"] << ["svg-graph", "~>1.0"] << ["reportbuilder", "~>1.0"] << ["minimization", "~>0.2.0"] << ["fastercsv"] << ["dirty-memoize", "~>0.0"] << ["statistics2", "~>0.54"] << ["extendmatrix","~>0.1"] << ["gsl", "~>1.12.109"]
41
41
  self.clean_globs << "test/images/*" << "demo/item_analysis/*" << "demo/Regression"
42
42
  self.need_rdoc=false
43
43
  end
data/lib/statsample.rb CHANGED
@@ -111,7 +111,7 @@ module Statsample
111
111
  false
112
112
  end
113
113
  end
114
- VERSION = '0.11.0'
114
+ VERSION = '0.11.1'
115
115
  SPLIT_TOKEN = ","
116
116
  autoload(:Database, 'statsample/converters')
117
117
  autoload(:Anova, 'statsample/anova')
@@ -438,8 +438,7 @@ module Statsample
438
438
  message+=sprintf("f() = %7.3f size = %.3f\n", minimizer.fval, minimizer.size)+"\n";
439
439
  end while status == GSL::CONTINUE and iter < @max_iterations
440
440
  @iteration=iter
441
- @log+=message
442
- puts message if @debug
441
+ @log+=message
443
442
  @r=minimizer.x[0]
444
443
  @alpha=minimizer.x[1,@nr-1].to_a
445
444
  @beta=minimizer.x[@nr,@nc-1].to_a
@@ -1,19 +1,4 @@
1
- require 'matrix'
2
-
3
- class ::Vector
4
- if RUBY_VERSION<="1.9.0"
5
- alias_method :old_coerce, :coerce
6
- def coerce(other)
7
- case other
8
- when Numeric
9
- return Matrix::Scalar.new(other), self
10
- else
11
- raise TypeError, "#{self.class} can't be coerced into #{other.class}"
12
- end
13
- end
14
-
15
- end
16
- end
1
+ require 'extendmatrix'
17
2
 
18
3
 
19
4
  class ::Matrix
@@ -24,63 +9,6 @@ class ::Matrix
24
9
  }
25
10
  GSL::Matrix[*out]
26
11
  end
27
- # Calculate marginal of rows
28
- def row_sum
29
- (0...row_size).collect {|i|
30
- row(i).to_a.inject(0) {|a,v| a+v}
31
- }
32
- end
33
- # Calculate marginal of columns
34
- def column_sum
35
- (0...column_size).collect {|i|
36
- column(i).to_a.inject(0) {|a,v| a+v}
37
- }
38
- end
39
-
40
-
41
- alias :old_par :[]
42
-
43
- # Select elements and submatrixes
44
- # Implement row, column and minor in one method
45
- #
46
- # * [i,j]:: Element i,j
47
- # * [i,:*]:: Row i
48
- # * [:*,j]:: Column j
49
- # * [i1..i2,j]:: Row i1 to i2, column j
50
-
51
- def [](*args)
52
- raise ArgumentError if args.size!=2
53
- x=args[0]
54
- y=args[1]
55
- if x.is_a? Integer and y.is_a? Integer
56
- @rows[args[0]][args[1]]
57
- else
58
- # set ranges according to arguments
59
-
60
- rx=case x
61
- when Numeric
62
- x..x
63
- when :*
64
- 0..(row_size-1)
65
- when Range
66
- x
67
- end
68
- ry=case y
69
- when Numeric
70
- y..y
71
- when :*
72
- 0..(column_size-1)
73
- when Range
74
- y
75
- end
76
- Matrix.rows(rx.collect {|i| ry.collect {|j| @rows[i][j]}})
77
- end
78
- end
79
- # Calculate sum of cells
80
- def total_sum
81
- row_sum.inject(0){|a,v| a+v}
82
- end
83
-
84
12
  end
85
13
 
86
14
  module GSL
@@ -101,6 +29,7 @@ module Statsample
101
29
  # matrix.extend CovariateMatrix
102
30
  #
103
31
  module CovariateMatrix
32
+ include Summarizable
104
33
  # Gives a nice summary
105
34
  def summary
106
35
  rp=ReportBuilder.new()
@@ -49,17 +49,22 @@ class StatsampleBivariatePolychoricTestCase < MiniTest::Unit::TestCase
49
49
  assert_in_delta(1.137, @poly.threshold_x[1],0.001)
50
50
  end
51
51
  end
52
- should "compute joint" do
53
52
  if Statsample.has_gsl?
54
- @poly.method=:joint
55
- @poly.compute
53
+ context "compute joint" do
54
+ setup do
55
+ @poly.method=:joint
56
+ @poly.compute
57
+ end
58
+ should "have correct values" do
59
+ assert_equal(:joint, @poly.method)
56
60
  assert_in_delta(0.4192, @poly.r, 0.0001)
57
61
  assert_in_delta(-0.2421, @poly.threshold_y[0],0.0001)
58
62
  assert_in_delta(-0.0297, @poly.threshold_x[0],0.0001)
59
63
  assert_in_delta(1.5938, @poly.threshold_y[1],0.0001)
60
64
  assert_in_delta(1.1331, @poly.threshold_x[1],0.0001)
61
65
  end
62
- end
66
+ end
67
+ end
63
68
  end
64
69
 
65
70
  end
data/test/test_matrix.rb CHANGED
@@ -2,36 +2,6 @@ require(File.dirname(__FILE__)+'/helpers_tests.rb')
2
2
 
3
3
 
4
4
  class StatsampleMatrixTestCase < MiniTest::Unit::TestCase
5
- context(Matrix) do
6
- setup do
7
- @matrix=Matrix[[1,2,3],[4,5,6],[7,8,9]]
8
- end
9
- should "return correct value for [i,j]" do
10
- assert_equal(5, @matrix[1,1])
11
- end
12
- should "return correct value for [i,:*]" do
13
- assert_equal(Matrix[[1,2,3]], @matrix[0,:*])
14
- end
15
- should "return correct value for [:*,j]" do
16
- assert_equal(Matrix[[1],[4],[7]], @matrix[:*,0])
17
- end
18
- should "return correct value for [:*,j1..j2]" do
19
- assert_equal(Matrix[[1,2],[4,5],[7,8]], @matrix[:*,0..1])
20
- end
21
- should "return correct value for [i1..i2,j1..j2]" do
22
- assert_equal(Matrix[[1,2],[4,5]], @matrix[0..1,0..1])
23
- end
24
- should "return correct value for row_sum" do
25
- assert_equal(6,@matrix.row_sum[0])
26
- end
27
- should "return correct value for column_sum" do
28
- assert_equal(12,@matrix.column_sum[0])
29
- end
30
- should "return correct value for total_sum" do
31
- assert_equal(45,@matrix.total_sum)
32
- end
33
- end
34
-
35
5
  def test_covariate
36
6
  a=Matrix[[1.0, 0.3, 0.2], [0.3, 1.0, 0.5], [0.2, 0.5, 1.0]]
37
7
  a.extend Statsample::CovariateMatrix
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 11
8
- - 0
9
- version: 0.11.0
8
+ - 1
9
+ version: 0.11.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Claudio Bustos
@@ -35,7 +35,7 @@ cert_chain:
35
35
  rpP0jjs0
36
36
  -----END CERTIFICATE-----
37
37
 
38
- date: 2010-05-03 00:00:00 -04:00
38
+ date: 2010-05-04 00:00:00 -04:00
39
39
  default_executable:
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
@@ -131,9 +131,36 @@ dependencies:
131
131
  type: :runtime
132
132
  version_requirements: *id007
133
133
  - !ruby/object:Gem::Dependency
134
- name: rubyforge
134
+ name: extendmatrix
135
135
  prerelease: false
136
136
  requirement: &id008 !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ~>
139
+ - !ruby/object:Gem::Version
140
+ segments:
141
+ - 0
142
+ - 1
143
+ version: "0.1"
144
+ type: :runtime
145
+ version_requirements: *id008
146
+ - !ruby/object:Gem::Dependency
147
+ name: gsl
148
+ prerelease: false
149
+ requirement: &id009 !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ~>
152
+ - !ruby/object:Gem::Version
153
+ segments:
154
+ - 1
155
+ - 12
156
+ - 109
157
+ version: 1.12.109
158
+ type: :runtime
159
+ version_requirements: *id009
160
+ - !ruby/object:Gem::Dependency
161
+ name: rubyforge
162
+ prerelease: false
163
+ requirement: &id010 !ruby/object:Gem::Requirement
137
164
  requirements:
138
165
  - - ">="
139
166
  - !ruby/object:Gem::Version
@@ -143,11 +170,11 @@ dependencies:
143
170
  - 4
144
171
  version: 2.0.4
145
172
  type: :development
146
- version_requirements: *id008
173
+ version_requirements: *id010
147
174
  - !ruby/object:Gem::Dependency
148
175
  name: hoe
149
176
  prerelease: false
150
- requirement: &id009 !ruby/object:Gem::Requirement
177
+ requirement: &id011 !ruby/object:Gem::Requirement
151
178
  requirements:
152
179
  - - ">="
153
180
  - !ruby/object:Gem::Version
@@ -157,7 +184,7 @@ dependencies:
157
184
  - 0
158
185
  version: 2.6.0
159
186
  type: :development
160
- version_requirements: *id009
187
+ version_requirements: *id011
161
188
  description: |-
162
189
  A suite for basic and advanced statistics on Ruby. Tested on Ruby 1.8.7, 1.9.1, 1.9.2 (April, 2010) and JRuby 1.4 (Ruby 1.8.7 compatible).
163
190
 
metadata.gz.sig CHANGED
Binary file