statsample 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +79 -0
- data/Manifest.txt +56 -0
- data/README.txt +77 -0
- data/Rakefile +22 -0
- data/bin/statsample +2 -0
- data/demo/benchmark.rb +52 -0
- data/demo/chi-square.rb +44 -0
- data/demo/dice.rb +13 -0
- data/demo/distribution_t.rb +95 -0
- data/demo/graph.rb +9 -0
- data/demo/item_analysis.rb +30 -0
- data/demo/mean.rb +81 -0
- data/demo/proportion.rb +57 -0
- data/demo/sample_test.csv +113 -0
- data/demo/strata_proportion.rb +152 -0
- data/demo/stratum.rb +141 -0
- data/lib/spss.rb +131 -0
- data/lib/statsample.rb +216 -0
- data/lib/statsample/anova.rb +74 -0
- data/lib/statsample/bivariate.rb +255 -0
- data/lib/statsample/chidistribution.rb +39 -0
- data/lib/statsample/codification.rb +120 -0
- data/lib/statsample/converters.rb +338 -0
- data/lib/statsample/crosstab.rb +122 -0
- data/lib/statsample/dataset.rb +526 -0
- data/lib/statsample/dominanceanalysis.rb +259 -0
- data/lib/statsample/dominanceanalysis/bootstrap.rb +126 -0
- data/lib/statsample/graph/gdchart.rb +45 -0
- data/lib/statsample/graph/svgboxplot.rb +108 -0
- data/lib/statsample/graph/svggraph.rb +181 -0
- data/lib/statsample/graph/svghistogram.rb +208 -0
- data/lib/statsample/graph/svgscatterplot.rb +111 -0
- data/lib/statsample/htmlreport.rb +232 -0
- data/lib/statsample/multiset.rb +281 -0
- data/lib/statsample/regression.rb +522 -0
- data/lib/statsample/reliability.rb +235 -0
- data/lib/statsample/resample.rb +20 -0
- data/lib/statsample/srs.rb +159 -0
- data/lib/statsample/test.rb +25 -0
- data/lib/statsample/vector.rb +759 -0
- data/test/_test_chart.rb +58 -0
- data/test/test_anova.rb +31 -0
- data/test/test_codification.rb +59 -0
- data/test/test_crosstab.rb +55 -0
- data/test/test_csv.csv +7 -0
- data/test/test_csv.rb +27 -0
- data/test/test_dataset.rb +293 -0
- data/test/test_ggobi.rb +42 -0
- data/test/test_multiset.rb +98 -0
- data/test/test_regression.rb +108 -0
- data/test/test_reliability.rb +32 -0
- data/test/test_resample.rb +23 -0
- data/test/test_srs.rb +14 -0
- data/test/test_statistics.rb +152 -0
- data/test/test_stratified.rb +19 -0
- data/test/test_svg_graph.rb +63 -0
- data/test/test_vector.rb +265 -0
- data/test/test_xls.rb +32 -0
- metadata +158 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__)+'/../lib/statsample'
|
2
|
+
require 'statsample/multiset'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class StatsampleStratifiedTestCase < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def initialize(*args)
|
8
|
+
super
|
9
|
+
end
|
10
|
+
def test_mean
|
11
|
+
a=[10,20,30,40,50]
|
12
|
+
b=[110,120,130,140]
|
13
|
+
pop=a+b
|
14
|
+
av=a.to_vector(:scale)
|
15
|
+
bv=b.to_vector(:scale)
|
16
|
+
popv=pop.to_vector(:scale)
|
17
|
+
assert_equal(popv.mean,Statsample::StratifiedSample.mean(av,bv))
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.dirname(__FILE__)+'/../lib/statsample'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'test/unit'
|
4
|
+
begin
|
5
|
+
require 'statsample/graph/svggraph'
|
6
|
+
class StatsampleSvgGraphTestCase < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def initialize(*args)
|
9
|
+
@image_path=File.dirname(__FILE__)+"/images"
|
10
|
+
super
|
11
|
+
end
|
12
|
+
def test_histogram
|
13
|
+
if HAS_GSL
|
14
|
+
ar=(1..1000).to_a.collect {|a|
|
15
|
+
rand(10)
|
16
|
+
}.to_vector(:scale)
|
17
|
+
h=ar.histogram([0,2,5,11])
|
18
|
+
file=@image_path+"/svg_histogram_only.svg"
|
19
|
+
graph = Statsample::Graph::SvgHistogram.new({})
|
20
|
+
graph.histogram=h
|
21
|
+
File.open(file,"w") {|f|
|
22
|
+
f.puts(graph.burn)
|
23
|
+
}
|
24
|
+
else
|
25
|
+
puts "Statsample::Graph::SvgHistogram.new not tested (no ruby-gsl)"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
def test_vector
|
29
|
+
file=@image_path+"/gdchart_bar.jpg"
|
30
|
+
ar=[]
|
31
|
+
(1..1000).each {|a|
|
32
|
+
ar.push(rand(10))
|
33
|
+
}
|
34
|
+
vector=ar.to_vector
|
35
|
+
file=@image_path+"/svggraph_default.svg"
|
36
|
+
vector.svggraph_frequencies(file)
|
37
|
+
|
38
|
+
file=@image_path+"/svggraph_Bar.svg"
|
39
|
+
vector.svggraph_frequencies(file,800,600,SVG::Graph::Bar,:graph_title=>'Bar')
|
40
|
+
assert(File.exists?(file))
|
41
|
+
file=@image_path+"/svggraph_BarHorizontal.svg"
|
42
|
+
vector.svggraph_frequencies(file,800,600,SVG::Graph::BarHorizontalNoOp,:graph_title=>'Horizontal Bar')
|
43
|
+
assert(File.exists?(file))
|
44
|
+
file=@image_path+"/svggraph_Pie.svg"
|
45
|
+
vector.svggraph_frequencies(file,800,600,SVG::Graph::PieNoOp,:graph_title=>'Pie')
|
46
|
+
assert(File.exists?(file))
|
47
|
+
vector.type=:scale
|
48
|
+
if HAS_GSL
|
49
|
+
file=@image_path+"/svggraph_histogram.svg"
|
50
|
+
hist=vector.svggraph_histogram(5)
|
51
|
+
File.open(file,"wb") {|fp|
|
52
|
+
fp.write(hist.burn)
|
53
|
+
}
|
54
|
+
assert(File.exists?(file))
|
55
|
+
else
|
56
|
+
puts "Statsample::Vector#svggraph_histogram.new not tested (no ruby-gsl)"
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
rescue LoadError
|
62
|
+
puts "You should install SVG::Graph"
|
63
|
+
end
|
data/test/test_vector.rb
ADDED
@@ -0,0 +1,265 @@
|
|
1
|
+
require File.dirname(__FILE__)+'/../lib/statsample'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
class StatsampleVectorTestCase < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def initialize(*args)
|
7
|
+
super
|
8
|
+
@c = Statsample::Vector.new([5,5,5,5,5,6,6,7,8,9,10,1,2,3,4,nil,-99,-99], :nominal)
|
9
|
+
@c.missing_values=[-99]
|
10
|
+
end
|
11
|
+
def test_enumerable
|
12
|
+
val=@c.collect {|v| v}
|
13
|
+
assert_equal(val,[5,5,5,5,5,6,6,7,8,9,10,1,2,3,4,nil,-99,-99])
|
14
|
+
end
|
15
|
+
def test_missing_values
|
16
|
+
@c.missing_values=[10]
|
17
|
+
assert_equal([-99,-99,1,2,3,4,5,5,5,5,5,6,6,7,8,9], @c.valid_data.sort)
|
18
|
+
assert_equal([5,5,5,5,5,6,6,7,8,9,nil,1,2,3,4,nil,-99,-99], @c.data_with_nils)
|
19
|
+
@c.missing_values=[-99]
|
20
|
+
assert_equal(@c.valid_data.sort,[1,2,3,4,5,5,5,5,5,6,6,7,8,9,10])
|
21
|
+
assert_equal(@c.data_with_nils,[5,5,5,5,5,6,6,7,8,9,10,1,2,3,4,nil,nil,nil])
|
22
|
+
@c.missing_values=[]
|
23
|
+
assert_equal(@c.valid_data.sort,[-99,-99,1,2,3,4,5,5,5,5,5,6,6,7,8,9,10])
|
24
|
+
assert_equal(@c.data_with_nils,[5,5,5,5,5,6,6,7,8,9,10,1,2,3,4,nil,-99,-99])
|
25
|
+
|
26
|
+
end
|
27
|
+
def test_has_missing_data
|
28
|
+
a=[1,2,3,nil].to_vector
|
29
|
+
assert(a.has_missing_data?)
|
30
|
+
a=[1,2,3,4,10].to_vector
|
31
|
+
assert(!a.has_missing_data?)
|
32
|
+
a.missing_values=[10]
|
33
|
+
assert(a.has_missing_data?)
|
34
|
+
end
|
35
|
+
def test_labeled
|
36
|
+
@c.labels={5=>'FIVE'}
|
37
|
+
assert_equal(["FIVE","FIVE","FIVE","FIVE","FIVE",6,6,7,8,9,10,1,2,3,4,nil,-99, -99],@c.vector_labeled.to_a)
|
38
|
+
end
|
39
|
+
def test_split
|
40
|
+
a = Statsample::Vector.new(["a","a,b","c,d","a,d","d",10,nil],:nominal)
|
41
|
+
assert_equal([%w{a},%w{a b},%w{c d},%w{a d},%w{d},[10],nil], a.splitted)
|
42
|
+
end
|
43
|
+
def test_verify
|
44
|
+
h=@c.verify{|d| !d.nil? and d>0}
|
45
|
+
e={15=>nil,16=>-99,17=>-99}
|
46
|
+
assert_equal(e,h)
|
47
|
+
end
|
48
|
+
def test_split_by_separator
|
49
|
+
a = Statsample::Vector.new(["a","a,b","c,d","a,d",10,nil],:nominal)
|
50
|
+
b=a.split_by_separator(",")
|
51
|
+
assert_kind_of(Hash, b)
|
52
|
+
assert_instance_of(Statsample::Vector,b['a'])
|
53
|
+
assert_instance_of(Statsample::Vector,b['b'])
|
54
|
+
assert_instance_of(Statsample::Vector,b['c'])
|
55
|
+
assert_instance_of(Statsample::Vector,b['d'])
|
56
|
+
assert_instance_of(Statsample::Vector,b[10])
|
57
|
+
assert_equal([1,1,0,1,0,nil],b['a'].to_a)
|
58
|
+
assert_equal([0,1,0,0,0,nil],b['b'].to_a)
|
59
|
+
assert_equal([0,0,1,0,0,nil],b['c'].to_a)
|
60
|
+
assert_equal([0,0,1,1,0,nil],b['d'].to_a)
|
61
|
+
assert_equal([0,0,0,0,1,nil],b[10].to_a)
|
62
|
+
assert_equal({'a'=>3,'b'=>1,'c'=>1,'d'=>2,10=>1}, a.split_by_separator_freq())
|
63
|
+
|
64
|
+
a = Statsample::Vector.new(["a","a*b","c*d","a*d",10,nil],:nominal)
|
65
|
+
b=a.split_by_separator("*")
|
66
|
+
assert_equal([1,1,0,1,0,nil],b['a'].to_a)
|
67
|
+
assert_equal([0,1,0,0,0,nil],b['b'].to_a)
|
68
|
+
assert_equal([0,0,1,0,0,nil],b['c'].to_a)
|
69
|
+
assert_equal([0,0,1,1,0,nil],b['d'].to_a)
|
70
|
+
assert_equal([0,0,0,0,1,nil],b[10].to_a)
|
71
|
+
end
|
72
|
+
def test_types
|
73
|
+
@c.type=:nominal
|
74
|
+
assert_raise NoMethodError do
|
75
|
+
@c.median
|
76
|
+
end
|
77
|
+
@c.type=:ordinal
|
78
|
+
assert_raise NoMethodError do
|
79
|
+
@c.mean
|
80
|
+
end
|
81
|
+
end
|
82
|
+
def test_nominal
|
83
|
+
assert_equal(@c[1],5)
|
84
|
+
assert_equal({ 1=>1,2=>1,3=>1,4=>1,5=>5,6=>2,7=>1,8=>1, 9=>1,10=>1},@c.frequencies)
|
85
|
+
assert_equal({ 1 => 1.quo(15) ,2=>1.quo(15), 3=>1.quo(15),4=>1.quo(15),5=>5.quo(15),6=>2.quo(15),7=>1.quo(15), 8=>1.quo(15), 9=>1.quo(15),10=>1.quo(15)}, @c.proportions)
|
86
|
+
assert_equal(@c.proportion, 1.quo(15))
|
87
|
+
assert_equal(@c.proportion(2), 1.quo(15))
|
88
|
+
assert_equal([1,2,3,4,5,6,7,8,9,10], @c.factors.sort)
|
89
|
+
assert_equal(@c.mode,5)
|
90
|
+
assert_equal(@c.n_valid,15)
|
91
|
+
end
|
92
|
+
def test_equality
|
93
|
+
v1=[1,2,3].to_vector
|
94
|
+
v2=[1,2,3].to_vector
|
95
|
+
assert_equal(v1,v2)
|
96
|
+
v1=[1,2,3].to_vector(:nominal)
|
97
|
+
v2=[1,2,3].to_vector(:ordinal)
|
98
|
+
assert_not_equal(v1,v2)
|
99
|
+
v1=[1,2,3].to_vector()
|
100
|
+
v2=[1,2,3].to_vector()
|
101
|
+
assert_equal(v1,v2)
|
102
|
+
end
|
103
|
+
def test_ordinal
|
104
|
+
@c.type=:ordinal
|
105
|
+
assert_equal(5,@c.median)
|
106
|
+
assert_equal(4,@c.percentil(25))
|
107
|
+
assert_equal(7,@c.percentil(75))
|
108
|
+
end
|
109
|
+
def test_ranked
|
110
|
+
v1=[0.8,1.2,1.2,2.3,18].to_vector(:ordinal)
|
111
|
+
expected=[1,2.5,2.5,4,5].to_vector(:ordinal)
|
112
|
+
assert_equal(expected,v1.ranked)
|
113
|
+
end
|
114
|
+
def test_scale
|
115
|
+
a=Statsample::Vector.new([1,2,3,4,"STRING"], :scale)
|
116
|
+
assert_equal(10, a.sum)
|
117
|
+
i=0
|
118
|
+
factors=a.factors.sort
|
119
|
+
[0,1,2,3,4].each{|v|
|
120
|
+
assert(v==factors[i])
|
121
|
+
assert(v.class==factors[i].class,"#{v} - #{v.class} != #{factors[i]} - #{factors[i].class}")
|
122
|
+
i+=1
|
123
|
+
}
|
124
|
+
end
|
125
|
+
def test_vector_standarized
|
126
|
+
v1=[1,2,3,4,nil].to_vector(:scale)
|
127
|
+
sds=v1.sds
|
128
|
+
expected=[((1-2.5).quo(sds)),((2-2.5).quo(sds)),((3-2.5).quo(sds)),((4-2.5).quo(sds)), nil].to_vector(:scale)
|
129
|
+
vs=v1.vector_standarized
|
130
|
+
assert_equal(expected, vs)
|
131
|
+
assert_equal(0,vs.mean)
|
132
|
+
assert_equal(1,vs.sds)
|
133
|
+
end
|
134
|
+
def test_summary
|
135
|
+
@c.type=:nominal
|
136
|
+
assert_match(/Distribution/, @c.summary())
|
137
|
+
@c.type=:ordinal
|
138
|
+
assert_match(/median/, @c.summary())
|
139
|
+
@c.type=:scale
|
140
|
+
assert_match(/mean/, @c.summary())
|
141
|
+
end
|
142
|
+
def test_add
|
143
|
+
a=Statsample::Vector.new([1,2,3,4,5], :scale)
|
144
|
+
b=Statsample::Vector.new([11,12,13,14,15], :scale)
|
145
|
+
assert_equal([3,4,5,6,7], (a+2).to_a)
|
146
|
+
assert_equal([12,14,16,18,20], (a+b).to_a)
|
147
|
+
assert_raise ArgumentError do
|
148
|
+
a + @c
|
149
|
+
end
|
150
|
+
assert_raise TypeError do
|
151
|
+
a+"string"
|
152
|
+
end
|
153
|
+
a=Statsample::Vector.new([nil,1, 2 ,3 ,4 ,5], :scale)
|
154
|
+
b=Statsample::Vector.new([11, 12,nil,13,14,15], :scale)
|
155
|
+
assert_equal([nil,13,nil,16,18,20], (a+b).to_a)
|
156
|
+
assert_equal([nil,13,nil,16,18,20], (a+b.to_a).to_a)
|
157
|
+
end
|
158
|
+
def test_minus
|
159
|
+
a=Statsample::Vector.new([1,2,3,4,5], :scale)
|
160
|
+
b=Statsample::Vector.new([11,12,13,14,15], :scale)
|
161
|
+
assert_equal([-1,0,1,2,3], (a-2).to_a)
|
162
|
+
assert_equal([10,10,10,10,10], (b-a).to_a)
|
163
|
+
assert_raise ArgumentError do
|
164
|
+
a-@c
|
165
|
+
end
|
166
|
+
assert_raise TypeError do
|
167
|
+
a-"string"
|
168
|
+
end
|
169
|
+
a=Statsample::Vector.new([nil,1, 2 ,3 ,4 ,5], :scale)
|
170
|
+
b=Statsample::Vector.new([11, 12,nil,13,14,15], :scale)
|
171
|
+
assert_equal([nil,11,nil,10,10,10], (b-a).to_a)
|
172
|
+
assert_equal([nil,11,nil,10,10,10], (b-a.to_a).to_a)
|
173
|
+
end
|
174
|
+
def test_sum_of_squares
|
175
|
+
a=[1,2,3,4,5,6].to_vector(:scale)
|
176
|
+
assert_equal(17.5, a.sum_of_squared_deviation)
|
177
|
+
end
|
178
|
+
def test_samples
|
179
|
+
srand(1)
|
180
|
+
assert_equal(100,@c.sample_with_replacement(100).size)
|
181
|
+
assert_equal(@c.valid_data.to_a.sort, @c.sample_without_replacement(15).sort)
|
182
|
+
assert_raise ArgumentError do
|
183
|
+
@c.sample_without_replacement(20)
|
184
|
+
end
|
185
|
+
@c.type=:scale
|
186
|
+
srand(1)
|
187
|
+
assert_equal(100, @c.sample_with_replacement(100).size)
|
188
|
+
assert_equal(@c.valid_data.to_a.sort, @c.sample_without_replacement(15).sort)
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_gsl
|
193
|
+
if HAS_GSL
|
194
|
+
a=Statsample::Vector.new([1,2,3,4,"STRING"], :scale)
|
195
|
+
assert_equal(2,a.mean)
|
196
|
+
assert_equal(a.variance_sample_slow,a.variance_sample)
|
197
|
+
assert_equal(a.standard_deviation_sample_slow,a.sds)
|
198
|
+
assert_equal(a.variance_population_slow,a.variance_population)
|
199
|
+
assert_equal(a.standard_deviation_population_slow,a.standard_deviation_population)
|
200
|
+
assert_nothing_raised do
|
201
|
+
a=[].to_vector(:scale)
|
202
|
+
end
|
203
|
+
a.add(1,false)
|
204
|
+
a.add(2,false)
|
205
|
+
a.set_valid_data
|
206
|
+
assert_equal(3,a.sum)
|
207
|
+
b=[1,2,nil,3,4,5,nil,6].to_vector(:scale)
|
208
|
+
assert_equal(21, b.sum)
|
209
|
+
|
210
|
+
assert_equal(3.5, b.mean)
|
211
|
+
assert_equal(6,b.gsl.size)
|
212
|
+
# histogram
|
213
|
+
a=[11,12,13,15,21,22,23,32,33].to_vector(:scale)
|
214
|
+
h=a.histogram(3)
|
215
|
+
assert_equal(4,h[0])
|
216
|
+
assert_equal(3,h[1])
|
217
|
+
assert_equal(2,h[2])
|
218
|
+
h=a.histogram([10,20,30,40])
|
219
|
+
assert_equal(4,h[0])
|
220
|
+
assert_equal(3,h[1])
|
221
|
+
assert_equal(2,h[2])
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|
225
|
+
def test_vector_matrix
|
226
|
+
v1=%w{a a a b b b c c}.to_vector
|
227
|
+
v2=%w{1 3 4 5 6 4 3 2}.to_vector
|
228
|
+
v3=%w{1 0 0 0 1 1 1 0}.to_vector
|
229
|
+
ex=Matrix.rows([["a", "1", "1"], ["a", "3", "0"], ["a", "4", "0"], ["b", "5", "0"], ["b", "6", "1"], ["b", "4", "1"], ["c", "3", "1"], ["c", "2", "0"]])
|
230
|
+
assert_equal(ex,Statsample.vector_cols_matrix(v1,v2,v3))
|
231
|
+
end
|
232
|
+
def test_marshalling
|
233
|
+
v1=(0..100).to_a.collect{|n| rand(100)}.to_vector(:scale)
|
234
|
+
v2=Marshal.load(Marshal.dump(v1))
|
235
|
+
assert_equal(v1,v2)
|
236
|
+
end
|
237
|
+
def test_dup
|
238
|
+
v1=%w{a a a b b b c c}.to_vector
|
239
|
+
v2=v1.dup
|
240
|
+
assert_equal(v1.data,v2.data)
|
241
|
+
assert_not_same(v1.data,v2.data)
|
242
|
+
assert_equal(v1.type,v2.type)
|
243
|
+
|
244
|
+
v1.type=:ordinal
|
245
|
+
assert_not_equal(v1.type,v2.type)
|
246
|
+
assert_equal(v1.missing_values,v2.missing_values)
|
247
|
+
assert_not_same(v1.missing_values,v2.missing_values)
|
248
|
+
assert_equal(v1.labels,v2.labels)
|
249
|
+
assert_not_same(v1.labels,v2.labels)
|
250
|
+
|
251
|
+
v3=v1.dup_empty
|
252
|
+
assert_equal([],v3.data)
|
253
|
+
assert_not_equal(v1.data,v3.data)
|
254
|
+
assert_not_same(v1.data,v3.data)
|
255
|
+
assert_equal(v1.type,v3.type)
|
256
|
+
v1.type=:ordinal
|
257
|
+
v3.type=:nominal
|
258
|
+
assert_not_equal(v1.type,v3.type)
|
259
|
+
assert_equal(v1.missing_values,v3.missing_values)
|
260
|
+
assert_not_same(v1.missing_values,v3.missing_values)
|
261
|
+
assert_equal(v1.labels,v3.labels)
|
262
|
+
assert_not_same(v1.labels,v3.labels)
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
data/test/test_xls.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.dirname(__FILE__)+'/../lib/statsample'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tmpdir'
|
4
|
+
begin
|
5
|
+
require 'spreadsheet'
|
6
|
+
rescue LoadError
|
7
|
+
puts "You should install spreadsheet (gem install spreadsheet)"
|
8
|
+
end
|
9
|
+
class StatsampleExcelTestCase < Test::Unit::TestCase
|
10
|
+
def initialize(*args)
|
11
|
+
@ds=Statsample::Excel.read(File.dirname(__FILE__)+"/test_xls.xls")
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_read
|
16
|
+
assert_equal(6,@ds.cases)
|
17
|
+
assert_equal(%w{id name age city a1},@ds.fields)
|
18
|
+
end
|
19
|
+
def test_nil
|
20
|
+
assert_equal(nil,@ds['age'][5])
|
21
|
+
end
|
22
|
+
def test_write
|
23
|
+
filename=Dir::tmpdir+"/test_write.xls"
|
24
|
+
Statsample::Excel.write(@ds,filename)
|
25
|
+
ds2=Statsample::Excel.read(filename)
|
26
|
+
i=0
|
27
|
+
ds2.each_array{|row|
|
28
|
+
assert_equal(@ds.case_as_array(i),row)
|
29
|
+
i+=1
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: statsample
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Claudio Bustos
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-03 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: spreadsheet
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.6.4
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: svg-graph
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hoe
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.3.2
|
44
|
+
version:
|
45
|
+
description: This package allows to process files and databases for statistical purposes, with focus on validation, recodification and estimation of parameters for several types of samples (simple random, stratified and multistage sampling).
|
46
|
+
email:
|
47
|
+
- clbustos@gmail.com
|
48
|
+
executables:
|
49
|
+
- statsample
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- History.txt
|
54
|
+
- Manifest.txt
|
55
|
+
- README.txt
|
56
|
+
files:
|
57
|
+
- History.txt
|
58
|
+
- Manifest.txt
|
59
|
+
- README.txt
|
60
|
+
- Rakefile
|
61
|
+
- bin/statsample
|
62
|
+
- demo/benchmark.rb
|
63
|
+
- demo/chi-square.rb
|
64
|
+
- demo/dice.rb
|
65
|
+
- demo/distribution_t.rb
|
66
|
+
- demo/graph.rb
|
67
|
+
- demo/item_analysis.rb
|
68
|
+
- demo/mean.rb
|
69
|
+
- demo/proportion.rb
|
70
|
+
- demo/sample_test.csv
|
71
|
+
- demo/strata_proportion.rb
|
72
|
+
- demo/stratum.rb
|
73
|
+
- lib/statsample.rb
|
74
|
+
- lib/statsample/anova.rb
|
75
|
+
- lib/statsample/bivariate.rb
|
76
|
+
- lib/statsample/chidistribution.rb
|
77
|
+
- lib/statsample/codification.rb
|
78
|
+
- lib/statsample/converters.rb
|
79
|
+
- lib/statsample/crosstab.rb
|
80
|
+
- lib/statsample/dataset.rb
|
81
|
+
- lib/statsample/dominanceanalysis.rb
|
82
|
+
- lib/statsample/dominanceanalysis/bootstrap.rb
|
83
|
+
- lib/statsample/graph/gdchart.rb
|
84
|
+
- lib/statsample/graph/svggraph.rb
|
85
|
+
- lib/statsample/graph/svgboxplot.rb
|
86
|
+
- lib/statsample/graph/svghistogram.rb
|
87
|
+
- lib/statsample/graph/svgscatterplot.rb
|
88
|
+
- lib/statsample/htmlreport.rb
|
89
|
+
- lib/statsample/multiset.rb
|
90
|
+
- lib/statsample/regression.rb
|
91
|
+
- lib/statsample/reliability.rb
|
92
|
+
- lib/statsample/resample.rb
|
93
|
+
- lib/statsample/srs.rb
|
94
|
+
- lib/statsample/test.rb
|
95
|
+
- lib/statsample/vector.rb
|
96
|
+
- lib/spss.rb
|
97
|
+
- test/_test_chart.rb
|
98
|
+
- test/test_anova.rb
|
99
|
+
- test/test_codification.rb
|
100
|
+
- test/test_crosstab.rb
|
101
|
+
- test/test_csv.csv
|
102
|
+
- test/test_csv.rb
|
103
|
+
- test/test_dataset.rb
|
104
|
+
- test/test_ggobi.rb
|
105
|
+
- test/test_multiset.rb
|
106
|
+
- test/test_regression.rb
|
107
|
+
- test/test_reliability.rb
|
108
|
+
- test/test_resample.rb
|
109
|
+
- test/test_statistics.rb
|
110
|
+
- test/test_stratified.rb
|
111
|
+
- test/test_svg_graph.rb
|
112
|
+
- test/test_vector.rb
|
113
|
+
has_rdoc: true
|
114
|
+
homepage: http://rubyforge.org/projects/ruby-statsample/
|
115
|
+
licenses: []
|
116
|
+
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options:
|
119
|
+
- --main
|
120
|
+
- README.txt
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: "0"
|
128
|
+
version:
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: "0"
|
134
|
+
version:
|
135
|
+
requirements: []
|
136
|
+
|
137
|
+
rubyforge_project: ruby-statsample
|
138
|
+
rubygems_version: 1.3.5
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: This package allows to process files and databases for statistical purposes, with focus on validation, recodification and estimation of parameters for several types of samples (simple random, stratified and multistage sampling).
|
142
|
+
test_files:
|
143
|
+
- test/test_anova.rb
|
144
|
+
- test/test_codification.rb
|
145
|
+
- test/test_crosstab.rb
|
146
|
+
- test/test_svg_graph.rb
|
147
|
+
- test/test_csv.rb
|
148
|
+
- test/test_resample.rb
|
149
|
+
- test/test_stratified.rb
|
150
|
+
- test/test_vector.rb
|
151
|
+
- test/test_srs.rb
|
152
|
+
- test/test_ggobi.rb
|
153
|
+
- test/test_xls.rb
|
154
|
+
- test/test_statistics.rb
|
155
|
+
- test/test_reliability.rb
|
156
|
+
- test/test_dataset.rb
|
157
|
+
- test/test_regression.rb
|
158
|
+
- test/test_multiset.rb
|