Class: Skab::Output::Summary

Inherits:
Object
  • Object
show all
Defined in:
lib/skab/output/summary.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out) ⇒ Summary

Returns a new instance of Summary.



4
5
6
# File 'lib/skab/output/summary.rb', line 4

def initialize(out)
  @out = out
end

Class Method Details

.helpObject



25
26
27
28
29
30
31
# File 'lib/skab/output/summary.rb', line 25

def self.help
  <<-HELP
Usage: skab summary [model] [parameters]
\tOutputs a summary of the whole statistical analysis conducted on A and
\tB, using the specified model.
  HELP
end

Instance Method Details

#output(model) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/skab/output/summary.rb', line 8

def output(model)
  sum = 0.0
  min = 0
  max = 0
  Hash[model.differential.sort].each do |k, v|
    sum += v
    if min == 0 || sum <= 0.05
      min = k
    end
    if max == 0 && sum >= 0.95
      max = k
    end
  end

  @out.puts "The difference is located between #{min} and #{max} (90% confidence)"
end