Class: Rust::StatisticalTests::Result
Instance Attribute Summary collapse
-
#alpha ⇒ Object
Returns the value of attribute alpha.
-
#exact ⇒ Object
Returns the value of attribute exact.
-
#hypothesis ⇒ Object
Returns the value of attribute hypothesis.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pvalue ⇒ Object
Returns the value of attribute pvalue.
-
#statistics ⇒ Object
Returns the value of attribute statistics.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
- #adjusted_pvalue(method = 'bonferroni') ⇒ Object
-
#initialize ⇒ Result
constructor
A new instance of Result.
- #significant ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
12 13 14 |
# File 'lib/rust-tests.rb', line 12 def initialize @statistics = {} end |
Instance Attribute Details
#alpha ⇒ Object
Returns the value of attribute alpha.
9 10 11 |
# File 'lib/rust-tests.rb', line 9 def alpha @alpha end |
#exact ⇒ Object
Returns the value of attribute exact.
8 9 10 |
# File 'lib/rust-tests.rb', line 8 def exact @exact end |
#hypothesis ⇒ Object
Returns the value of attribute hypothesis.
10 11 12 |
# File 'lib/rust-tests.rb', line 10 def hypothesis @hypothesis end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/rust-tests.rb', line 5 def name @name end |
#pvalue ⇒ Object
Returns the value of attribute pvalue.
7 8 9 |
# File 'lib/rust-tests.rb', line 7 def pvalue @pvalue end |
#statistics ⇒ Object
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
16 17 18 |
# File 'lib/rust-tests.rb', line 16 def [](name) return @statistics[name.to_sym] end |
#[]=(name, value) ⇒ Object
20 21 22 |
# File 'lib/rust-tests.rb', line 20 def []=(name, value) @statistics[name.to_sym] = value end |
#adjusted_pvalue(method = 'bonferroni') ⇒ Object
24 25 26 27 |
# File 'lib/rust-tests.rb', line 24 def adjusted_pvalue(method='bonferroni') return 1 unless @hypothesis @hypothesis.adjusted_pvalue_for(self, method) end |
#significant ⇒ Object
34 35 36 |
# File 'lib/rust-tests.rb', line 34 def significant pvalue < alpha end |
#to_s ⇒ Object
38 39 40 41 42 43 |
# 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 |