distribution 0.7.3 → 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.
Files changed (100) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +4 -6
  3. data/.yardopts +5 -0
  4. data/History.txt +3 -0
  5. data/README.md +87 -44
  6. data/benchmark/binomial_coefficient.rb +19 -23
  7. data/benchmark/binomial_coefficient/experiment.rb +33 -36
  8. data/benchmark/factorial_hash.rb +7 -8
  9. data/benchmark/factorial_method.rb +4 -6
  10. data/benchmark/odd.rb +6 -7
  11. data/benchmark/power.rb +11 -11
  12. data/bin/distribution +26 -26
  13. data/distribution.gemspec +3 -4
  14. data/lib/distribution.rb +55 -96
  15. data/lib/distribution/beta/gsl.rb +10 -5
  16. data/lib/distribution/beta/ruby.rb +3 -1
  17. data/lib/distribution/binomial/ruby.rb +5 -2
  18. data/lib/distribution/bivariatenormal.rb +4 -5
  19. data/lib/distribution/bivariatenormal/gsl.rb +2 -2
  20. data/lib/distribution/bivariatenormal/java.rb +1 -1
  21. data/lib/distribution/bivariatenormal/ruby.rb +245 -254
  22. data/lib/distribution/chisquare.rb +8 -10
  23. data/lib/distribution/chisquare/gsl.rb +24 -19
  24. data/lib/distribution/chisquare/java.rb +1 -1
  25. data/lib/distribution/chisquare/ruby.rb +25 -25
  26. data/lib/distribution/chisquare/statistics2.rb +16 -13
  27. data/lib/distribution/distributable.rb +40 -0
  28. data/lib/distribution/exponential.rb +4 -5
  29. data/lib/distribution/exponential/gsl.rb +13 -9
  30. data/lib/distribution/exponential/ruby.rb +14 -9
  31. data/lib/distribution/f.rb +1 -1
  32. data/lib/distribution/f/gsl.rb +26 -22
  33. data/lib/distribution/f/java.rb +1 -1
  34. data/lib/distribution/f/ruby.rb +16 -19
  35. data/lib/distribution/f/statistics2.rb +22 -19
  36. data/lib/distribution/gamma.rb +5 -7
  37. data/lib/distribution/gamma/gsl.rb +13 -9
  38. data/lib/distribution/gamma/java.rb +1 -1
  39. data/lib/distribution/gamma/ruby.rb +5 -11
  40. data/lib/distribution/hypergeometric.rb +5 -8
  41. data/lib/distribution/hypergeometric/gsl.rb +4 -5
  42. data/lib/distribution/hypergeometric/java.rb +1 -1
  43. data/lib/distribution/hypergeometric/ruby.rb +34 -35
  44. data/lib/distribution/logistic.rb +5 -8
  45. data/lib/distribution/logistic/ruby.rb +13 -8
  46. data/lib/distribution/lognormal.rb +5 -7
  47. data/lib/distribution/lognormal/gsl.rb +8 -6
  48. data/lib/distribution/lognormal/ruby.rb +5 -9
  49. data/lib/distribution/math_extension.rb +6 -15
  50. data/lib/distribution/math_extension/chebyshev_series.rb +281 -272
  51. data/lib/distribution/math_extension/erfc.rb +26 -29
  52. data/lib/distribution/math_extension/exponential_integral.rb +17 -17
  53. data/lib/distribution/math_extension/gammastar.rb +19 -20
  54. data/lib/distribution/math_extension/gsl_utilities.rb +12 -12
  55. data/lib/distribution/math_extension/incomplete_beta.rb +52 -61
  56. data/lib/distribution/math_extension/incomplete_gamma.rb +166 -168
  57. data/lib/distribution/math_extension/log_utilities.rb +20 -22
  58. data/lib/distribution/normal.rb +11 -13
  59. data/lib/distribution/normal/gsl.rb +13 -10
  60. data/lib/distribution/normal/java.rb +14 -13
  61. data/lib/distribution/normal/ruby.rb +68 -58
  62. data/lib/distribution/normal/statistics2.rb +5 -2
  63. data/lib/distribution/normalmultivariate.rb +64 -64
  64. data/lib/distribution/poisson.rb +11 -13
  65. data/lib/distribution/poisson/gsl.rb +7 -7
  66. data/lib/distribution/poisson/java.rb +19 -24
  67. data/lib/distribution/poisson/ruby.rb +38 -9
  68. data/lib/distribution/shorthand.rb +17 -0
  69. data/lib/distribution/t.rb +13 -15
  70. data/lib/distribution/t/gsl.rb +27 -24
  71. data/lib/distribution/t/java.rb +1 -1
  72. data/lib/distribution/t/ruby.rb +99 -100
  73. data/lib/distribution/t/statistics2.rb +19 -19
  74. data/lib/distribution/uniform.rb +26 -0
  75. data/lib/distribution/uniform/gsl.rb +36 -0
  76. data/lib/distribution/uniform/ruby.rb +91 -0
  77. data/lib/distribution/version.rb +1 -1
  78. data/lib/distribution/weibull.rb +6 -7
  79. data/lib/distribution/weibull/gsl.rb +16 -16
  80. data/lib/distribution/weibull/ruby.rb +30 -23
  81. data/spec/beta_spec.rb +45 -47
  82. data/spec/binomial_spec.rb +77 -85
  83. data/spec/bivariatenormal_spec.rb +28 -35
  84. data/spec/chisquare_spec.rb +48 -52
  85. data/spec/distribution_spec.rb +10 -10
  86. data/spec/exponential_spec.rb +44 -49
  87. data/spec/f_spec.rb +4 -4
  88. data/spec/gamma_spec.rb +50 -53
  89. data/spec/hypergeometric_spec.rb +63 -69
  90. data/spec/logistic_spec.rb +32 -37
  91. data/spec/lognormal_spec.rb +25 -31
  92. data/spec/math_extension_spec.rb +192 -210
  93. data/spec/normal_spec.rb +80 -73
  94. data/spec/poisson_spec.rb +63 -41
  95. data/spec/shorthand_spec.rb +19 -22
  96. data/spec/spec_helper.rb +8 -9
  97. data/spec/t_spec.rb +63 -77
  98. data/spec/uniform_spec.rb +154 -0
  99. data/spec/weibull_spec.rb +13 -14
  100. metadata +17 -8
