Sha256: 5c13a47e42fd7e12980a12e74b02aa558c02da9f3ecb01b0361a5efdf87f5f44
Contents?: true
Size: 959 Bytes
Versions: 9
Compression:
Stored size: 959 Bytes
Contents
module Statsample # module for several statistical tests module Test # Calculate chi square for two Matrix class << self def chi_square(real,expected) raise TypeError, "Both argument should be Matrix" unless real.is_a? Matrix and expected.is_a?Matrix sum=0 (0...real.row_size).each {|row_i| (0...real.column_size).each {|col_i| val=((real[row_i,col_i].to_f - expected[row_i,col_i].to_f)**2) / expected[row_i,col_i].to_f # puts "Real: #{real[row_i,col_i].to_f} ; esperado: #{expected[row_i,col_i].to_f}" # puts "Diferencial al cuadrado: #{(real[row_i,col_i].to_f - expected[row_i,col_i].to_f)**2}" sum+=val } } sum end def t_significance end end end end
Version data entries
9 entries across 9 versions & 1 rubygems