Method: Statsample::Crosstab#matrix_expected

Defined in:
lib/statsample/crosstab.rb

#matrix_expectedObject

Useful to obtain chi square



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/statsample/crosstab.rb', line 75

def matrix_expected
  rn=rows_names
  cn=cols_names
  rt=rows_total
  ct=cols_total
  t=@v_rows.size
  m=rn.collect{|row|
    cn.collect{|col|
      (rt[row]*ct[col]).quo(t) 
      }
  }
  Matrix.rows(m)
end