@@ -1,130 +1,122 @@
1
- require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb')
2
2
  include ExampleWithGSL
3
3
  describe Distribution::Binomial do
4
-
5
- shared_examples_for "binomial engine" do
6
- it "should return correct pdf" do
7
- if @engine.respond_to? :pdf
8
- [10,100,1000].each do |n|
9
- [1.quo(4),1.quo(2),3.quo(4)].each do |pr|
10
- [0, 1,n/2,n-1].each do |x|
11
- exp=Math.binomial_coefficient(n,x)*pr**x*(1-pr)**(n-x)
12
- obs=@engine.pdf(x,n,pr)
13
- obs.should be_within(1e-5).of(exp), "For pdf(#{x},#{n},#{pr}) expected #{exp}, obtained #{obs}"
14
-
4
+ shared_examples_for 'binomial engine' do
5
+ it 'should return correct pdf' do
6
+ if @engine.respond_to? :pdf
7
+ [10, 100, 1000].each do |n|
8
+ [1.quo(4), 1.quo(2), 3.quo(4)].each do |pr|
9
+ [0, 1, n / 2, n - 1].each do |x|
10
+ exp = Math.binomial_coefficient(n, x) * pr**x * (1 - pr)**(n - x)
11
+ obs = @engine.pdf(x, n, pr)
12
+ expect(obs).to be_within(1e-5).of(exp), "For pdf(#{x},#{n},#{pr}) expected #{exp}, obtained #{obs}"
13
+ end
15
14
  end
16
15
  end
16
+ else
17
+ skip("No #{@engine}.pdf")
17
18
  end
18
- else
19
- skip("No #{@engine}.pdf")
20
19
  end
21
- end
22
- it_only_with_gsl "should return correct cdf for n<=100" do
23
- if @engine.respond_to? :pdf
24
- [10,100].each do |n|
25
- [0.25,0.5,0.75].each do |pr|
26
- [1,n/2,n-1].each do |x|
27
- exp=GSL::Cdf.binomial_P(x,pr,n)
28
- obs=@engine.cdf(x,n,pr)
29
- exp.should be_within(1e-5).of(obs), "For cdf(#{x},#{n},#{pr}) expected #{exp}, obtained #{obs}"
20
+
21
+ it_only_with_gsl 'should return correct cdf for n<=100' do
22
+ if @engine.respond_to? :pdf
23
+ [10, 100].each do |n|
24
+ [0.25, 0.5, 0.75].each do |pr|
25
+ [1, n / 2, n - 1].each do |x|
26
+ exp = GSL::Cdf.binomial_P(x, pr, n)
27
+ obs = @engine.cdf(x, n, pr)
28
+ expect(exp).to be_within(1e-5).of(obs), "For cdf(#{x},#{n},#{pr}) expected #{exp}, obtained #{obs}"
30
29
  end
