Mann-Whitney U test

Example illustrating Mann-Whitney U test with statsample.

References

http://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test

In [1]:
require 'statsample'

Statsample::Analysis.store(Statsample::Test::UMannWhitney) do

  a = Daru::Vector.new(10.times.map {rand(100)})
  b = Daru::Vector.new(20.times.map {(rand(20))**2+50})

  u=Statsample::Test::UMannWhitney.new(a,b)
  summary u
end
  Statsample::Analysis.run_batch
Analysis 2015-06-04 16:16:39 +0530
= Statsample::Test::UMannWhitney
  == Mann-Whitney's U
    Mann-Whitney's U results
+--------------------------------------+-------------------+
| Sum of ranks                         | 80.500            |
| Sum of ranks                         | 384.500           |
| U Value                              | 25.500            |
| Z                                    | -3.283 (p: 0.001) |
| Exact p (Dinneen & Blakesley, 1973): | 0.000             |
+--------------------------------------+-------------------+