Class: Rust::StatisticalTests::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/rust-tests.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



11
12
13
# File 'lib/rust-tests.rb', line 11

def initialize
    @statistics = {}
end

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



9
10
11
# File 'lib/rust-tests.rb', line 9

def alpha
  @alpha
end

#exactObject

Returns the value of attribute exact.



8
9
10
# File 'lib/rust-tests.rb', line 8

def exact
  @exact
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/rust-tests.rb', line 5

def name
  @name
end

#pvalueObject

Returns the value of attribute pvalue.



7
8
9
# File 'lib/rust-tests.rb', line 7

def pvalue
  @pvalue
end

#statisticsObject

Returns the value of attribute statistics.



6
7
8
# File 'lib/rust-tests.rb', line 6

def statistics
  @statistics
end

Instance Method Details

#[](name) ⇒ Object



15
16
17
# File 'lib/rust-tests.rb', line 15

def [](name)
    return @statistics[name.to_sym]
end

#[]=(name, value) ⇒ Object



19
20
21
# File 'lib/rust-tests.rb', line 19

def []=(name, value)
    @statistics[name.to_sym] = value
end

#significantObject



23
24
25
# File 'lib/rust-tests.rb', line 23

def significant
    pvalue < alpha
end

#to_sObject



27
28
29
30
31
32
# File 'lib/rust-tests.rb', line 27

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