statsample 0.6.7 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/po/statsample.pot CHANGED
@@ -6,8 +6,8 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: statsample 0.6.2\n"
10
- "POT-Creation-Date: 2010-02-11 18:44-0300\n"
9
+ "Project-Id-Version: statsample 0.6.8\n"
10
+ "POT-Creation-Date: 2010-03-25 17:55-0300\n"
11
11
  "PO-Revision-Date: 2009-08-04 15:36-0400\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,135 +16,155 @@ msgstr ""
16
16
  "Content-Transfer-Encoding: 8bit\n"
17
17
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18
18
 
19
- #: lib/statsample/regression/multiple/baseengine.rb:14
19
+ #: lib/statsample/regression/multiple/baseengine.rb:23
20
20
  msgid "Multiple Regression: %s over %s"
21
21
  msgstr ""
22
22
 
23
- #: lib/statsample/regression/multiple/baseengine.rb:150
23
+ #: lib/statsample/regression/multiple/baseengine.rb:164
24
+ #: lib/statsample/regression/multiple/matrixengine.rb:198
24
25
  msgid "Multiple Regression: "
25
26
  msgstr ""
26
27
 
27
- #: lib/statsample/regression/multiple/baseengine.rb:153
28
+ #: lib/statsample/regression/multiple/baseengine.rb:167
29
+ #: lib/statsample/regression/multiple/matrixengine.rb:201
28
30
  msgid "Engine: %s"
29
31
  msgstr ""
30
32
 
31
- #: lib/statsample/regression/multiple/baseengine.rb:154
33
+ #: lib/statsample/regression/multiple/baseengine.rb:168
32
34
  msgid "Cases(listwise)=%d(%d)"
33
35
  msgstr ""
34
36
 
35
- #: lib/statsample/regression/multiple/baseengine.rb:158
37
+ #: lib/statsample/regression/multiple/baseengine.rb:172
38
+ #: lib/statsample/regression/multiple/matrixengine.rb:206
36
39
  msgid "Equation"
37
40
  msgstr ""
38
41
 
39
- #: lib/statsample/regression/multiple/baseengine.rb:161
42
+ #: lib/statsample/regression/multiple/baseengine.rb:175
43
+ #: lib/statsample/regression/multiple/matrixengine.rb:209
40
44
  msgid "Regression"
41
45
  msgstr ""
42
46
 
43
- #: lib/statsample/regression/multiple/baseengine.rb:162
47
+ #: lib/statsample/regression/multiple/baseengine.rb:176
48
+ #: lib/statsample/regression/multiple/matrixengine.rb:210
44
49
  msgid "Error"
45
50
  msgstr ""
46
51
 
47
- #: lib/statsample/regression/multiple/baseengine.rb:164
52
+ #: lib/statsample/regression/multiple/baseengine.rb:178
53
+ #: lib/statsample/regression/multiple/matrixengine.rb:212
48
54
  #: lib/statsample/crosstab.rb:108 lib/statsample/crosstab.rb:123
49
55
  #: lib/statsample/crosstab.rb:159 lib/statsample/crosstab.rb:181
50
- #: lib/statsample/dominanceanalysis.rb:281
56
+ #: lib/statsample/dominanceanalysis.rb:361
51
57
  msgid "Total"
52
58
  msgstr ""
53
59
 
54
- #: lib/statsample/regression/multiple/baseengine.rb:170
60
+ #: lib/statsample/regression/multiple/baseengine.rb:184
61
+ #: lib/statsample/regression/multiple/matrixengine.rb:219
62
+ #: lib/statsample/regression/multiple/matrixengine.rb:221
55
63
  msgid "Constant"
56
64
  msgstr ""
57
65
 
58
- #: lib/statsample/dominanceanalysis/bootstrap.rb:42
66
+ #: lib/statsample/regression/multiple/matrixengine.rb:75
67
+ msgid "Multiple reggresion of %s on %s"
68
+ msgstr ""
69
+
70
+ #: lib/statsample/regression/multiple/matrixengine.rb:202
71
+ msgid "Cases=%d"
72
+ msgstr ""
73
+
74
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:117
59
75
  msgid "Bootstrap dominance Analysis: %s over %s"
60
76
  msgstr ""
61
77
 
62
- #: lib/statsample/dominanceanalysis/bootstrap.rb:65
78
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:140
63
79
  msgid "Bootstrap %d of %d"
64
80
  msgstr ""
65
81
 