31
30
  end
32
31
  end
33
32
  else
34
33
  skip("No #{@engine}.cdf")
35
34
  end
35
+ end
36
36
  end
37
37
 
38
-
39
-
40
- end
41
-
42
- describe "singleton" do
38
+ describe 'singleton' do
43
39
  before do
44
- @engine=Distribution::Binomial
40
+ @engine = Distribution::Binomial
45
41
  end
46
- it_should_behave_like "binomial engine"
47
- it {@engine.should respond_to(:exact_pdf) }
42
+
43
+ it_should_behave_like 'binomial engine'
44
+
45
+ it { expect(@engine).to respond_to(:exact_pdf) }
46
+
48
47
  it {
49
- pending("No exact_p_value")
50
- @engine.should respond_to(:exact_p_value)
48
+ pending('No exact_p_value')
49
+ expect(@engine).to respond_to(:exact_p_value)
51
50
  }
52
- it "exact_cdf should return same values as cdf for n=50" do
53
- pr=rand()*0.8+0.1
54
- n=rand(10)+10
55
- [1,(n/2).to_i,n-1].each do |k|
56
-
57
- @engine.exact_cdf(k,n,pr).should be_within(1e-10).of(@engine.cdf(k,n,pr))
51
+
52
+ it 'exact_cdf should return same values as cdf for n=50' do
53
+ pr = rand * 0.8 + 0.1
54
+ n = rand(10) + 10
55
+ [1, (n / 2).to_i, n - 1].each do |k|
56
+ expect(@engine.exact_cdf(k, n, pr)).to be_within(1e-10).of(@engine.cdf(k, n, pr))
58
57
  end
59
58
  end
60
-
61
- it "exact_pdf should not return a Float if not float is used as parameter" do
62
- @engine.exact_pdf(1,1,1).should_not be_a(Float)
63
- @engine.exact_pdf(16, 80, 1.quo(2)).should_not be_a(Float)
59
+
60
+ it 'exact_pdf should not return a Float if not float is used as parameter' do
61
+ expect(@engine.exact_pdf(1, 1, 1)).to_not be_a(Float)
62
+ expect(@engine.exact_pdf(16, 80, 1.quo(2))).to_not be_a(Float)
64
63
  end
65
-
66
64
  end
67
-
65
+
68
66
  describe Distribution::Binomial::Ruby_ do
69
67
  before do
70
- @engine=Distribution::Binomial::Ruby_
68
+ @engine = Distribution::Binomial::Ruby_
71
69
  end
72
- it_should_behave_like "binomial engine"
73
-
74
- it "should return correct cdf for n>100" do
75
- [500,1000].each do |n|
76
- [0.5,0.6].each do |pr|
77
- [n/2].each do |x|
78
- cdf=@engine.exact_cdf(x,n,pr)
79
- p_value=@engine.p_value(cdf,n,pr)
80
- p_value.should eq(x), "For p_value(#{cdf},#{n},#{pr}) expected #{x}, obtained #{p_value}"
70
+ it_should_behave_like 'binomial engine'
71
+
72
+ it 'should return correct cdf for n>100' do
73
+ [500, 1000].each do |n|
74
+ [0.5, 0.6].each do |pr|
75
+ [n / 2].each do |x|
76
+ cdf = @engine.exact_cdf(x, n, pr)
77
+ p_value = @engine.p_value(cdf, n, pr)
78
+ msg = "For p_value(#{cdf},#{n},#{pr}) expected #{x}, obtained #{p_value}"
79
+
80
+ expect(p_value).to eq(x), msg
81
+ end
81
82
  end
82
83
  end
83
84
  end
84
-
85
- end
86
-
87
- it "should return correct p_value for n<=100" do
85
+
86
+ it 'should return correct p_value for n<=100' do
88
87
  pending("Can't calculate with precision x using p")
