Module: Statsample::Util
- Defined in:
- lib/statsample.rb
Class Method Summary collapse
-
.nice(s, e) ⇒ Object
:nodoc:.
Instance Method Summary collapse
Class Method Details
.nice(s, e) ⇒ Object
:nodoc:
271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/statsample.rb', line 271 def self.nice(s, e) # :nodoc: reverse = e < s min = reverse ? e : s max = reverse ? s : e span = max - min return [s, e] if span == 0 || (span.respond_to?(:infinite?) && span.infinite?) step = 10**((Math.log(span).quo(Math.log(10))).round - 1).to_f out = [(min.quo(step)).floor * step, (max.quo(step)).ceil * step] out.reverse! if reverse out end |
Instance Method Details
#normal_order_statistic_medians(i, n) ⇒ Object
260 261 262 263 264 265 266 267 268 269 |
# File 'lib/statsample.rb', line 260 def normal_order_statistic_medians(i, n) if i == 1 u = 1.0 - normal_order_statistic_medians(n, n) elsif i == n u = 0.5**(1 / n.to_f) else u = (i - 0.3175) / (n + 0.365) end u end |