66
- #: lib/statsample/dominanceanalysis/bootstrap.rb:106
82
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:183
67
83
  msgid "DAB: "
68
84
  msgstr ""
69
85
 
70
- #: lib/statsample/dominanceanalysis/bootstrap.rb:109
86
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:186
71
87
  msgid "Sample size: %d\n"
72
88
  msgstr ""
73
89
 
74
- #: lib/statsample/dominanceanalysis/bootstrap.rb:111
90
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:188
75
91
  msgid "Linear Regression Engine: %s"
76
92
  msgstr ""
77
93
 
78
- #: lib/statsample/dominanceanalysis/bootstrap.rb:113
94
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:190
79
95
  msgid "pairs"
80
96
  msgstr ""
81
97
 
82
- #: lib/statsample/dominanceanalysis/bootstrap.rb:113
98
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:190
83
99
  msgid "SE(Dij)"
84
100
  msgstr ""
85
101
 
86
- #: lib/statsample/dominanceanalysis/bootstrap.rb:113
102
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:190
87
103
  msgid "Reproducibility"
88
104
  msgstr ""
89
105
 
90
- #: lib/statsample/dominanceanalysis/bootstrap.rb:114
106
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:191
91
107
  msgid "Complete dominance"
92
108
  msgstr ""
93
109
 
94
- #: lib/statsample/dominanceanalysis/bootstrap.rb:122
110
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:199
95
111
  msgid "Conditional dominance"
96
112
  msgstr ""
97
113
 
98
- #: lib/statsample/dominanceanalysis/bootstrap.rb:131
114
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:208
99
115
  msgid "General Dominance"
100
116
  msgstr ""
101
117
 
102
- #: lib/statsample/dominanceanalysis/bootstrap.rb:140
118
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:217
103
119
  msgid "General averages"
104
120
  msgstr ""
105
121
 
106
- #: lib/statsample/dominanceanalysis/bootstrap.rb:140
122
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:217
107
123
  msgid "var"
108
124
  msgstr ""
109
125
 
110
- #: lib/statsample/dominanceanalysis/bootstrap.rb:140
126
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:217
111
127
  msgid "mean"
112
128
  msgstr ""
113
129
 
114
- #: lib/statsample/dominanceanalysis/bootstrap.rb:140
130
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:217
115
131
  msgid "se"
116
132
  msgstr ""
117
133
 
118
- #: lib/statsample/dominanceanalysis/bootstrap.rb:140
134
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:217
119
135
  msgid "p.5"
120
136
  msgstr ""
121
137
 
122
- #: lib/statsample/dominanceanalysis/bootstrap.rb:140
138
+ #: lib/statsample/dominanceanalysis/bootstrap.rb:217
123
139
  msgid "p.95"
124
140
  msgstr ""
125
141
 
126
- #: lib/statsample/bivariate/polychoric.rb:560
127
- #: lib/statsample/bivariate/tetrachoric.rb:118
142
+ #: lib/statsample/bivariate/polychoric.rb:750
143
+ #: lib/statsample/bivariate/tetrachoric.rb:124
128
144
  msgid "Contingence Table"
129
145
  msgstr ""
130
146
 
131
- #: lib/statsample/bivariate/polychoric.rb:569
147
+ #: lib/statsample/bivariate/polychoric.rb:759
132
148
  msgid "Thresholds"
133
149
  msgstr ""
134
150
 
135
- #: lib/statsample/bivariate/tetrachoric.rb:126
151
+ #: lib/statsample/bivariate/polychoric.rb:767
152
+ msgid "Test of bivariate normality: X2 = %0.3f, df = %d, p= %0.5f"
153
+ msgstr ""
154
+
155
+ #: lib/statsample/bivariate/tetrachoric.rb:132
136
156
  msgid "SE: %0.3f"
137
157
  msgstr ""
138
158
 
139
- #: lib/statsample/bivariate/tetrachoric.rb:127
159
+ #: lib/statsample/bivariate/tetrachoric.rb:133
140
160
  msgid "Threshold X: %0.3f "
141
161
  msgstr ""
142
162
 
143
- #: lib/statsample/bivariate/tetrachoric.rb:128
163
+ #: lib/statsample/bivariate/tetrachoric.rb:134
144
164
  msgid "Threshold Y: %0.3f "
145
165
  msgstr ""
146
166
 