89
- [10,100].each do |n|
90
- [0.25,0.5,0.75].each do |pr|
91
- [n/2].each do |x|
92
- cdf=@engine.cdf(x,n,pr)
93
- p_value=@engine.p_value(cdf,n,pr)
94
-
95
- p_value.should eq(x), "For p_value(#{cdf},#{n},#{pr}) expected #{x}, obtained #{p_value}"
88
+
89
+ [10, 100].each do |n|
90
+ [0.25, 0.5, 0.75].each do |pr|
91
+ [n / 2].each do |x|
92
+ cdf = @engine.cdf(x, n, pr)
93
+ p_value = @engine.p_value(cdf, n, pr)
94
+
95
+ msg = "For p_value(#{cdf},#{n},#{pr}) expected #{x}, obtained #{p_value}"
96
+ expect(p_value).to eq(x), msg
97
+ end
96
98
  end
97
99
  end
98
100
  end
99
- end
100
-
101
101
  end
102
+
102
103
  if Distribution.has_gsl?
103
104
  describe Distribution::Binomial::GSL_ do
104
105
  before do
105
- @engine=Distribution::Binomial::GSL_
106
+ @engine = Distribution::Binomial::GSL_
106
107
  end
107
- it_should_behave_like "binomial engine"
108
+
109
+ it_should_behave_like 'binomial engine'
108
110
  end
109
111
  end
110
- #if Distribution.has_statistics2?
111
- # describe Distribution::Binomial::Statistics2_ do
112
- #
113
- # before do
114
- # @engine=Distribution::Binomial::Statistics2_
115
- # end
116
- #it_should_behave_like "binomial engine"
117
- # end
118
- #end
119
-
112
+
120
113
  if Distribution.has_java?
121
114
  describe Distribution::Binomial::Java_ do
122
115
  before do
123
- @engine=Distribution::Binomial::Java_
116
+ @engine = Distribution::Binomial::Java_
124
117
  end
125
- it_should_behave_like "binomial engine"
126
-
127
- end
118
+
119
+ it_should_behave_like 'binomial engine'
120
+ end
128
121
  end
129
-
130
122
  end
@@ -1,63 +1,56 @@
1
- require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb')
2
2
  include ExampleWithGSL
3
3
  describe Distribution::BivariateNormal do
4
- shared_examples_for "all pdf normal capables engines" do
5
- it_only_with_gsl "should return correct pdf" do
4
+ shared_examples_for 'all pdf normal capables engines' do
5
+ it_only_with_gsl 'should return correct pdf' do
6
6
  if @engine.respond_to? :pdf
