Class: Rust::Correlation::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/rust/stats/correlation.rb

Overview

Result of a correlation test.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



131
132
133
134
# File 'lib/rust/stats/correlation.rb', line 131

def initialize
    @statistics = {}
    @exact = true
end

Instance Attribute Details

#correlationObject Also known as: estimate

Returns the value of attribute correlation.



126
127
128
# File 'lib/rust/stats/correlation.rb', line 126

def correlation
  @correlation
end

#exactObject

Returns the value of attribute exact.



127
128
129
# File 'lib/rust/stats/correlation.rb', line 127

def exact
  @exact
end

#nameObject

Returns the value of attribute name.



123
124
125
# File 'lib/rust/stats/correlation.rb', line 123

def name
  @name
end

#pvalueObject

Returns the value of attribute pvalue.



125
126
127
# File 'lib/rust/stats/correlation.rb', line 125

def pvalue
  @pvalue
end

#statisticsObject

Returns the value of attribute statistics.



124
125
126
# File 'lib/rust/stats/correlation.rb', line 124

def statistics
  @statistics
end

Instance Method Details

#[](name) ⇒ Object

Returns the statistic with the specified name.



139
140
141
# File 'lib/rust/stats/correlation.rb', line 139

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

#[]=(name, value) ⇒ Object

Sets the value for the the statistic with the specified name.



146
147
148
# File 'lib/rust/stats/correlation.rb', line 146

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

#to_sObject



150
151
152
153
154
# File 'lib/rust/stats/correlation.rb', line 150

def to_s
    return "#{name}. Correlation = #{correlation}, P-value = #{pvalue} " +
            (!@exact ? "P-value is not exact. " : "") + 
            "#{ statistics.map { |k, v| k.to_s + " -> " + v.to_s  }.join(", ") }."
end