147
- #: lib/statsample/bivariate/tetrachoric.rb:134
167
+ #: lib/statsample/bivariate/tetrachoric.rb:141
148
168
  msgid "Tetrachoric correlation"
149
169
  msgstr ""
150
170
 
@@ -152,31 +172,31 @@ msgstr ""
152
172
  msgid "Histogram %s"
153
173
  msgstr ""
154
174
 
155
- #: lib/statsample/factor/pca.rb:99
175
+ #: lib/statsample/factor/pca.rb:128
156
176
  msgid "PCA: "
157
177
  msgstr ""
158
178
 
159
- #: lib/statsample/factor/pca.rb:100
179
+ #: lib/statsample/factor/pca.rb:129
160
180
  msgid "PCA"
161
181
  msgstr ""
162
182
 
163
- #: lib/statsample/factor/pca.rb:103 lib/statsample/factor/principalaxis.rb:106
183
+ #: lib/statsample/factor/pca.rb:132 lib/statsample/factor/principalaxis.rb:182
164
184
  msgid "Communalities"
165
185
  msgstr ""
166
186
 
167
- #: lib/statsample/factor/pca.rb:109 lib/statsample/factor/principalaxis.rb:112
187
+ #: lib/statsample/factor/pca.rb:138 lib/statsample/factor/principalaxis.rb:188
168
188
  msgid "Eigenvalues"
169
189
  msgstr ""
170
190
 
171
- #: lib/statsample/factor/pca.rb:115 lib/statsample/factor/principalaxis.rb:118
191
+ #: lib/statsample/factor/pca.rb:144 lib/statsample/factor/principalaxis.rb:194
172
192
  msgid "Component Matrix"
173
193
  msgstr ""
174
194
 
175
- #: lib/statsample/factor/principalaxis.rb:97
195
+ #: lib/statsample/factor/principalaxis.rb:176
176
196
  msgid "Factor Analysis: "
177
197
  msgstr ""
178
198
 
179
- #: lib/statsample/factor/principalaxis.rb:98
199
+ #: lib/statsample/factor/principalaxis.rb:177
180
200
  msgid "Factor Analysis"
181
201
  msgstr ""
182
202
 
@@ -216,50 +236,50 @@ msgstr ""
216
236
  msgid "% Total"
217
237
  msgstr ""
218
238
 
219
- #: lib/statsample/dominanceanalysis.rb:79
239
+ #: lib/statsample/dominanceanalysis.rb:123
220
240
  msgid "Dominance Analysis: %s over %s"
221
241
  msgstr ""
222
242
 
223
- #: lib/statsample/dominanceanalysis.rb:241
243
+ #: lib/statsample/dominanceanalysis.rb:319
224
244
  msgid "DA: "
225
245
  msgstr ""
226
246
 
227
- #: lib/statsample/dominanceanalysis.rb:243
228
- msgid "Dominance Analysis result"
247
+ #: lib/statsample/dominanceanalysis.rb:322
248
+ msgid "sign"
229
249
  msgstr ""
230
250
 
231
- #: lib/statsample/dominanceanalysis.rb:244
232
- msgid "sign"
251
+ #: lib/statsample/dominanceanalysis.rb:323
252
+ msgid "Dominance Analysis result"
233
253
  msgstr ""
234
254
 
235
- #: lib/statsample/dominanceanalysis.rb:245
255
+ #: lib/statsample/dominanceanalysis.rb:325
236
256
  msgid "Model 0"
237
257
  msgstr ""
238
258
 
239
- #: lib/statsample/dominanceanalysis.rb:259
259
+ #: lib/statsample/dominanceanalysis.rb:340
240
260
  msgid "k=%d Average"
241
261
  msgstr ""
242
262
 
243
- #: lib/statsample/dominanceanalysis.rb:272
263
+ #: lib/statsample/dominanceanalysis.rb:352
244
264
  msgid "Overall averages"
245
265
  msgstr ""
246
266
 
247
- #: lib/statsample/dominanceanalysis.rb:281
267
+ #: lib/statsample/dominanceanalysis.rb:361
248
268
  msgid "Pairwise dominance"
249
269
  msgstr ""
250
270
 
251
- #: lib/statsample/dominanceanalysis.rb:281
271
+ #: lib/statsample/dominanceanalysis.rb:361
252
272
  msgid "Pairs"
253
273
  msgstr ""
254
274
 
255
- #: lib/statsample/dominanceanalysis.rb:281
275
+ #: lib/statsample/dominanceanalysis.rb:361
256
276
  msgid "Conditional"
