statsample 1.4.1 → 1.4.2
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.
- checksums.yaml +4 -4
 - data/.travis.yml +4 -3
 - data/History.txt +4 -0
 - data/README.md +4 -0
 - data/lib/statsample/converter/csv.rb +41 -54
 - data/lib/statsample/converters.rb +18 -19
 - data/lib/statsample/version.rb +1 -1
 - data/test/fixtures/scientific_notation.csv +4 -0
 - data/test/helpers_tests.rb +37 -38
 - data/test/test_analysis.rb +96 -97
 - data/test/test_anova_contrast.rb +22 -22
 - data/test/test_anovaoneway.rb +12 -12
 - data/test/test_anovatwoway.rb +16 -17
 - data/test/test_anovatwowaywithdataset.rb +22 -24
 - data/test/test_anovawithvectors.rb +67 -69
 - data/test/test_awesome_print_bug.rb +9 -9
 - data/test/test_bartlettsphericity.rb +13 -13
 - data/test/test_bivariate.rb +122 -126
 - data/test/test_codification.rb +51 -49
 - data/test/test_crosstab.rb +44 -40
 - data/test/test_csv.rb +52 -70
 - data/test/test_dataset.rb +347 -330
 - data/test/test_dominance_analysis.rb +22 -24
 - data/test/test_factor.rb +163 -166
 - data/test/test_factor_map.rb +25 -30
 - data/test/test_factor_pa.rb +28 -28
 - data/test/test_ggobi.rb +19 -18
 - data/test/test_gsl.rb +13 -15
 - data/test/test_histogram.rb +74 -77
 - data/test/test_matrix.rb +29 -31
 - data/test/test_multiset.rb +132 -126
 - data/test/test_regression.rb +143 -149
 - data/test/test_reliability.rb +149 -155
 - data/test/test_reliability_icc.rb +100 -104
 - data/test/test_reliability_skillscale.rb +38 -40
 - data/test/test_resample.rb +14 -12
 - data/test/test_rserve_extension.rb +33 -33
 - data/test/test_srs.rb +5 -5
 - data/test/test_statistics.rb +52 -50
 - data/test/test_stest.rb +27 -28
 - data/test/test_stratified.rb +10 -10
 - data/test/test_test_f.rb +17 -17
 - data/test/test_test_kolmogorovsmirnov.rb +21 -21
 - data/test/test_test_t.rb +52 -52
 - data/test/test_umannwhitney.rb +16 -16
 - data/test/test_vector.rb +419 -410
 - data/test/test_wilcoxonsignedrank.rb +60 -63
 - data/test/test_xls.rb +41 -41
 - metadata +55 -5
 - data/web/Rakefile +0 -39
 
    
        data/test/test_anova_contrast.rb
    CHANGED
    
    | 
         @@ -1,36 +1,36 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
         
     | 
| 
       2 
     | 
    
         
            -
            class StatsampleAnovaContrastTestCase <  
     | 
| 
      
 1 
     | 
    
         
            +
            require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))
         
     | 
| 
      
 2 
     | 
    
         
            +
            class StatsampleAnovaContrastTestCase < Minitest::Test
         
     | 
| 
       3 
3 
     | 
    
         
             
              context(Statsample::Anova::Contrast) do
         
     | 
| 
       4 
4 
     | 
    
         
             
                setup do
         
     | 
| 
       5 
     | 
    
         
            -
                  constant=[12,13,11,12,12].to_scale
         
     | 
| 
       6 
     | 
    
         
            -
                  frequent=[9,10,9,13,14].to_scale
         
     | 
| 
       7 
     | 
    
         
            -
                  infrequent=[15,16,17,16,16].to_scale
         
     | 
| 
       8 
     | 
    
         
            -
                  never=[17,18,12,18,20].to_scale
         
     | 
| 
       9 
     | 
    
         
            -
                  @vectors=[constant, frequent, infrequent, never]
         
     | 
