class Rust::StatisticalTests::Result

Attributes

alpha[RW]
exact[RW]
hypothesis[RW]
name[RW]
pvalue[RW]
statistics[RW]

Public Class Methods

new() click to toggle source
# File lib/rust-tests.rb, line 12
def initialize
    @statistics = {}
end

Public Instance Methods

[](name) click to toggle source
# File lib/rust-tests.rb, line 16
def [](name)
    return @statistics[name.to_sym]
end
[]=(name, value) click to toggle source
# File lib/rust-tests.rb, line 20
def []=(name, value)
    @statistics[name.to_sym] = value
end
adjusted_pvalue(method='bonferroni') click to toggle source
# File lib/rust-tests.rb, line 24
def adjusted_pvalue(method='bonferroni')
    return 1 unless @hypothesis
    @hypothesis.adjusted_pvalue_for(self, method)
end
hypothesis=(value) click to toggle source
# File lib/rust-tests.rb, line 29
def hypothesis=(value)
    @hypothesis = value
    @hypothesis.add(self)
end
significant() click to toggle source
# File lib/rust-tests.rb, line 34
def significant
    pvalue < alpha
end
to_s() click to toggle source
# File lib/rust-tests.rb, line 38
def to_s
    return "#{name}. P-value = #{pvalue} " +
            "(#{significant ? "significant" : "not significant"} w/ alpha = #{alpha}); " + 
            "#{ statistics.map { |k, v| k.to_s + " -> " + v.to_s  }.join(", ") }." +
            (!exact ? " P-value is not exact." : "")
end