257
277
  msgstr ""
258
278
 
259
- #: lib/statsample/dominanceanalysis.rb:281
279
+ #: lib/statsample/dominanceanalysis.rb:361
260
280
  msgid "General"
261
281
  msgstr ""
262
282
 
263
- #: lib/statsample/converters.rb:317
283
+ #: lib/statsample/converters.rb:321
264
284
  msgid ")}"
265
285
  msgstr ""
data/test/test_anova.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  $:.unshift(File.dirname(__FILE__)+'/../lib/')
2
2
  require 'statsample'
3
- require 'test/unit'
4
-
5
- class StatsampleAnovaTestCase < Test::Unit::TestCase
3
+ require 'minitest/unit'
4
+ MiniTest::Unit.autorun
5
+ class StatsampleAnovaTestCase < MiniTest::Unit::TestCase
6
6
  def initialize(*args)
7
7
  @v1=[3,3,2,3,6].to_vector(:scale)
8
8
  @v2=[7,6,5,6,7].to_vector(:scale)
@@ -1,19 +1,47 @@
1
1
  $:.unshift(File.dirname(__FILE__)+'/../lib/')
2
2
  require 'statsample'
3
- require 'test/unit'
4
- class StatsampleBivariateTestCase < Test::Unit::TestCase
5
- def test_sum_of_codeviated
3
+ require 'minitest/unit'
4
+ MiniTest::Unit.autorun
5
+ class StatsampleBivariateTestCase < MiniTest::Unit::TestCase
6
+ def test_sum_of_squares
6
7
  v1=[1,2,3,4,5,6].to_vector(:scale)
7
8
  v2=[6,2,4,10,12,8].to_vector(:scale)
8
- assert_equal(23.0, Statsample::Bivariate.sum_of_codeviated(v1,v2))
9
+ assert_equal(23.0, Statsample::Bivariate.sum_of_squares(v1,v2))
10
+ end
11
+ def test_covariance
12
+ if Statsample.has_gsl?
13
+ v1=1000.times.collect {|a| rand()}.to_scale
14
+ v2=1000.times.collect {|a| rand()}.to_scale
15
+ assert_in_delta(Statsample::Bivariate.covariance(v1,v2), Statsample::Bivariate.covariance_slow(v1,v2), 0.001)
16
+ else
17
+ puts "Bivariate::covariance not tested (needs GSL)"
18
+ end
19
+
20
+ end
21
+
22
+ def test_gsl_pearson
23
+ if Statsample.has_gsl?
24
+ v1=100.times.collect {|a| rand()}.to_scale
25
+ v2=100.times.collect {|a| rand()}.to_scale
26
+
27
+ assert_in_delta(GSL::Stats::correlation(v1.gsl, v2.gsl), Statsample::Bivariate.pearson_slow(v1,v2), 1e-10)
28
+ else
29
+ puts "Not tested gsl versus ruby correlation (needs GSL)"
30
+ end
9
31
  end
10
32
  def test_pearson
11
33
  v1=[6,5,4,7,8,4,3,2].to_vector(:scale)
12
34
  v2=[2,3,7,8,6,4,3,2].to_vector(:scale)
13
35
  assert_in_delta(0.525,Statsample::Bivariate.pearson(v1,v2), 0.001)
36
+ assert_in_delta(0.525,Statsample::Bivariate.pearson_slow(v1,v2), 0.001)
37
+
14
38
  v3=[6,2, 1000,1000,5,4,7,8,4,3,2,nil].to_vector(:scale)
15
39
  v4=[2,nil,nil,nil, 3,7,8,6,4,3,2,500].to_vector(:scale)
16
40
  assert_in_delta(0.525,Statsample::Bivariate.pearson(v3,v4),0.001)
41
+ # Test ruby method
42
+ v3a,v4a=Statsample.only_valid v3, v4
43
+ assert_in_delta(0.525, Statsample::Bivariate.pearson_slow(v3a,v4a),0.001)
44
+
17
45
  end
18
46
  def test_tetrachoric_matrix
19
47
  ds=Statsample::PlainText.read(File.dirname(__FILE__)+"/../data/tetmat_test.txt", %w{a b c d e})
@@ -26,7 +54,7 @@ class StatsampleBivariateTestCase < Test::Unit::TestCase
26
54
  end
27
55
  end
28
56
  def test_poly_vs_tetra