| 
       10 
     | 
    
         
            -
                  @c=Statsample::Anova::Contrast.new(:vectors 
     | 
| 
      
 5 
     | 
    
         
            +
                  constant = [12, 13, 11, 12, 12].to_scale
         
     | 
| 
      
 6 
     | 
    
         
            +
                  frequent = [9, 10, 9, 13, 14].to_scale
         
     | 
| 
      
 7 
     | 
    
         
            +
                  infrequent = [15, 16, 17, 16, 16].to_scale
         
     | 
| 
      
 8 
     | 
    
         
            +
                  never = [17, 18, 12, 18, 20].to_scale
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @vectors = [constant, frequent, infrequent, never]
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @c = Statsample::Anova::Contrast.new(vectors: @vectors)
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
     | 
    
         
            -
                should  
     | 
| 
       13 
     | 
    
         
            -
                  @c.c([1 
     | 
| 
       14 
     | 
    
         
            -
                   
     | 
| 
      
 12 
     | 
    
         
            +
                should 'return correct value using c' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @c.c([1, -1.quo(3), -1.quo(3), -1.quo(3)])
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # @c.c([1,-0.333,-0.333,-0.333])
         
     | 
| 
       15 
15 
     | 
    
         
             
                  assert_in_delta(-2.6667, @c.psi, 0.0001)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  assert_in_delta(1.0165, @c.se, 0.0001)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  assert_in_delta(-2.623, @c.t, 0.001)
         
     | 
| 
       18 
     | 
    
         
            -
                  assert_in_delta(-4.82, @c.confidence_interval[0],0.01)
         
     | 
| 
       19 
     | 
    
         
            -
                  assert_in_delta(-0.51, @c.confidence_interval[1],0.01)
         
     | 
| 
       20 
     | 
    
         
            -
                  assert(@c.summary.size>0)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  assert_in_delta(-4.82, @c.confidence_interval[0], 0.01)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  assert_in_delta(-0.51, @c.confidence_interval[1], 0.01)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  assert(@c.summary.size > 0)
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
| 
       22 
     | 
    
         
            -
                should  
     | 
| 
       23 
     | 
    
         
            -
                  @c.c_by_index([0],[1,2,3])
         
     | 
| 
      
 22 
     | 
    
         
            +
                should 'return correct values using c_by_index' do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @c.c_by_index([0], [1, 2, 3])
         
     | 
| 
       24 
24 
     | 
    
         
             
                  assert_in_delta(-2.6667, @c.psi, 0.0001)
         
     | 
| 
       25 
25 
     | 
    
         
             
                  assert_in_delta(1.0165, @c.se, 0.0001)
         
     | 
| 
       26 
26 
     | 
    
         
             
                  assert_in_delta(-2.623, @c.t, 0.001)
         
     | 
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
     | 
    
         
            -
                should  
     | 
| 
       29 
     | 
    
         
            -
                  c1=Statsample::Anova::Contrast.new(:vectors 
     | 
| 
       30 
     | 
    
         
            -
                  c2=Statsample::Anova::Contrast.new(:vectors 
     | 
| 
       31 
     | 
    
         
            -
                  assert_equal(c1.psi,c2.psi)
         
     | 
| 
       32 
     | 
    
         
            -
                  assert_equal(c1.se,c2.se)
         
     | 
| 
       33 
     | 
    
         
            -
                  assert_equal(c1.t,c2.t)
         
     | 
| 
      
 28 
     | 
    
         
            +
                should 'return correct values using incomplete c_by_index' do
         
     | 
| 
      
 29 
     | 
    
         
            +
                  c1 = Statsample::Anova::Contrast.new(vectors: @vectors, c: [0.5, 0.5, -1, 0])
         
     | 
| 
      
 30 
     | 
    
         
            +
                  c2 = Statsample::Anova::Contrast.new(vectors: @vectors, c1: [0, 1], c2: [2])
         
     | 
| 
      
 31 
     | 
    
         
            +
                  assert_equal(c1.psi, c2.psi)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  assert_equal(c1.se, c2.se)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  assert_equal(c1.t, c2.t)
         
     | 
| 
       34 
34 
     | 
    
         
             
                end
         
     | 
| 
       35 
35 
     | 
    
         
             
              end
         
     | 
| 
       36 
36 
     | 
    
         
             
            end
         
     | 
    
        data/test/test_anovaoneway.rb
    CHANGED
    
    | 
         @@ -1,26 +1,26 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
         
     | 
| 
       2 
     | 
    
         
            -
            class StatsampleAnovaOneWayTestCase <  
     | 
| 
      
 1 
     | 
    
         
            +
            require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))
         
     | 
| 
      
 2 
     | 
    
         
            +
            class StatsampleAnovaOneWayTestCase < Minitest::Test
         
     | 
| 
       3 
3 
     | 
    
         
             
              context(Statsample::Anova::OneWay) do
         
     | 
| 
       4 
4 
     | 
    
         
             
                setup do
         
     | 
| 
       5 
     | 
    
         
            -
                  @ss_num=30.08
         
     | 
| 
       6 
     | 
    
         
            -
                  @ss_den=87.88
         
     | 
| 
       7 
     | 
    
         
            -
                  @df_num=2
         
     | 
| 
       8 
     | 
    
         
            -
                  @df_den=21
         
     | 
| 
       9 
     | 
    
         
            -
                  @anova=Statsample::Anova::OneWay.new(:ss_num 
     | 
| 
      
 5 
     | 
    
         
            +
                  @ss_num = 30.08
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @ss_den = 87.88
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @df_num = 2
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @df_den = 21
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @anova = Statsample::Anova::OneWay.new(ss_num: @ss_num, ss_den: @ss_den, df_num: @df_num, df_den: @df_den)
         
     | 
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
     | 
    
         
            -
                should  
     | 
| 
      
 11 
     | 
    
         
            +
                should 'Statsample::Anova.oneway respond to #oneway' do
         
     | 
| 
       12 
12 
     | 
    
         
             
                  assert(Statsample::Anova.respond_to? :oneway)
         
     | 
| 
       13 
13 
     | 
    
         
             
                end
         
     | 
| 
       14 
     | 
    
         
            -
                should  
     | 
| 
      
 14 
     | 
    
         
            +
                should 'return correct value for ms_num and ms_den' do
         
     | 
| 
       15 
15 
     | 
    
         
             
                  assert_in_delta(15.04, @anova.ms_num, 0.01)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  assert_in_delta(4.18, @anova.ms_den, 0.01)
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
     | 
    
         
            -
                should  
     | 
| 
      
 18 
     | 
    
         
            +
                should 'return correct value for f' do
         
     | 
| 
       19 
19 
     | 
    
         
             
                  assert_in_delta(3.59, @anova.f, 0.01)
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
     | 
    
         
            -
                should  
     | 
| 
      
 21 
     | 
    
         
            +
                should 'respond to summary' do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  assert(@anova.respond_to? :summary)
         
     | 
| 
       23 
     | 
    
         
            -
                  assert(@anova.summary.size>0)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  assert(@anova.summary.size > 0)
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         
             
            end
         
     | 
    
        data/test/test_anovatwoway.rb
    CHANGED
    
    | 
         @@ -1,38 +1,37 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
         
     | 
| 
       2 
     | 
    
         
            -
            class StatsampleAnovaTwoWayTestCase <  
     | 
| 
      
 1 
     | 
    
         
            +
            require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))
         
     | 
| 
      
 2 
     | 
    
         
            +
            class StatsampleAnovaTwoWayTestCase < Minitest::Test
         
     | 
| 
       3 
3 
     | 
    
         
             
              context(Statsample::Anova::TwoWay) do
         
     | 
| 
       4 
4 
     | 
    
         
             
                setup do
         
     | 
| 
       5 
     | 
    
         
            -
                  @ss_a=192.2
         
     | 
| 
       6 
     | 
    
         
            -
                  @ss_b=57.8
         
     | 
| 
       7 
     | 
    
         
            -
                  @ss_axb=168.2
         
     | 
| 
       8 
     | 
    
         
            -
                  @ss_within=75.6
         
     | 
| 
       9 
     | 
    
         
            -
                  @df_a 
     | 
| 
       10 
     | 
    
         
            -
                  @df_within=16
         
     | 
| 
       11 
     | 
    
         
            -
                  @anova=Statsample::Anova::TwoWay.new(:ss_a 
     | 
| 
      
 5 
     | 
    
         
            +
                  @ss_a = 192.2
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @ss_b = 57.8
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @ss_axb = 168.2
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @ss_within = 75.6
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @df_a = @df_b = 1
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @df_within = 16
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @anova = Statsample::Anova::TwoWay.new(ss_a: @ss_a, ss_b: @ss_b, ss_axb: @ss_axb, ss_within: @ss_within, df_a: @df_a, df_b: @df_b, df_within: @df_within)
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
     | 
    
         
            -
                should  
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
                should 'Statsample::Anova.twoway respond to #twoway' do
         
     | 
| 
      
 14 
     | 
    
         
            +
                  assert(Statsample::Anova.respond_to? :twoway)
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
     | 
    
         
            -
                should  
     | 
| 
      
 16 
     | 
    
         
            +
                should 'return correct value for ms_a, ms_b and ms_axb' do
         
     | 
| 
       17 
17 
     | 
    
         
             
                  assert_in_delta(192.2, @anova.ms_a, 0.01)
         
     | 
| 
       18 
18 
     | 
    
         
             
                  assert_in_delta(57.8, @anova.ms_b, 0.01)
         
     | 
| 
       19 
19 
     | 
    
         
             
                  assert_in_delta(168.2, @anova.ms_axb, 0.01)
         
     | 
| 
       20 
     | 
    
         
            -
                  
         
     | 
| 
       21 
20 
     | 
    
         
             
                end
         
     | 
| 
       22 
     | 
    
         
            -
                should  
     | 
| 
      
 21 
     | 
    
         
            +
                should 'return correct value for f ' do
         
     | 
| 
       23 
22 
     | 
    
         
             
                  assert_in_delta(40.68, @anova.f_a, 0.01)
         
     | 
| 
       24 
23 
     | 
    
         
             
                  assert_in_delta(12.23, @anova.f_b, 0.01)
         
     | 
| 
       25 
24 
     | 
    
         
             
                  assert_in_delta(35.60, @anova.f_axb, 0.01)
         
     | 
| 
       26 
25 
     | 
    
         
             
                end
         
     | 
| 
       27 
     | 
    
         
            -
                should  
     | 
| 
      
 26 
     | 
    
         
            +
                should 'return correct value for probability for f ' do
         
     | 
| 
       28 
27 
     | 
    
         
             
                  assert(@anova.f_a_probability < 0.05)
         
     | 
| 
       29 
28 
     | 
    
         
             
                  assert(@anova.f_b_probability < 0.05)
         
     | 
| 
       30 
29 
     | 
    
         
             
                  assert(@anova.f_axb_probability < 0.05)
         
     | 
| 
       31 
30 
     | 
    
         
             
                end
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                should  
     | 
| 
      
 32 
     | 
    
         
            +
                should 'respond to summary' do
         
     | 
| 
       34 
33 
     | 
    
         
             
                  assert(@anova.respond_to? :summary)
         
     | 
| 
       35 
     | 
    
         
            -
                  assert(@anova.summary.size>0)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  assert(@anova.summary.size > 0)
         
     | 
| 
       36 
35 
     | 
    
         
             
                end
         
     | 
| 
       37 
36 
     | 
    
         
             
              end
         
     | 
| 
       38 
37 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,49 +1,47 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
         
     | 
| 
      
 1 
     | 
    
         
            +
            require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))
         
     | 
| 
       2 
2 
     | 
    
         
             
            # Reference:
         
     | 
| 
       3 
3 
     | 
    
         
             
            # * http://www.uwsp.edu/psych/Stat/13/anova-2w.htm#III
         
     | 
| 
       4 
     | 
    
         
            -
            class StatsampleAnovaTwoWayWithVectorsTestCase <  
     | 
| 
      
 4 
     | 
    
         
            +
            class StatsampleAnovaTwoWayWithVectorsTestCase < Minitest::Test
         
     | 
| 
       5 
5 
     | 
    
         
             
              context(Statsample::Anova::TwoWayWithVectors) do
         
     | 
| 
       6 
6 
     | 
    
         
             
                setup do
         
     | 
| 
       7 
     | 
    
         
            -
                  @pa=[5,4,3,4,2,18,19,14,12,15,6,7,5,8,4,6,9,5,9,3].to_scale
         
     | 
| 
       8 
     | 
    
         
            -
                  @pa.name= 
     | 
| 
       9 
     | 
    
         
            -
                  @a=[0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1].to_vector
         
     | 
| 
       10 
     | 
    
         
            -
                  @a.labels={0=>'0%',1=>'35%'}
         
     | 
| 
       11 
     | 
    
         
            -
                  @a.name='Diet'
         
     | 
| 
       12 
     | 
    
         
            -
                  @b=[0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1].to_vector
         
     | 
| 
       13 
     | 
    
         
            -
                  @b.labels={0=>'Young',1=>'Older'}
         
     | 
| 
       14 
     | 
    
         
            -
                  @b.name= 
     | 
| 
       15 
     | 
    
         
            -
                  @anova=Statsample::Anova::TwoWayWithVectors.new(:a 
     | 
| 
      
 7 
     | 
    
         
            +
                  @pa = [5, 4, 3, 4, 2, 18, 19, 14, 12, 15, 6, 7, 5, 8, 4, 6, 9, 5, 9, 3].to_scale
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @pa.name = 'Passive Avoidance'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @a = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1].to_vector
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @a.labels = { 0 => '0%', 1 => '35%' }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @a.name = 'Diet'
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @b = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1].to_vector
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @b.labels = { 0 => 'Young', 1 => 'Older' }
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @b.name = 'Age'
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @anova = Statsample::Anova::TwoWayWithVectors.new(a: @a, b: @b, dependent: @pa)
         
     | 
