Method: Statistics::Distribution::ChiSquared#density_function
- Defined in:
- lib/statistics/distribution/chi_squared.rb
#density_function(value) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/statistics/distribution/chi_squared.rb', line 17 def density_function(value) return 0 if value < 0 common = degrees_of_freedom/2.0 left_down = (2 ** common) * Math.gamma(common) right = (value ** (common - 1)) * Math.exp(-(value/2.0)) (1.0/left_down) * right end |