29
- 10.times {
57
+ 5.times {
30
58
  # Should be the same results as Tetrachoric for 2x2 matrix
31
59
  matrix=Matrix[[150+rand(10),1000+rand(20)],[1000+rand(20),200+rand(20)]]
32
60
  tetra = Statsample::Bivariate::Tetrachoric.new_with_matrix(matrix)
@@ -49,16 +77,6 @@ class StatsampleBivariateTestCase < Test::Unit::TestCase
49
77
  assert_in_delta(-0.027, poly.threshold_x[0],0.001)
50
78
  assert_in_delta(1.578, poly.threshold_y[1],0.001)
51
79
  assert_in_delta(1.137, poly.threshold_x[1],0.001)
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
80
  if Statsample.has_gsl?
63
81
  poly.method=:polychoric_series
64
82
  poly.compute
@@ -95,17 +113,18 @@ class StatsampleBivariateTestCase < Test::Unit::TestCase
95
113
  end
96
114
  assert(poly.summary)
97
115
  end
116
+
98
117
  def test_tetrachoric
99
118
  a,b,c,d=0,0,0,0
100
- assert_raise RuntimeError do
119
+ assert_raises RuntimeError do
101
120
  tc = Statsample::Bivariate::Tetrachoric.new(a,b,c,d)
102
121
  end
103
122
  a,b,c,d=10,10,0,0
104
- assert_raise RuntimeError do
123
+ assert_raises RuntimeError do
105
124
  tc = Statsample::Bivariate::Tetrachoric.new(a,b,c,d)
106
125
  end
107
126
  a,b,c,d=10,0,10,0
108
- assert_raise RuntimeError do
127
+ assert_raises RuntimeError do
109
128
  tc = Statsample::Bivariate::Tetrachoric.new(a,b,c,d)
110
129
  end
111
130
  a,b,c,d=10,0,0,10
@@ -174,14 +193,6 @@ class StatsampleBivariateTestCase < Test::Unit::TestCase
174
193
  assert(Statsample::Bivariate.prop_pearson(t,n,:right)>0.05)
175
194
  assert(Statsample::Bivariate.prop_pearson(t,n,:left)<0.05)
176
195
  end
177
- def test_covariance
178
- if Statsample.has_gsl?
179
- v1=[6,5,4,7,8,4,3,2].to_vector(:scale)
180
- v2=[2,3,7,8,6,4,3,2].to_vector(:scale)
181
- assert_in_delta(Statsample::Bivariate.covariance(v1,v2), Statsample::Bivariate.covariance_slow(v1,v2), 0.001)
182
-
183
- end
184
- end
185
196
 
186
197
  def test_spearman
187
198
  v1=[86,97,99,100,101,103,106,110,112,113].to_vector(:scale)
@@ -192,7 +203,7 @@ class StatsampleBivariateTestCase < Test::Unit::TestCase
192
203
  def test_point_biserial
193
204
  c=[1,3,5,6,7,100,200,300,400,300].to_vector(:scale)
194
205
  d=[1,1,1,1,1,0,0,0,0,0].to_vector(:scale)
195
- assert_raise TypeError do
206
+ assert_raises TypeError do
196
207
  Statsample::Bivariate.point_biserial(c,d)
197
208
  end
198
209
  assert_in_delta(Statsample::Bivariate.point_biserial(d,c), Statsample::Bivariate.pearson(d,c), 0.0001)
data/test/test_csv.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  $:.unshift(File.dirname(__FILE__)+'/../lib/')
2
2
  require 'statsample'
3
3
  require "tempfile"
4
- require 'test/unit'
5
-
6
- class StatsampleCSVTestCase < Test::Unit::TestCase
4
+ require 'minitest/unit'
5
+ MiniTest::Unit.autorun
6
+ class StatsampleCSVTestCase < MiniTest::Unit::TestCase
7
7
  def setup
8
8
  @ds=Statsample::CSV.read(File.dirname(__FILE__)+"/test_csv.csv")
9
9
  end
10
10
  def test_read
11
11
  assert_equal(6,@ds.cases)
12
- assert_equal(%w{id name age city a1},@ds.fields)
12
+ assert_equal(%w{id name age city a1}, @ds.fields)
13
13
  id=[1,2,3,4,5,6].to_vector(:scale)
14
14
  name=["Alex","Claude","Peter","Franz","George","Fernand"].to_vector(:nominal)
15
15
  age=[20,23,25,27,5.5,nil].to_vector(:scale)