| 
       16 
16 
     | 
    
         
             
                end
         
     | 
| 
       17 
     | 
    
         
            -
                should  
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                should 'Statsample::Anova respond to #twoway_with_vectors' do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  assert(Statsample::Anova.respond_to? :twoway_with_vectors)
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
     | 
    
         
            -
                should  
     | 
| 
       21 
     | 
    
         
            -
                  @anova2=Statsample::Anova.twoway_with_vectors(:a 
     | 
| 
      
 20 
     | 
    
         
            +
                should '#new returns the same as Statsample::Anova.twoway_with_vectors' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @anova2 = Statsample::Anova.twoway_with_vectors(a: @a, b: @b, dependent: @pa)
         
     | 
| 
       22 
22 
     | 
    
         
             
                  assert_equal(@anova.summary, @anova2.summary)
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
     | 
    
         
            -
                should  
     | 
| 
      
 24 
     | 
    
         
            +
                should 'return correct value for ms_a, ms_b and ms_axb' do
         
     | 
| 
       25 
25 
     | 
    
         
             
                  assert_in_delta(192.2, @anova.ms_a, 0.01)
         
     | 
| 
       26 
26 
     | 
    
         
             
                  assert_in_delta(57.8, @anova.ms_b, 0.01)
         
     | 
| 
       27 
27 
     | 
    
         
             
                  assert_in_delta(168.2, @anova.ms_axb, 0.01)
         
     | 
| 
       28 
     | 
    
         
            -
                  
         
     | 
| 
       29 
28 
     | 
    
         
             
                end
         
     | 
| 
       30 
     | 
    
         
            -
                should  
     | 
| 
      
 29 
     | 
    
         
            +
                should 'return correct value for f ' do
         
     | 
| 
       31 
30 
     | 
    
         
             
                  assert_in_delta(40.68, @anova.f_a, 0.01)
         
     | 
| 
       32 
31 
     | 
    
         
             
                  assert_in_delta(12.23, @anova.f_b, 0.01)
         
     | 
| 
       33 
32 
     | 
    
         
             
                  assert_in_delta(35.60, @anova.f_axb, 0.01)
         
     | 
| 
       34 
33 
     | 
    
         
             
                end
         
     | 
| 
       35 
     | 
    
         
            -
                should  
     | 
| 
      
 34 
     | 
    
         
            +
                should 'return correct value for probability for f ' do
         
     | 
| 
       36 
35 
     | 
    
         
             
                  assert(@anova.f_a_probability < 0.05)
         
     | 
| 
       37 
36 
     | 
    
         
             
                  assert(@anova.f_b_probability < 0.05)
         
     | 
| 
       38 
37 
     | 
    
         
             
                  assert(@anova.f_axb_probability < 0.05)
         
     | 
| 
       39 
38 
     | 
    
         
             
                end
         
     | 
| 
       40 
39 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                should  
     | 
| 
       42 
     | 
    
         
            -
                  
         
     | 
| 
       43 
     | 
    
         
            -
                  @anova. 
     | 
| 
       44 
     | 
    
         
            -
                  @anova.summary_levene=true
         
     | 
| 
      
 40 
     | 
    
         
            +
                should 'respond to summary' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  @anova.summary_descriptives = true
         
     | 
| 
      
 42 
     | 
    
         
            +
                  @anova.summary_levene = true
         
     | 
| 
       45 
43 
     | 
    
         
             
                  assert(@anova.respond_to? :summary)
         
     | 
| 
       46 
     | 
    
         
            -
                  assert(@anova.summary.size>0)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  assert(@anova.summary.size > 0)
         
     | 
| 
       47 
45 
     | 
    
         
             
                end
         
     | 
| 
       48 
46 
     | 
    
         
             
              end
         
     | 
| 
       49 
47 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,102 +1,100 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
         
     | 
| 
       2 
     | 
    
         
            -
            class StatsampleAnovaOneWayWithVectorsTestCase <  
     | 
| 
      
 1 
     | 
    
         
            +
            require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))
         
     | 
