Class: Rubystats::WeibullDistribution

Inherits:
ProbabilityDistribution show all
Includes:
NumericalConstants
Defined in:
lib/rubystats/weibull_distribution.rb

Constant Summary

Constants included from NumericalConstants

NumericalConstants::EPS, NumericalConstants::GAMMA, NumericalConstants::GAMMA_X_MAX_VALUE, NumericalConstants::GOLDEN_RATIO, NumericalConstants::LOG_GAMMA_X_MAX_VALUE, NumericalConstants::MAX_FLOAT, NumericalConstants::MAX_ITERATIONS, NumericalConstants::MAX_VALUE, NumericalConstants::PRECISION, NumericalConstants::SQRT2, NumericalConstants::SQRT2PI, NumericalConstants::TWO_PI, NumericalConstants::XMININ

Instance Attribute Summary

Attributes included from SpecialMath

#log_beta_cache_p, #log_beta_cache_q, #log_beta_cache_res, #log_gamma_cache_res, #log_gamma_cache_x

Instance Method Summary collapse

Methods inherited from ProbabilityDistribution

#cdf, #check_range, #find_root, #get_factorial, #icdf, #mean, #pdf, #rng, #variance

Methods included from ExtraMath

#binomial

Methods included from SpecialMath

#beta, #beta_fraction, #complementary_error, #error, #gamma, #gamma_fraction, #gamma_series_expansion, #incomplete_beta, #incomplete_gamma, #log_beta, #log_gamma, #orig_gamma

Constructor Details

#initialize(scale = 1.0, shape = 1.0) ⇒ WeibullDistribution

Returns a new instance of WeibullDistribution.



6
7
8
9
10
11
12
13
14
15
# File 'lib/rubystats/weibull_distribution.rb', line 6

def initialize(scale=1.0, shape=1.0) 
  if scale <= 0.0
    raise ArgumentError.new("Scale parameter should be greater than zero.")
  end
  if shape <= 0.0
    raise ArgumentError.new("Shape parameter should be greater than zero.")
  end
  @scale = scale.to_f 
  @shape = shape.to_f 
end