Class/Module Index [+]

Quicksearch

Statsample::Test

Module for several statistical tests

Public Class Methods

chi_square(observed, expected=nil) click to toggle source
# File lib/statsample/test.rb, line 35
def chi_square(observed, expected=nil)
  case observed
    when Vector
      ChiSquare::WithVector.new(observed,expected)
    when Matrix
      ChiSquare::WithMatrix.new(observed,expected)
    else
      raise "Not implemented for #{observed.class}"
  end
end
levene(input, opts=Hash.new) click to toggle source

Shorthand for Statsample::Test::Levene.new

# File lib/statsample/test.rb, line 61
def levene(input, opts=Hash.new)
  Statsample::Test::Levene.new(input,opts)
end
t_one_sample(vector, opts=Hash.new) click to toggle source

Shorthand for Statsample::Test::T::OneSample.new

# File lib/statsample/test.rb, line 52
def t_one_sample(vector, opts=Hash.new)
  Statsample::Test::T::OneSample.new(vector,opts)
end
t_two_samples_independent(v1,v2, opts=Hash.new) click to toggle source

Shorthand for Statsample::Test::T::TwoSamplesIndependent.new

# File lib/statsample/test.rb, line 56
def t_two_samples_independent(v1,v2, opts=Hash.new)
  Statsample::Test::T::TwoSamplesIndependent.new(v1,v2,opts)
end
u_mannwhitney(v1, v2) click to toggle source

Shorthand for Statsample::Test::UMannWhitney.new

# File lib/statsample/test.rb, line 48
def u_mannwhitney(v1, v2)
  Statsample::Test::UMannWhitney.new(v1,v2)
end

Public Instance Methods

p_using_cdf(cdf, tails=:both) click to toggle source

Returns probability of getting a value lower or higher than sample, using cdf and number of tails.

  • :left : For one tail left, return the cdf

  • :right : For one tail right, return 1-cdf

  • :both : For both tails, returns 2*right_tail(cdf.abs)

# File lib/statsample/test.rb, line 18
def p_using_cdf(cdf, tails=:both)
  tails=:both if tails==2 or tails==:two
  tails=:right if tails==1 or tails==:positive
  tails=:left if tails==:negative
  case tails
    when :left then cdf
    when :right then 1-cdf
    when :both 
      if cdf>=0.5
        cdf=1-cdf
      end
      2*cdf
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.