| 
      
 2 
     | 
    
         
            +
            class StatsampleAnovaOneWayWithVectorsTestCase < Minitest::Test
         
     | 
| 
       3 
3 
     | 
    
         
             
              context(Statsample::Anova::OneWayWithVectors) do
         
     | 
| 
       4 
     | 
    
         
            -
                
         
     | 
| 
       5 
     | 
    
         
            -
                context("when initializing") do
         
     | 
| 
      
 4 
     | 
    
         
            +
                context('when initializing') do
         
     | 
| 
       6 
5 
     | 
    
         
             
                  setup do
         
     | 
| 
       7 
     | 
    
         
            -
                    @v1=10.times.map {rand(100)}.to_scale
         
     | 
| 
       8 
     | 
    
         
            -
                    @v2=10.times.map {rand(100)}.to_scale
         
     | 
| 
       9 
     | 
    
         
            -
                    @v3=10.times.map {rand(100)}.to_scale
         
     | 
| 
      
 6 
     | 
    
         
            +
                    @v1 = 10.times.map { rand(100) }.to_scale
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @v2 = 10.times.map { rand(100) }.to_scale
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @v3 = 10.times.map { rand(100) }.to_scale
         
     | 
| 
       10 
9 
     | 
    
         
             
                  end
         
     | 
