spec/lib/easystats_spec.rb in easystats-0.3.2 vs spec/lib/easystats_spec.rb in easystats-0.4.0.rc1

- old
+ new

@@ -10,83 +10,108 @@ :median => nil, :mode => nil, :range => nil, :standard_deviation => nil, :sum => nil, - :variance => nil + :variance => nil, + :probability_distribution => nil } + build_stats_spec [1,1,1,2,2], { + :probability_distribution => { + 1 => 0.6, + 2 => 0.4 + } + } + build_stats_spec [0], { :mean => 0, :median => 0, :mode => 0, :range => 0, :standard_deviation => 0, :sum => 0, - :variance => 0.0 + :variance => 0.0, + :probability_distribution => {0 => 1.0} } build_stats_spec [1], { :mean => 1, :median => 1, :mode => 1, :range => 0, :standard_deviation => 0, :sum => 1, - :variance => 0.0 + :variance => 0.0, + :probability_distribution => {1 => 1.0} } build_stats_spec [1,2], { :mean => 1.5, :median => 1.5, :mode => nil, :range => 1, :standard_deviation => 0.707106781186548, :sum => 3, - :variance => 0.25 + :variance => 0.25, + :probability_distribution => {1 => 0.5, 2 => 0.5} } build_stats_spec [1,2,3], { :mean => 2, :median => 2, :mode => nil, :range => 2, :standard_deviation => 1, :sum => 6, - :variance => 2.0 / 3.0 + :variance => 2.0 / 3.0, + :probability_distribution => {1 => 0.3333333333333333, 2 => 0.3333333333333333, 3 => 0.3333333333333333} } build_stats_spec [1,2,3,4], { :mean => 2.5, :median => 2.5, :mode => nil, :range => 3, :standard_deviation => 1.29099444873581, :sum => 10, - :variance => 1.25 + :variance => 1.25, + :probability_distribution => {1 => 0.25, 2=>0.25, 3=> 0.25, 4=>0.25} + } + build_stats_spec [1,1,2,2], { + :mean => 1.5, + :median => 1.5, + :mode => nil, + :range => 1, + :standard_deviation => 0.5773502691896257, + :sum => 6, + :variance => 0.25, + :probability_distribution => {1=>0.5, 2=>0.5} + } build_stats_spec [1,2,2,4], { :mean => 2.25, :median => 2, :mode => 2, :range => 3, :standard_deviation => 1.2583057392117916, :sum => 9, - :variance => 1.1875 + :variance => 1.1875, + :probability_distribution => { 1 => 0.25, 2 => 0.5, 4 => 0.25 } } - build_stats_spec [1,3,3,4], { :mean => 2.75, :median => 3, :mode => 3, :range => 3, :standard_deviation => 1.2583057392117916, :sum => 11, - :variance => 1.1875 + :variance => 1.1875, + :probability_distribution => { 1 => 0.25, 3 => 0.5, 4=>0.25 } } build_stats_spec (0..100).to_a, { :mean => 50, :median => 50, @@ -112,19 +137,21 @@ :median => 0, :mode => nil, :range => 2, :standard_deviation => 1, :sum => 0, - :variance => 0.6666666666666666 + :variance => 0.6666666666666666, + :probability_distribution => { -1 => 0.3333333333333333, 0 => 0.3333333333333333, 1 => 0.3333333333333333 } } build_stats_spec [1,2.5], { :mean => 1.75, :median => 1.75, :mode => nil, :range => 1.5, :standard_deviation => 1.0606601717798212, :sum => 3.5, - :variance =>0.5625 + :variance =>0.5625, + :probability_distribution => { 1 => 0.5, 2.5=>0.5 } } end