statsample 0.7.0 → 0.8.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/History.txt +7 -0
- data/Manifest.txt +15 -9
- data/README.txt +6 -0
- data/Rakefile +8 -0
- data/{demo → examples}/correlation_matrix.rb +0 -0
- data/{demo/dominanceanalysis.rb → examples/dominance_analysis.rb} +0 -0
- data/{demo → examples}/dominance_analysis_bootstrap.rb +0 -0
- data/{demo → examples}/levene.rb +0 -0
- data/{demo → examples}/multiple_regression.rb +5 -3
- data/{demo → examples}/multivariate_correlation.rb +0 -0
- data/{demo → examples}/polychoric.rb +0 -0
- data/{demo → examples}/principal_axis.rb +0 -0
- data/examples/t_test.rb +11 -0
- data/{demo → examples}/tetrachoric.rb +0 -0
- data/lib/statistics2.rb +1 -1
- data/lib/statsample.rb +57 -6
- data/lib/statsample/bivariate/polychoric.rb +12 -25
- data/lib/statsample/bivariate/tetrachoric.rb +1 -3
- data/lib/statsample/converter/csv.rb +11 -12
- data/lib/statsample/dominanceanalysis/bootstrap.rb +2 -3
- data/lib/statsample/factor/principalaxis.rb +0 -2
- data/lib/statsample/factor/rotation.rb +6 -8
- data/lib/statsample/graph.rb +8 -0
- data/lib/statsample/graph/svggraph.rb +0 -4
- data/lib/statsample/regression/multiple/baseengine.rb +25 -28
- data/lib/statsample/regression/multiple/matrixengine.rb +30 -34
- data/lib/statsample/test.rb +36 -1
- data/lib/statsample/test/levene.rb +11 -7
- data/lib/statsample/test/t.rb +189 -0
- data/test/test_anova.rb +8 -10
- data/test/test_bivariate.rb +40 -37
- data/test/test_codification.rb +9 -13
- data/test/test_combination.rb +37 -39
- data/test/test_crosstab.rb +46 -48
- data/test/test_csv.rb +40 -45
- data/test/test_dataset.rb +150 -152
- data/test/test_distribution.rb +24 -21
- data/test/test_dominance_analysis.rb +10 -12
- data/test/test_factor.rb +95 -91
- data/test/test_ggobi.rb +30 -33
- data/test/test_gsl.rb +4 -4
- data/test/test_helpers.rb +26 -0
- data/test/test_histogram.rb +5 -6
- data/test/test_logit.rb +20 -21
- data/test/test_matrix.rb +47 -48
- data/test/test_mle.rb +130 -131
- data/test/test_multiset.rb +95 -96
- data/test/test_permutation.rb +35 -36
- data/test/test_promise_after.rb +39 -0
- data/test/test_regression.rb +49 -51
- data/test/test_reliability.rb +29 -30
- data/test/test_resample.rb +22 -23
- data/test/test_srs.rb +8 -9
- data/test/test_statistics.rb +12 -6
- data/test/test_stest.rb +18 -10
- data/test/test_stratified.rb +15 -16
- data/test/test_svg_graph.rb +11 -22
- data/test/test_test_t.rb +40 -0
- data/test/test_umannwhitney.rb +14 -15
- data/test/test_vector.rb +33 -37
- data/test/test_xls.rb +34 -41
- metadata +22 -11
data/test/test_permutation.rb
CHANGED
@@ -1,37 +1,36 @@
|
|
1
|
-
|
2
|
-
require 'statsample'
|
3
|
-
require 'test/unit'
|
1
|
+
require(File.dirname(__FILE__)+'/test_helpers.rb')
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
3
|
+
|
4
|
+
class StatsamplePermutationTestCase < MiniTest::Unit::TestCase
|
5
|
+
def initialize(*args)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
def test_number_of_permutations
|
9
|
+
per1=Statsample::Permutation.new(4)
|
10
|
+
assert_equal(24,per1.permutation_number)
|
11
|
+
per2=Statsample::Permutation.new([1,1,1,0,0,0])
|
12
|
+
assert_equal(20,per2.permutation_number)
|
13
|
+
end
|
14
|
+
def test_permutation_with_number
|
15
|
+
per1=Statsample::Permutation.new(2)
|
16
|
+
exp1=[[0,1],[1,0]]
|
17
|
+
assert_equal(exp1,per1.permutations)
|
18
|
+
per2=Statsample::Permutation.new(3)
|
19
|
+
exp2=[[0,1,2],[0,2,1],[1,0,2],[1,2,0],[2,0,1],[2,1,0]]
|
20
|
+
assert_equal(exp2,per2.permutations)
|
21
|
+
|
22
|
+
end
|
23
|
+
def test_permutation_with_array_simple
|
24
|
+
per1=Statsample::Permutation.new(%w{a b})
|
25
|
+
exp1=[['a','b'],['b','a']]
|
26
|
+
assert_equal(exp1,per1.permutations)
|
27
|
+
per2=Statsample::Permutation.new(%w{a b c})
|
28
|
+
exp2=[%w{a b c},%w{a c b},%w{b a c} ,%w{b c a},%w{c a b},%w{c b a}]
|
29
|
+
assert_equal(exp2,per2.permutations)
|
30
|
+
end
|
31
|
+
def test_permutation_with_array_repeated
|
32
|
+
per1=Statsample::Permutation.new([0,0,1,1])
|
33
|
+
exp1=[[0,0,1,1],[0,1,0,1],[0,1,1,0],[1,0,0,1],[1,0,1,0],[1,1,0,0]]
|
34
|
+
assert_equal(exp1,per1.permutations)
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require(File.dirname(__FILE__)+'/test_helpers.rb')
|
2
|
+
|
3
|
+
|
4
|
+
class StatsamplePromiseAfterTestCase < MiniTest::Unit::TestCase
|
5
|
+
class ExpensiveClass
|
6
|
+
extend Statsample::PromiseAfter
|
7
|
+
attr_reader :a, :dirty
|
8
|
+
def initialize
|
9
|
+
@a=nil
|
10
|
+
@b=nil
|
11
|
+
@dirty=false
|
12
|
+
end
|
13
|
+
def compute
|
14
|
+
@a="After"
|
15
|
+
@b="After"
|
16
|
+
@dirty=true
|
17
|
+
end
|
18
|
+
def a
|
19
|
+
@a.nil? ? nil : "@a=#{@a}"
|
20
|
+
end
|
21
|
+
def b
|
22
|
+
"@b=#{@b}"
|
23
|
+
end
|
24
|
+
promise_after :compute, :a
|
25
|
+
end
|
26
|
+
def setup
|
27
|
+
@ec=ExpensiveClass.new
|
28
|
+
end
|
29
|
+
def test_promise_after_before
|
30
|
+
assert_equal(nil, @ec.instance_variable_get("@a"))
|
31
|
+
assert_equal(nil, @ec.instance_variable_get("@b"))
|
32
|
+
assert_equal("@b=",@ec.b)
|
33
|
+
refute(@ec.dirty)
|
34
|
+
# Calling method a active compute
|
35
|
+
assert_equal("@a=After", @ec.a)
|
36
|
+
assert(@ec.dirty)
|
37
|
+
assert_equal("@b=After", @ec.b)
|
38
|
+
end
|
39
|
+
end
|
data/test/test_regression.rb
CHANGED
@@ -1,47 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'minitest/unit'
|
4
|
-
MiniTest::Unit.autorun
|
1
|
+
require(File.dirname(__FILE__)+'/test_helpers.rb')
|
2
|
+
|
5
3
|
class StatsampleRegressionTestCase < MiniTest::Unit::TestCase
|
6
|
-
|
4
|
+
def test_parameters
|
7
5
|
@x=[13,20,10,33,15].to_vector(:scale)
|
8
|
-
|
9
|
-
|
6
|
+
@y=[23,18,35,10,27 ].to_vector(:scale)
|
7
|
+
reg=Statsample::Regression::Simple.new_from_vectors(@x,@y)
|
10
8
|
_test_simple_regression(reg)
|
11
9
|
ds={'x'=>@x,'y'=>@y}.to_dataset
|
12
|
-
|
10
|
+
reg=Statsample::Regression::Simple.new_from_dataset(ds,'x','y')
|
13
11
|
_test_simple_regression(reg)
|
14
12
|
reg=Statsample::Regression.simple(@x,@y)
|
15
13
|
_test_simple_regression(reg)
|
16
|
-
|
17
|
-
|
14
|
+
|
15
|
+
end
|
18
16
|
def _test_simple_regression(reg)
|
19
17
|
assert_in_delta(40.009, reg.a,0.001)
|
20
|
-
|
21
|
-
|
18
|
+
assert_in_delta(-0.957, reg.b,0.001)
|
19
|
+
assert_in_delta(4.248,reg.standard_error,0.002)
|
22
20
|
end
|
23
|
-
|
21
|
+
|
24
22
|
def test_multiple_dependent
|
25
23
|
complete=Matrix[
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
[1,0.53,0.62,0.19,-0.09,0.08,0.02,-0.12,0.08],
|
25
|
+
[0.53,1,0.61,0.23,0.1,0.18,0.02,-0.1,0.15],
|
26
|
+
[0.62,0.61,1,0.03,0.1,0.12,0.03,-0.06,0.12],
|
27
|
+
[0.19,0.23,0.03,1,-0.02,0.02,0,-0.02,-0.02],
|
28
|
+
[-0.09,0.1,0.1,-0.02,1,0.05,0.06,0.18,0.02],
|
29
|
+
[0.08,0.18,0.12,0.02,0.05,1,0.22,-0.07,0.36],
|
30
|
+
[0.02,0.02,0.03,0,0.06,0.22,1,-0.01,-0.05],
|
31
|
+
[-0.12,-0.1,-0.06,-0.02,0.18,-0.07,-0.01,1,-0.03],
|
34
32
|
[0.08,0.15,0.12,-0.02,0.02,0.36,-0.05,-0.03,1]]
|
35
33
|
complete.extend Statsample::CovariateMatrix
|
36
34
|
complete.fields=%w{adhd cd odd sex age monly mwork mage poverty}
|
37
|
-
|
35
|
+
|
38
36
|
lr=Statsample::Regression::Multiple::MultipleDependent.new(complete, %w{adhd cd odd})
|
39
|
-
|
40
|
-
|
37
|
+
|
38
|
+
|
41
39
|
assert_in_delta(0.197, lr.r2yx,0.001)
|
42
40
|
assert_in_delta(0.197, lr.r2yx_covariance,0.001)
|
43
41
|
assert_in_delta(0.07, lr.p2yx,0.001)
|
44
|
-
|
42
|
+
|
45
43
|
|
46
44
|
end
|
47
45
|
def test_multiple_regression_pairwise_2
|
@@ -57,7 +55,7 @@ class StatsampleRegressionTestCase < MiniTest::Unit::TestCase
|
|
57
55
|
assert_in_delta(1361.130,lr.ssr,0.001)
|
58
56
|
assert_in_delta(1046.306,lr.sse,0.001)
|
59
57
|
assert_in_delta(3.035,lr.f,0.001)
|
60
|
-
|
58
|
+
|
61
59
|
end
|
62
60
|
|
63
61
|
|
@@ -73,12 +71,12 @@ class StatsampleRegressionTestCase < MiniTest::Unit::TestCase
|
|
73
71
|
predicted=[1.7857, 6.0989, 3.2433, 7.2908, 4.9667, 10.3428, 8.8158, 10.4717, 23.6639, 25.3198]
|
74
72
|
c_predicted=lr.predicted
|
75
73
|
predicted.each_index{|i|
|
76
|
-
|
74
|
+
assert_in_delta(predicted[i],c_predicted[i],0.001)
|
77
75
|
}
|
78
76
|
residuals=[1.2142, -2.0989, 1.7566, -1.29085, 2.033, -2.3428, 0.18414, -0.47177, -3.66395, 4.6801]
|
79
77
|
c_residuals=lr.residuals
|
80
78
|
residuals.each_index{|i|
|
81
|
-
|
79
|
+
assert_in_delta(residuals[i],c_residuals[i],0.001)
|
82
80
|
}
|
83
81
|
else
|
84
82
|
puts "Regression::Multiple::GslEngine not tested (no Gsl)"
|
@@ -86,54 +84,54 @@ class StatsampleRegressionTestCase < MiniTest::Unit::TestCase
|
|
86
84
|
end
|
87
85
|
|
88
86
|
|
89
|
-
|
87
|
+
|
90
88
|
def model_test_matrix(lr,name='undefined')
|
91
|
-
|
89
|
+
|
92
90
|
stan_coeffs={'a'=>0.151,'b'=>-0.547,'c'=>0.997}
|
93
91
|
unstan_coeffs={'a'=>0.695, 'b'=>-4.286, 'c'=>0.266}
|
94
|
-
|
92
|
+
|
95
93
|
unstan_coeffs.each_key{|k|
|
96
94
|
assert_in_delta(unstan_coeffs[k], lr.coeffs[k],0.001,"b coeffs - #{name}")
|
97
95
|
}
|
98
96
|
|
99
|
-
|
100
|
-
|
97
|
+
stan_coeffs.each_key{|k|
|
98
|
+
assert_in_delta(stan_coeffs[k], lr.standarized_coeffs[k],0.001, "beta coeffs - #{name}")
|
101
99
|
}
|
102
|
-
|
100
|
+
|
103
101
|
assert_in_delta(11.027,lr.constant,0.001)
|
104
|
-
|
102
|
+
|
105
103
|
assert_in_delta(0.955,lr.r,0.001)
|
106
104
|
assert_in_delta(0.913,lr.r2,0.001)
|
107
105
|
|
108
106
|
assert_in_delta(20.908, lr.f,0.001)
|
109
107
|
assert_in_delta(0.001, lr.significance, 0.001)
|
110
108
|
assert_in_delta(0.226,lr.tolerance("a"),0.001)
|
111
|
-
|
109
|
+
|
112
110
|
coeffs_se={"a"=>1.171,"b"=>1.129,"c"=>0.072}
|
113
111
|
|
114
|
-
|
115
|
-
|
112
|
+
|
113
|
+
|
116
114
|
ccoeffs_se=lr.coeffs_se
|
117
115
|
coeffs_se.each_key{|k|
|
118
|
-
|
116
|
+
assert_in_delta(coeffs_se[k],ccoeffs_se[k],0.001)
|
119
117
|
}
|
120
118
|
coeffs_t={"a"=>0.594,"b"=>-3.796,"c"=>3.703}
|
121
119
|
ccoeffs_t=lr.coeffs_t
|
122
120
|
coeffs_t.each_key{|k|
|
123
|
-
|
121
|
+
assert_in_delta(coeffs_t[k], ccoeffs_t[k],0.001)
|
124
122
|
}
|
125
|
-
|
123
|
+
|
126
124
|
assert_in_delta(639.6,lr.sst,0.001)
|
127
125
|
assert_in_delta(583.76,lr.ssr,0.001)
|
128
126
|
assert_in_delta(55.840,lr.sse,0.001)
|
129
|
-
|
127
|
+
|
130
128
|
end
|
131
129
|
def model_test(lr,name='undefined')
|
132
130
|
model_test_matrix(lr,name)
|
133
131
|
assert_in_delta(4.559, lr.constant_se,0.001)
|
134
132
|
assert_in_delta(2.419, lr.constant_t,0.001)
|
135
|
-
|
136
|
-
assert_in_delta(1.785,lr.process([1,3,11]),0.001)
|
133
|
+
|
134
|
+
assert_in_delta(1.785,lr.process([1,3,11]),0.001)
|
137
135
|
end
|
138
136
|
def test_regression_matrix
|
139
137
|
@a=[1,3,2,4,3,5,4,6,5,7].to_vector(:scale)
|
@@ -141,16 +139,16 @@ class StatsampleRegressionTestCase < MiniTest::Unit::TestCase
|
|
141
139
|
@c=[11,22,30,40,50,65,78,79,99,100].to_vector(:scale)
|
142
140
|
@y=[3,4,5,6,7,8,9,10,20,30].to_vector(:scale)
|
143
141
|
ds={'a'=>@a,'b'=>@b,'c'=>@c,'y'=>@y}.to_dataset
|
144
|
-
|
142
|
+
|
145
143
|
cor=Statsample::Bivariate.correlation_matrix(ds)
|
146
144
|
lr=Statsample::Regression::Multiple::MatrixEngine.new(cor,'y', :y_mean=>@y.mean, :x_mean=>{'a'=>ds['a'].mean, 'b'=>ds['b'].mean, 'c'=>ds['c'].mean}, :cases=>@a.size, :y_sd=>@y.sd , :x_sd=>{'a' => @a.sd, 'b' => @b.sd, 'c' => @c.sd})
|
147
145
|
assert_nil(lr.constant_se)
|
148
146
|
assert_nil(lr.constant_t)
|
149
147
|
model_test_matrix(lr, "correlation matrix")
|
150
|
-
|
148
|
+
|
151
149
|
covariance=Statsample::Bivariate.covariance_matrix(ds)
|
152
150
|
lr=Statsample::Regression::Multiple::MatrixEngine.new(covariance,'y', :y_mean=>@y.mean, :x_mean=>{'a'=>ds['a'].mean, 'b'=>ds['b'].mean, 'c'=>ds['c'].mean}, :cases=>@a.size)
|
153
|
-
|
151
|
+
|
154
152
|
model_test(lr , "covariance matrix")
|
155
153
|
end
|
156
154
|
def test_regression_rubyengine
|
@@ -161,10 +159,10 @@ class StatsampleRegressionTestCase < MiniTest::Unit::TestCase
|
|
161
159
|
ds={'a'=>@a,'b'=>@b,'c'=>@c,'y'=>@y}.to_dataset
|
162
160
|
lr=Statsample::Regression::Multiple::RubyEngine.new(ds,'y')
|
163
161
|
model_test(lr, 'rubyengine with missing data')
|
164
|
-
|
162
|
+
|
165
163
|
predicted=[nil,1.7857, 6.0989, 3.2433, 7.2908, 4.9667, 10.3428, 8.8158, 10.4717, 23.6639, 25.3198]
|
166
164
|
c_predicted = lr.predicted
|
167
|
-
|
165
|
+
|
168
166
|
predicted.each_index do |i|
|
169
167
|
if c_predicted[i].nil?
|
170
168
|
assert(predicted[i].nil?)
|
@@ -181,6 +179,6 @@ class StatsampleRegressionTestCase < MiniTest::Unit::TestCase
|
|
181
179
|
assert_in_delta(residuals[i],c_residuals[i],0.001)
|
182
180
|
end
|
183
181
|
end
|
184
|
-
|
182
|
+
|
185
183
|
end
|
186
|
-
end
|
184
|
+
end
|
data/test/test_reliability.rb
CHANGED
@@ -1,33 +1,32 @@
|
|
1
|
-
|
2
|
-
require 'statsample'
|
3
|
-
require 'test/unit'
|
1
|
+
require(File.dirname(__FILE__)+'/test_helpers.rb')
|
4
2
|
|
5
|
-
class StatsampleReliabilityTestCase < Test::Unit::TestCase
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
4
|
+
class StatsampleReliabilityTestCase < MiniTest::Unit::TestCase
|
5
|
+
|
6
|
+
def initialize(*args)
|
7
|
+
super
|
8
|
+
@x1=[1,1,1,1,2,2,2,2,3,3,3,30].to_vector(:scale)
|
9
|
+
@x2=[1,1,1,2,2,3,3,3,3,4,4,50].to_vector(:scale)
|
10
|
+
@x3=[2,2,1,1,1,2,2,2,3,4,5,40].to_vector(:scale)
|
11
|
+
@x4=[1,2,3,4,4,4,4,3,4,4,5,30].to_vector(:scale)
|
12
|
+
@ds={'x1'=>@x1,'x2'=>@x2,'x3'=>@x3,'x4'=>@x4}.to_dataset
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_general
|
16
|
+
ia=Statsample::Reliability::ItemAnalysis.new(@ds)
|
17
|
+
assert_in_delta(0.980,ia.alpha,0.001)
|
18
|
+
assert_in_delta(0.999,ia.alpha_standarized,0.001)
|
19
|
+
assert_in_delta(0.999,ia.item_total_correlation()['x1'],0.001)
|
20
|
+
assert_in_delta(1050.455,ia.stats_if_deleted()['x1'][:variance_sample],0.001)
|
21
|
+
end
|
22
|
+
def test_icc
|
23
|
+
#p @x1.factors
|
24
|
+
icc=Statsample::Reliability::ItemCharacteristicCurve.new(@ds)
|
25
|
+
# Need to create the test!!!!
|
26
|
+
#p icc.curve_field('x1',1).sort
|
27
|
+
#p icc.curve_field('x1',2).sort
|
28
|
+
#p icc.curve_field('x1',3).sort
|
29
|
+
#p icc.curve_field('x1',30).sort
|
30
|
+
|
31
|
+
end
|
33
32
|
end
|
data/test/test_resample.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
|
-
|
2
|
-
require 'statsample'
|
3
|
-
require 'test/unit'
|
1
|
+
require(File.dirname(__FILE__)+'/test_helpers.rb')
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
3
|
+
|
4
|
+
class StatsampleResampleTestCase < MiniTest::Unit::TestCase
|
5
|
+
def initialize(*args)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
def test_basic
|
9
|
+
r=Statsample::Resample.generate(20,1,10)
|
10
|
+
assert_equal(20,r.size)
|
11
|
+
assert(r.min>=1)
|
12
|
+
assert(r.max<=10)
|
13
|
+
end
|
14
|
+
def test_repeat_and_save
|
15
|
+
r=Statsample::Resample.repeat_and_save(400) {
|
16
|
+
Statsample::Resample.generate(20,1,10).count(1)
|
17
|
+
}
|
18
|
+
assert_equal(400,r.size)
|
19
|
+
v=Statsample::Vector.new(r,:scale)
|
20
|
+
a=v.count {|x| x > 3}
|
21
|
+
assert(a>=30 && a<=70)
|
22
|
+
end
|
23
|
+
end
|
data/test/test_srs.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
|
2
|
-
require 'statsample'
|
3
|
-
require 'test/unit'
|
1
|
+
require(File.dirname(__FILE__)+'/test_helpers.rb')
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
|
4
|
+
class StatsampleSrsTestCase < MiniTest::Unit::TestCase
|
5
|
+
def test_std_error
|
6
|
+
assert_equal(384,Statsample::SRS.estimation_n0(0.05,0.5,0.95).to_i)
|
7
|
+
assert_equal(108,Statsample::SRS.estimation_n(0.05,0.5,150,0.95).to_i)
|
8
|
+
assert_in_delta(0.0289,Statsample::SRS.proportion_sd_kp_wor(0.5,100,150),0.001)
|
9
|
+
end
|
11
10
|
end
|