| 
       11 
     | 
    
         
            -
                  should  
     | 
| 
       12 
     | 
    
         
            -
                    a1=Statsample::Anova::OneWayWithVectors.new(@v1 
     | 
| 
       13 
     | 
    
         
            -
                    a2=Statsample::Anova::OneWayWithVectors.new([@v1 
     | 
| 
       14 
     | 
    
         
            -
                    assert_equal(a1.f,a2.f)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  should 'be the same using [] or args*' do
         
     | 
| 
      
 11 
     | 
    
         
            +
                    a1 = Statsample::Anova::OneWayWithVectors.new(@v1, @v2, @v3)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    a2 = Statsample::Anova::OneWayWithVectors.new([@v1, @v2, @v3])
         
     | 
| 
      
 13 
     | 
    
         
            +
                    assert_equal(a1.f, a2.f)
         
     | 
| 
       15 
14 
     | 
    
         
             
                  end
         
     | 
| 
       16 
     | 
    
         
            -
                  should  
     | 
| 
       17 
     | 
    
         
            -
                    a1=Statsample::Anova::OneWayWithVectors.new(@v1 
     | 
| 
       18 
     | 
    
         
            -
                    a2=Statsample::Anova.oneway_with_vectors(@v1 
     | 
| 
       19 
     | 
    
         
            -
                    assert_equal(a1.f,a2.f)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  should 'be the same using module method or object instantiation' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                    a1 = Statsample::Anova::OneWayWithVectors.new(@v1, @v2, @v3)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    a2 = Statsample::Anova.oneway_with_vectors(@v1, @v2, @v3)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    assert_equal(a1.f, a2.f)
         
     | 
| 
       20 
19 
     | 
    
         
             
                  end
         
     | 
| 
       21 
     | 
    
         
            -
                  should  
     | 
| 
       22 
     | 
    
         
            -
                    a1=Statsample::Anova::OneWayWithVectors.new(@v1 
     | 
| 
      
 20 
     | 
    
         
            +
                  should 'detect optional hash' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                    a1 = Statsample::Anova::OneWayWithVectors.new(@v1, @v2, @v3, name: 'aaa')
         
     | 
| 
       23 
22 
     | 
    
         
             
                    assert_equal('aaa', a1.name)
         
     | 
| 
       24 
23 
     | 
    
         
             
                  end
         
     | 
| 
       25 
     | 
    
         
            -
                  should  
     | 
| 
       26 
     | 
    
         
            -
                    a1=Statsample::Anova::OneWayWithVectors.new(@v1 
     | 
| 
       27 
     | 
    
         
            -
                    a2=Statsample::Anova::OneWayWithVectors.new(@v1,nil,nil 
     | 
| 
       28 
     | 
    
         
            -
                    assert_equal(a1.f,a2.f)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  should 'omit incorrect arguments' do
         
     | 
| 
      
 25 
     | 
    
         
            +
                    a1 = Statsample::Anova::OneWayWithVectors.new(@v1, @v2, @v3, name: 'aaa')
         
     | 
| 
      
 26 
     | 
    
         
            +
                    a2 = Statsample::Anova::OneWayWithVectors.new(@v1, nil, nil, @v2, @v3, name: 'aaa')
         
     | 
| 
      
 27 
     | 
    
         
            +
                    assert_equal(a1.f, a2.f)
         
     | 
| 
       29 
28 
     | 
    
         
             
                  end
         
     | 
| 
       30 
29 
     | 
    
         
             
                end
         
     | 
| 
       31 
30 
     | 
    
         
             
                setup do
         
     | 
| 
       32 
     | 
    
         
            -
                  @v1=[3,3,2,3,6].to_vector(:scale)
         
     | 
| 
       33 
     | 
    
         
            -
                  @v2=[7,6,5,6,7].to_vector(:scale)
         
     | 
| 
       34 
     | 
    
         
            -
                  @v3=[9,8,9,7,8].to_vector(:scale)
         
     | 
| 
       35 
     | 
    
         
            -
                  @name= 
     | 
| 
       36 
     | 
    
         
            -
                  @anova=Statsample::Anova::OneWayWithVectors.new(@v1 
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
                should  
     | 
| 
       39 
     | 
    
         
            -
                  c1=Statsample::Anova::Contrast.new(: 
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                  c2 
     | 
| 
       42 
     | 
    
         
            -
                  assert_equal(c1.t,c2.t)
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                 
     | 
| 
       45 
     | 
    
         
            -
                should "respond to #summary" do
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @v1 = [3, 3, 2, 3, 6].to_vector(:scale)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @v2 = [7, 6, 5, 6, 7].to_vector(:scale)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  @v3 = [9, 8, 9, 7, 8].to_vector(:scale)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @name = 'Anova testing'
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @anova = Statsample::Anova::OneWayWithVectors.new(@v1, @v2, @v3, name: @name)
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
                should 'store correctly contrasts' do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  c1 = Statsample::Anova::Contrast.new(vectors: [@v1, @v2, @v3], c: [1, -0.5, -0.5])
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  c2 = @anova.contrast(c: [1, -0.5, -0.5])
         
     | 
| 
      
 41 
     | 
    
         
            +
                  assert_equal(c1.t, c2.t)
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
                should 'respond to #summary' do
         
     | 
| 
       46 
44 
     | 
    
         
             
                  assert(@anova.respond_to? :summary)
         
     | 
| 
       47 
45 
     | 
    
         
             
                end
         
     | 
| 
       48 
     | 
    
         
            -
                should  
     | 
| 
      
 46 
     | 
    
         
            +
                should 'have correct name of analysis on #summary' do
         
     | 
| 
       49 
47 
     | 
    
         
             
                  assert_match(/#{@name}/, @anova.summary)
         
     | 
| 
       50 
48 
     | 
    
         
             
                end
         
     | 
| 
       51 
     | 
    
         
            -
                should  
     | 
| 
       52 
     | 
    
         
            -
                  assert_equal(@anova.levene.f, Statsample::Test.levene([@v1 
     | 
| 
      
 49 
     | 
    
         
            +
                should 'returns same levene values as direct Levene creation' do
         
     | 
| 
      
 50 
     | 
    
         
            +
                  assert_equal(@anova.levene.f, Statsample::Test.levene([@v1, @v2, @v3]).f)
         
     | 
| 
       53 
51 
     | 
    
         
             
                end
         
     | 
| 
       54 
     | 
    
         
            -
                should  
     | 
| 
       55 
     | 
    
         
            -
                  assert_in_delta(0.604 
     | 
| 
       56 
     | 
    
         
            -
                  assert_in_delta(0.562 
     | 
| 
      
 52 
     | 
    
         
            +
                should 'have correct value for levene' do
         
     | 
| 
      
 53 
     | 
    
         
            +
                  assert_in_delta(0.604, @anova.levene.f, 0.001)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  assert_in_delta(0.562, @anova.levene.probability, 0.001)
         
     | 
| 
       57 
55 
     | 
    
         
             
                end
         
     | 
| 
       58 
     | 
    
         
            -
                should  
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                should 'have correct value for sst' do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  assert_in_delta(72.933, @anova.sst, 0.001)
         
     | 
| 
       60 
58 
     | 
    
         
             
                end
         
     | 
| 
       61 
     | 
    
         
            -
                should  
     | 
| 
       62 
     | 
    
         
            -
                  assert_in_delta(14.8 
     | 
| 
      
 59 
     | 
    
         
            +
                should 'have correct value for sswg' do
         
     | 
| 
      
 60 
     | 
    
         
            +
                  assert_in_delta(14.8, @anova.sswg, 0.001)
         
     | 
| 
       63 
61 
     | 
    
         
             
                end
         
     | 
| 
       64 
     | 
    
         
            -
                should  
     | 
| 
       65 
     | 
    
         
            -
                  assert_in_delta(58.133 
     | 
| 
      
 62 
     | 
    
         
            +
                should 'have correct value for ssb' do
         
     | 
| 
      
 63 
     | 
    
         
            +
                  assert_in_delta(58.133, @anova.ssbg, 0.001)
         
     | 
| 
       66 
64 
     | 
    
         
             
                end
         
     | 
| 
       67 
     | 
    
         
            -
                should  
     | 
| 
       68 
     | 
    
         
            -
                  assert_in_delta(@anova.sst 
     | 
| 
      
 65 
     | 
    
         
            +
                should 'sst=sswg+ssbg' do
         
     | 
| 
      
 66 
     | 
    
         
            +
                  assert_in_delta(@anova.sst, @anova.sswg + @anova.ssbg, 0.00001)
         
     | 
| 
       69 
67 
     | 
    
         
             
                end
         
     | 
| 
       70 
     | 
    
         
            -
                should  
     | 
| 
       71 
     | 
    
         
            -
                  assert_equal(@v1.n 
     | 
| 
      
 68 
     | 
    
         
            +
                should 'df total equal to number of n-1' do
         
     | 
| 
      
 69 
     | 
    
         
            +
                  assert_equal(@v1.n + @v2.n + @v3.n - 1, @anova.df_total)
         
     | 
| 
       72 
70 
     | 
    
         
             
                end
         
     | 
| 
       73 
     | 
    
         
            -
                should  
     | 
| 
       74 
     | 
    
         
            -
                  assert_equal(@v1.n 
     | 
| 
      
 71 
     | 
    
         
            +
                should 'df wg equal to number of n-k' do
         
     | 
| 
      
 72 
     | 
    
         
            +
                  assert_equal(@v1.n + @v2.n + @v3.n - 3, @anova.df_wg)
         
     | 
| 
       75 
73 
     | 
    
         
             
                end
         
     | 
| 
       76 
     | 
    
         
            -
                should  
     | 
| 
       77 
     | 
    
         
            -
                  assert_equal(2 
     | 
| 
      
 74 
     | 
    
         
            +
                should 'df bg equal to number of k-1' do
         
     | 
| 
      
 75 
     | 
    
         
            +
                  assert_equal(2, @anova.df_bg)
         
     | 
| 
       78 
76 
     | 
    
         
             
                end
         
     | 
| 
       79 
     | 
    
         
            -
                should  
     | 
| 
       80 
     | 
    
         
            -
                  assert_in_delta((@anova.ssbg.quo(@anova.df_bg)).quo( 
     | 
| 
      
 77 
     | 
    
         
            +
                should 'f=(ssbg/df_bg)/(sswt/df_wt)' do
         
     | 
| 
      
 78 
     | 
    
         
            +
                  assert_in_delta((@anova.ssbg.quo(@anova.df_bg)).quo(@anova.sswg.quo(@anova.df_wg)), @anova.f, 0.001)
         
     | 
| 
       81 
79 
     | 
    
         
             
                end
         
     | 
| 
       82 
     | 
    
         
            -
                should  
     | 
| 
       83 
     | 
    
         
            -
                  assert(@anova.probability<0.01)
         
     | 
| 
      
 80 
     | 
    
         
            +
                should 'p be correct' do
         
     | 
| 
      
 81 
     | 
    
         
            +
                  assert(@anova.probability < 0.01)
         
     | 
| 
       84 
82 
     | 
    
         
             
                end
         
     | 
| 
       85 
     | 
    
         
            -
                should  
     | 
| 
       86 
     | 
    
         
            -
                  anova2=Statsample::Anova::OneWayWithVectors.new([@v1 
     | 
| 
       87 
     | 
    
         
            -
                  assert_in_delta(3.960, anova2.f,0.001)
         
     | 
| 
       88 
     | 
    
         
            -
                  assert_in_delta(0.016, anova2.probability,0.001)
         
     | 
| 
      
 83 
     | 
    
         
            +
                should 'be correct using different test values' do
         
     | 
| 
      
 84 
     | 
    
         
            +
                  anova2 = Statsample::Anova::OneWayWithVectors.new([@v1, @v1, @v1, @v1, @v2])
         
     | 
| 
      
 85 
     | 
    
         
            +
                  assert_in_delta(3.960, anova2.f, 0.001)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  assert_in_delta(0.016, anova2.probability, 0.001)
         
     | 
| 
       89 
87 
     | 
    
         
             
                end
         
     | 
| 
       90 
     | 
    
         
            -
                context  
     | 
| 
      
 88 
     | 
    
         
            +
                context 'with extra information on summary' do
         
     | 
| 
       91 
89 
     | 
    
         
             
                  setup do
         
     | 
| 
       92 
     | 
    
         
            -
                    @anova.summary_descriptives=true
         
     | 
| 
       93 
     | 
    
         
            -
                    @anova.summary_levene=true
         
     | 
| 
       94 
     | 
    
         
            -
                    @summary 
     | 
| 
      
 90 
     | 
    
         
            +
                    @anova.summary_descriptives = true
         
     | 
| 
      
 91 
     | 
    
         
            +
                    @anova.summary_levene = true
         
     | 
| 
      
 92 
     | 
    
         
            +
                    @summary = @anova.summary
         
     | 
| 
       95 
93 
     | 
    
         
             
                  end
         
     | 
| 
       96 
     | 
    
         
            -
                  should  
     | 
| 
      
 94 
     | 
    
         
            +
                  should 'have section with levene statistics' do
         
     | 
| 
       97 
95 
     | 
    
         
             
                    assert_match(/Levene/, @summary)
         
     | 
| 
       98 
96 
     | 
    
         
             
                  end
         
     | 
| 
       99 
     | 
    
         
            -
                  should  
     | 
| 
      
 97 
     | 
    
         
            +
                  should 'have section with descriptives' do
         
     | 
| 
       100 
98 
     | 
    
         
             
                    assert_match(/Min/, @summary)
         
     | 
| 
       101 
99 
     | 
    
         
             
                  end
         
     | 
| 
       102 
100 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
         
     | 
| 
       2 
     | 
    
         
            -
            class StatsampleAwesomePrintBug <  
     | 
| 
       3 
     | 
    
         
            -
              context( 
     | 
| 
      
 1 
     | 
    
         
            +
            require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))
         
     | 
| 
      
 2 
     | 
    
         
            +
            class StatsampleAwesomePrintBug < Minitest::Test
         
     | 
| 
      
 3 
     | 
    
         
            +
              context('Awesome Print integration') do
         
     | 
| 
       4 
4 
     | 
    
         
             
                setup do
         
     | 
| 
       5 
     | 
    
         
            -
                  require  
     | 
| 
      
 5 
     | 
    
         
            +
                  require 'awesome_print'
         
     | 
| 
       6 
6 
     | 
    
         
             
                end
         
     | 
| 
       7 
     | 
    
         
            -
                should  
     | 
| 
       8 
     | 
    
         
            -
                  a=[1,2,3].to_scale
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                  assert(a!=[1,2,3])
         
     | 
| 
       11 
     | 
    
         
            -
                  assert_nothing_raised do 
     | 
| 
      
 7 
     | 
    
         
            +
                should 'should be flawless' do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  a = [1, 2, 3].to_scale
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  assert(a != [1, 2, 3])
         
     | 
| 
      
 11 
     | 
    
         
            +
                  assert_nothing_raised do
         
     | 
| 
       12 
12 
     | 
    
         
             
                    ap a
         
     | 
| 
       13 
13 
     | 
    
         
             
                  end
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,25 +1,25 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
         
     | 
| 
      
 1 
     | 
    
         
            +
            require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            class StatsampleBartlettSphericityTestCase <  
     | 
| 
      
 3 
     | 
    
         
            +
            class StatsampleBartlettSphericityTestCase < Minitest::Test
         
     | 
| 
       4 
4 
     | 
    
         
             
              include Statsample::Test
         
     | 
| 
       5 
5 
     | 
    
         
             
              context Statsample::Test::BartlettSphericity do
         
     | 
| 
       6 
6 
     | 
    
         
             
                setup do
         
     | 
| 
       7 
     | 
    
         
            -
                  @v1=[1 , 
     | 
| 
       8 
     | 
    
         
            -
                  @v2=[5 , 
     | 
| 
       9 
     | 
    
         
            -
                  @v3=[10,3  
     | 
| 
      
 7 
     | 
    
         
            +
                  @v1 = [1, 2, 3, 4, 7, 8, 9, 10, 14, 15, 20, 50, 60, 70].to_scale
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @v2 = [5, 6, 11, 12, 13, 16, 17, 18, 19, 20, 30, 0, 0, 0].to_scale
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @v3 = [10, 3, 20, 30, 40, 50, 80, 10, 20, 30, 40, 2, 3, 4].to_scale
         
     | 
| 
       10 
10 
     | 
    
         
             
                  # KMO: 0.490
         
     | 
| 
       11 
     | 
    
         
            -
                  ds={'v1' 
     | 
| 
       12 
     | 
    
         
            -
                  cor=Statsample::Bivariate.correlation_matrix(ds)
         
     | 
| 
       13 
     | 
    
         
            -
                  @bs=Statsample::Test::BartlettSphericity.new(cor, 14)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  ds = { 'v1' => @v1, 'v2' => @v2, 'v3' => @v3 }.to_dataset
         
     | 
| 
      
 12 
     | 
    
         
            +
                  cor = Statsample::Bivariate.correlation_matrix(ds)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @bs = Statsample::Test::BartlettSphericity.new(cor, 14)
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
       15 
     | 
    
         
            -
                should  
     | 
| 
       16 
     | 
    
         
            -
                  assert_in_delta(9.477, @bs.value,0.001)
         
     | 
| 
      
 15 
     | 
    
         
            +
                should 'have correct value for chi' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  assert_in_delta(9.477, @bs.value, 0.001)
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
     | 
    
         
            -
                should  
     | 
| 
      
 18 
     | 
    
         
            +
                should 'have correct value for df' do
         
     | 
| 
       19 
19 
     | 
    
         
             
                  assert_equal(3, @bs.df)
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
     | 
    
         
            -
                should  
     | 
| 
       22 
     | 
    
         
            -
                  assert_in_delta(0.024 
     | 
| 
      
 21 
     | 
    
         
            +
                should 'have correct value for probability' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  assert_in_delta(0.024, @bs.probability, 0.001)
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         
             
            end
         
     |