distribution 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.gemtest +0 -0
- data/History.txt +13 -1
- data/Manifest.txt +18 -0
- data/README.txt +3 -1
- data/Rakefile +5 -0
- data/lib/distribution.rb +6 -3
- data/lib/distribution/beta.rb +34 -0
- data/lib/distribution/beta/gsl.rb +24 -0
- data/lib/distribution/beta/java.rb +9 -0
- data/lib/distribution/beta/ruby.rb +42 -0
- data/lib/distribution/binomial.rb +1 -1
- data/lib/distribution/binomial/ruby.rb +3 -1
- data/lib/distribution/f.rb +1 -1
- data/lib/distribution/gamma.rb +37 -0
- data/lib/distribution/gamma/gsl.rb +24 -0
- data/lib/distribution/gamma/java.rb +9 -0
- data/lib/distribution/gamma/ruby.rb +53 -0
- data/lib/distribution/math_extension.rb +59 -13
- data/lib/distribution/math_extension/chebyshev_series.rb +411 -0
- data/lib/distribution/math_extension/erfc.rb +79 -0
- data/lib/distribution/math_extension/exponential_integral.rb +63 -0
- data/lib/distribution/math_extension/gammastar.rb +64 -0
- data/lib/distribution/math_extension/gsl_utilities.rb +31 -0
- data/lib/distribution/math_extension/incomplete_beta.rb +213 -0
- data/lib/distribution/math_extension/incomplete_gamma.rb +424 -0
- data/lib/distribution/math_extension/log_utilities.rb +80 -0
- data/lib/distribution/t/ruby.rb +2 -1
- data/spec/beta_spec.rb +82 -0
- data/spec/binomial_spec.rb +1 -1
- data/spec/gamma_spec.rb +85 -0
- data/spec/logistic_spec.rb +3 -3
- data/spec/math_extension_spec.rb +188 -13
- data/spec/t_spec.rb +13 -18
- metadata +24 -5
- metadata.gz.sig +0 -0
data/spec/t_spec.rb
CHANGED
@@ -9,7 +9,16 @@ shared_examples_for "T engine(with rng)" do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
shared_examples_for "T engine(with
|
12
|
+
shared_examples_for "T engine(cdf with fractional df)" do
|
13
|
+
it "should return correct cdf with fractional df" do
|
14
|
+
@engine.cdf(1,2.5).should be_within(1e-6).of(0.7979695)
|
15
|
+
@engine.cdf(2,3.5).should be_within(1e-6).of(0.9369307)
|
16
|
+
@engine.cdf(3,4.5).should be_within(1e-6).of(0.9828096)
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
shared_examples_for "T engine" do
|
13
22
|
it_only_with_gsl "should return correct pdf" do
|
14
23
|
if @engine.respond_to? :pdf
|
15
24
|
[-2,0.1,0.5,1,2].each{|t|
|
@@ -23,10 +32,6 @@ shared_examples_for "T engine(with pdf)" do
|
|
23
32
|
pending("No #{@engine}.pdf")
|
24
33
|
end
|
25
34
|
end
|
26
|
-
end
|
27
|
-
|
28
|
-
shared_examples_for "T engine" do
|
29
|
-
|
30
35
|
it_only_with_gsl "should return correct cdf" do
|
31
36
|
if @engine.respond_to? :cdf
|
32
37
|
# Testing with R values
|
@@ -65,7 +70,6 @@ end
|
|
65
70
|
@engine=Distribution::T
|
66
71
|
end
|
67
72
|
it_should_behave_like "T engine"
|
68
|
-
it_should_behave_like "T engine(with pdf)"
|
69
73
|
end
|
70
74
|
|
71
75
|
describe Distribution::T::Ruby_ do
|
@@ -73,24 +77,16 @@ end
|
|
73
77
|
@engine=Distribution::T::Ruby_
|
74
78
|
end
|
75
79
|
it_should_behave_like "T engine"
|
76
|
-
it_should_behave_like "T engine(with
|
77
|
-
|
78
|
-
lambda {@engine.cdf(1,2.5)}.should raise_error
|
79
|
-
end
|
80
|
-
it "return correct values for cdf with fractional df" do
|
81
|
-
pending("we have to implement partial beta");
|
82
|
-
end
|
80
|
+
it_should_behave_like "T engine(cdf with fractional df)"
|
81
|
+
|
83
82
|
end
|
84
83
|
if Distribution.has_gsl?
|
85
84
|
describe Distribution::T::GSL_ do
|
86
85
|
before do
|
87
86
|
@engine=Distribution::T::GSL_
|
88
87
|
end
|
89
|
-
it "return correct values for cdf with fractional df" do
|
90
|
-
@engine.cdf(1,2.5).should be_within(1e-7).of(0.7979695)
|
91
|
-
end
|
92
88
|
it_should_behave_like "T engine"
|
93
|
-
it_should_behave_like "T engine(with
|
89
|
+
it_should_behave_like "T engine(cdf with fractional df)"
|
94
90
|
end
|
95
91
|
end
|
96
92
|
=begin
|
@@ -109,7 +105,6 @@ end
|
|
109
105
|
@engine=Distribution::T::Java_
|
110
106
|
end
|
111
107
|
it_should_behave_like "T engine"
|
112
|
-
it_should_behave_like "T engine(with pdf)"
|
113
108
|
end
|
114
109
|
end
|
115
110
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: distribution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.6.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Claudio Bustos
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
rpP0jjs0
|
32
32
|
-----END CERTIFICATE-----
|
33
33
|
|
34
|
-
date: 2011-
|
34
|
+
date: 2011-08-23 00:00:00 -03:00
|
35
35
|
default_executable:
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -73,13 +73,13 @@ dependencies:
|
|
73
73
|
requirement: &id004 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 2.
|
78
|
+
version: "2.12"
|
79
79
|
type: :development
|
80
80
|
version_requirements: *id004
|
81
81
|
description: |-
|
82
|
-
Statistical Distributions library. Includes Normal univariate and bivariate, T, F, Chi Square, Binomial, Hypergeometric, Exponential and
|
82
|
+
Statistical Distributions library. Includes Normal univariate and bivariate, T, F, Chi Square, Binomial, Hypergeometric, Exponential, Poisson, Beta and Gamma.
|
83
83
|
|
84
84
|
Uses Ruby by default and C (statistics2/GSL) or Java extensions where available.
|
85
85
|
|
@@ -114,6 +114,10 @@ files:
|
|
114
114
|
- data/template/distribution/ruby.erb
|
115
115
|
- data/template/spec.erb
|
116
116
|
- lib/distribution.rb
|
117
|
+
- lib/distribution/beta.rb
|
118
|
+
- lib/distribution/beta/gsl.rb
|
119
|
+
- lib/distribution/beta/java.rb
|
120
|
+
- lib/distribution/beta/ruby.rb
|
117
121
|
- lib/distribution/binomial.rb
|
118
122
|
- lib/distribution/binomial/gsl.rb
|
119
123
|
- lib/distribution/binomial/java.rb
|
@@ -136,6 +140,10 @@ files:
|
|
136
140
|
- lib/distribution/f/java.rb
|
137
141
|
- lib/distribution/f/ruby.rb
|
138
142
|
- lib/distribution/f/statistics2.rb
|
143
|
+
- lib/distribution/gamma.rb
|
144
|
+
- lib/distribution/gamma/gsl.rb
|
145
|
+
- lib/distribution/gamma/java.rb
|
146
|
+
- lib/distribution/gamma/ruby.rb
|
139
147
|
- lib/distribution/hypergeometric.rb
|
140
148
|
- lib/distribution/hypergeometric/gsl.rb
|
141
149
|
- lib/distribution/hypergeometric/java.rb
|
@@ -143,6 +151,14 @@ files:
|
|
143
151
|
- lib/distribution/logistic.rb
|
144
152
|
- lib/distribution/logistic/ruby.rb
|
145
153
|
- lib/distribution/math_extension.rb
|
154
|
+
- lib/distribution/math_extension/chebyshev_series.rb
|
155
|
+
- lib/distribution/math_extension/erfc.rb
|
156
|
+
- lib/distribution/math_extension/exponential_integral.rb
|
157
|
+
- lib/distribution/math_extension/gammastar.rb
|
158
|
+
- lib/distribution/math_extension/gsl_utilities.rb
|
159
|
+
- lib/distribution/math_extension/incomplete_beta.rb
|
160
|
+
- lib/distribution/math_extension/incomplete_gamma.rb
|
161
|
+
- lib/distribution/math_extension/log_utilities.rb
|
146
162
|
- lib/distribution/normal.rb
|
147
163
|
- lib/distribution/normal/gsl.rb
|
148
164
|
- lib/distribution/normal/java.rb
|
@@ -157,12 +173,14 @@ files:
|
|
157
173
|
- lib/distribution/t/java.rb
|
158
174
|
- lib/distribution/t/ruby.rb
|
159
175
|
- lib/distribution/t/statistics2.rb
|
176
|
+
- spec/beta_spec.rb
|
160
177
|
- spec/binomial_spec.rb
|
161
178
|
- spec/bivariatenormal_spec.rb
|
162
179
|
- spec/chisquare_spec.rb
|
163
180
|
- spec/distribution_spec.rb
|
164
181
|
- spec/exponential_spec.rb
|
165
182
|
- spec/f_spec.rb
|
183
|
+
- spec/gamma_spec.rb
|
166
184
|
- spec/hypergeometric_spec.rb
|
167
185
|
- spec/logistic_spec.rb
|
168
186
|
- spec/math_extension_spec.rb
|
@@ -172,6 +190,7 @@ files:
|
|
172
190
|
- spec/spec.opts
|
173
191
|
- spec/spec_helper.rb
|
174
192
|
- spec/t_spec.rb
|
193
|
+
- .gemtest
|
175
194
|
has_rdoc: true
|
176
195
|
homepage: https://github.com/clbustos/distribution
|
177
196
|
licenses: []
|
metadata.gz.sig
CHANGED
Binary file
|