Module: Distribution::Weibull::Ruby_
- Defined in:
- lib/distribution/weibull/ruby.rb
Class Method Summary collapse
-
.cdf(x, k, lam) ⇒ Object
Returns the integral of the Weibull distribution from [-Inf to x].
-
.p_value(y, k, lam) ⇒ Object
Returns the P-value of weibull.
- .pdf(x, k, lam) ⇒ Object
Class Method Details
.cdf(x, k, lam) ⇒ Object
Returns the integral of the Weibull distribution from [-Inf to x]
12 13 14 15 |
# File 'lib/distribution/weibull/ruby.rb', line 12 def cdf(x, k, lam) return 0.0 if x < 0.0 return 1.0-Math.exp(-(x.to_f/lam.to_f)**k) end |
.p_value(y, k, lam) ⇒ Object
Returns the P-value of weibull
19 20 21 22 23 |
# File 'lib/distribution/weibull/ruby.rb', line 19 def p_value(y, k, lam) return 1.0 if y > 1.0 return 0.0 if y < 0.0 return -lam*(Math.log(1.0-y))**(1.0/k) end |
.pdf(x, k, lam) ⇒ Object
5 6 7 8 |
# File 'lib/distribution/weibull/ruby.rb', line 5 def pdf(x, k, lam) return 0.0 if x < 0.0 return ((k.to_f/lam.to_f)*(x.to_f/lam.to_f)**(k-1.0))*Math.exp(-(x.to_f/lam.to_f)**k) end |