7
- [0.2,0.4,0.6,0.8,0.9, 0.99,0.999,0.999999].each {|rho|
8
- @engine.pdf(0,0, rho , 1,1).should be_within(1e-8).of(GSL::Ran::bivariate_gaussian_pdf(0, 0, 1,1,rho))
7
+ [0.2, 0.4, 0.6, 0.8, 0.9, 0.99, 0.999, 0.999999].each {|rho|
8
+ expect(@engine.pdf(0, 0, rho, 1, 1)).to be_within(1e-8).of(GSL::Ran.bivariate_gaussian_pdf(0, 0, 1, 1, rho))
9
9
  }
10
10
  else
11
11
  pending("No #{@engine}.pdf")
12
12
  end
13
13
  end
14
14
  end
15
-
16
- shared_examples_for "all cdf normal capables engines" do
17
- it "should return correct cdf" do
15
+
16
+ shared_examples_for 'all cdf normal capables engines' do
17
+ it 'should return correct cdf' do
18
18
  if @engine.respond_to? :cdf
19
- @engine.cdf(2,0.5,0.5).should be_within(1e-3).of(0.686)
20
- @engine.cdf(2,0.0,0.5).should be_within(1e-3).of(0.498)
21
- @engine.cdf(1.5,0.5,0.5).should be_within(1e-3).of(0.671)
22
- v=rand
23
- @engine.cdf(10,0,v).should be_within(1e-3).of(Distribution::Normal.cdf(0))
19
+ expect(@engine.cdf(2, 0.5, 0.5)).to be_within(1e-3).of(0.686)
20
+ expect(@engine.cdf(2, 0.0, 0.5)).to be_within(1e-3).of(0.498)
21
+ expect(@engine.cdf(1.5, 0.5, 0.5)).to be_within(1e-3).of(0.671)
22
+ v = rand
23
+ expect(@engine.cdf(10, 0, v)).to be_within(1e-3).of(Distribution::Normal.cdf(0))
24
24
  else
25
- pending("No #{@engine}.cdf")
26
-
25
+ pending("No #{@engine}.cdf")
26
+
27
27
  end
28
28
  end
29
-
30
29
  end
31
- describe "singleton" do
30
+ describe 'singleton' do
32
31
  before do
33
- @engine=Distribution::BivariateNormal
32
+ @engine = Distribution::BivariateNormal
34
33
  end
35
- it_should_behave_like "all pdf normal capables engines"
36
- it_should_behave_like "all cdf normal capables engines"
37
-
34
+ it_should_behave_like 'all pdf normal capables engines'
35
+ it_should_behave_like 'all cdf normal capables engines'
38
36
  end
39
-
37
+
40
38
  describe Distribution::Normal::Ruby_ do
41
39
  before do
42
- @engine=Distribution::BivariateNormal::Ruby_
40
+ @engine = Distribution::BivariateNormal::Ruby_
43
41
  end
44
- it_should_behave_like "all pdf normal capables engines"
45
- it_should_behave_like "all cdf normal capables engines"
46
- it "Ganz method should return similar method to Hull one" do
47
- [-3,-2,-1,0,1,1.5].each {|x|
48
- @engine.cdf_hull(x,x,0.5).should be_within(0.001).of(@engine.cdf_genz(x,x,0.5))
49
-
42
+ it_should_behave_like 'all pdf normal capables engines'
43
+ it_should_behave_like 'all cdf normal capables engines'
44
+ it 'Ganz method should return similar method to Hull one' do
45
+ [-3, -2, -1, 0, 1, 1.5].each {|x|
46
+ expect(@engine.cdf_hull(x, x, 0.5)).to be_within(0.001).of(@engine.cdf_genz(x, x, 0.5))
50
47
  }
51
48
  end
52
-
53
49
  end
54
50
  describe Distribution::Normal::GSL_ do
55
51
  before do
56
- @engine=Distribution::BivariateNormal::GSL_
52
+ @engine = Distribution::BivariateNormal::GSL_
57
53
  end
58
- it_should_behave_like "all pdf normal capables engines"
59
-
54
+ it_should_behave_like 'all pdf normal capables engines'
60
55
  end
61
-
62
-
63
56
  end
@@ -1,90 +1,86 @@
1
- require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb')
2
2
  include ExampleWithGSL
3
3
  describe Distribution::ChiSquare do
4
-
5
- shared_examples_for "Chi-square engine(with pdf)" do
6
- it_only_with_gsl "should return correct pdf" do
4
+ shared_examples_for 'Chi-square engine(with pdf)' do
5
+ it_only_with_gsl 'should return correct pdf' do
7
6
  if @engine.respond_to? :pdf
8
7
  1.upto(10) do |k|
9
- v=1+rand(5)
10
- chi=GSL::Ran.chisq_pdf(v,k)
11
- @engine.pdf(v,k).should be_within(10e-10).of(chi)
8
+ v = 1 + rand(5)
9
+ chi = GSL::Ran.chisq_pdf(v, k)
10
+ expect(@engine.pdf(v, k)).to be_within(10e-10).of(chi)
12
11
  end
13
12
  else
14
13
  skip("No #{@engine}.pdf")
15
14
  end
16
15
  end
16
+ end
17
17
 
18
- end
19
-
20
- shared_examples_for "Chi-square engine" do
21
-
22
- it_only_with_gsl "should return correct cdf" do
23
- if @engine.respond_to? :cdf
24
- 1.upto(10) do |k|
25
- v=1+rand(5)
26
- chi=GSL::Cdf::chisq_P(v,k)
27
- @engine.cdf(v,k).should be_within(10e-10).of(chi)
18
+ shared_examples_for 'Chi-square engine' do
19
+ it_only_with_gsl 'should return correct cdf' do
20
+ if @engine.respond_to? :cdf
21
+ 1.upto(10) do |k|
22
+ v = 1 + rand(5)
23
+ chi = GSL::Cdf.chisq_P(v, k)
24
+ expect(@engine.cdf(v, k)).to be_within(10e-10).of(chi)
25
+ end
26
+ else
27
+ skip("No #{@engine}.cdf")
28
28
  end
29
- else
30
- skip("No #{@engine}.cdf")
31
- end
32
- end
29
+ end
33
30
 
34
- it "should return correct p_value" do
35
- if @engine.respond_to? :p_value
36
- 1.upto(10) do |k|
37
- v=1+rand(5)
38
- pr=@engine.cdf(v,k)
39
- @engine.p_value(pr,k).should be_within(10e-4).of(v)
40
- end
41
- else
42
- skip("No #{@engine}.p_value")
31
+ it 'should return correct p_value' do
32
+ if @engine.respond_to? :p_value
33
+ 1.upto(10) do |k|
34
+ v = 1 + rand(5)
35
+ pr = @engine.cdf(v, k)
36
+ expect(@engine.p_value(pr, k)).to be_within(10e-4).of(v)
37
+ end
38
+ else
39
+ skip("No #{@engine}.p_value")
40
+ end
43
41
  end
44
42
  end
45
- end
46
43
 
47
- describe "singleton" do
44
+ describe 'singleton' do
48
45
  before do
49
- @engine=Distribution::ChiSquare
46
+ @engine = Distribution::ChiSquare
50
47
  end
51
- it_should_behave_like "Chi-square engine"
52
- it_should_behave_like "Chi-square engine(with pdf)"
48
+ it_should_behave_like 'Chi-square engine'
49
+ it_should_behave_like 'Chi-square engine(with pdf)'
53
50
  end
54
-
51
+
55
52
  describe Distribution::ChiSquare::Ruby_ do
56
53
  before do
57
- @engine=Distribution::ChiSquare::Ruby_
54
+ @engine = Distribution::ChiSquare::Ruby_
58
55
  end
59
- it_should_behave_like "Chi-square engine"
60
- it_should_behave_like "Chi-square engine(with pdf)"
56
+ it_should_behave_like 'Chi-square engine'
57
+ it_should_behave_like 'Chi-square engine(with pdf)'
61
58
  end
62
59
  if Distribution.has_gsl?
63
60
  describe Distribution::ChiSquare::GSL_ do
64
61
  before do
65
- @engine=Distribution::ChiSquare::GSL_
62
+ @engine = Distribution::ChiSquare::GSL_
66
63
  end
67
- it_should_behave_like "Chi-square engine"
68
- it_should_behave_like "Chi-square engine(with pdf)"
64
+ it_should_behave_like 'Chi-square engine'
65
+ it_should_behave_like 'Chi-square engine(with pdf)'
69
66
  end
70
- end
67
+ end
71
68
  if Distribution.has_statistics2?
72
69
  describe Distribution::ChiSquare::Statistics2_ do
73
70
  before do
74
- @engine=Distribution::ChiSquare::Statistics2_
71
+ @engine = Distribution::ChiSquare::Statistics2_
75
72
  end
76
- it_should_behave_like "Chi-square engine"
77
- end
73
+ it_should_behave_like 'Chi-square engine'
74
+ end
78
75
  end
79
-
76
+
80
77
  if Distribution.has_java?
81
78
  describe Distribution::ChiSquare::Java_ do
82
79
  before do
83
- @engine=Distribution::ChiSquare::Java_
80
+ @engine = Distribution::ChiSquare::Java_
84
81
  end
85
- it_should_behave_like "Chi-square engine"
86
- it_should_behave_like "Chi-square engine(with pdf)"
87
- end
82
+ it_should_behave_like 'Chi-square engine'
83
+ it_should_behave_like 'Chi-square engine(with pdf)'
84
+ end
88
85
  end
89
-
90
86
  end
@@ -1,19 +1,19 @@
1
- require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb')
2
2
  describe Distribution do
3
- it "should respond to has_gsl?" do
4
- lambda {Distribution.has_gsl?}.should_not raise_exception
3
+ it 'should respond to has_gsl?' do
4
+ lambda { Distribution.has_gsl? }.should_not raise_exception
5
5
  if Distribution.has_gsl?
6
6
  expect(defined?(GSL)).to be
7
7
  else
8
- defined?(GSL).should be_nil
9
- end
8
+ expect(defined?(GSL)).to be_nil
9
+ end
10
10
  end
11
- it "should respond to has_statistics2?" do
12
- lambda {Distribution.has_statistics2?}.should_not raise_exception
11
+ it 'should respond to has_statistics2?' do
12
+ lambda { Distribution.has_statistics2? }.should_not raise_exception
13
13
  if Distribution.has_statistics2?
14
- defined?(Statistics2).should be
14
+ expect(defined?(Statistics2)).to be
15
15
  else
16
- defined?(Statistics2).should be_nil
17
- end
16
+ expect(defined?(Statistics2)).to be_nil
17
+ end
18
18
  end
19
19
  end