Method: Statsample::Test::UMannWhitney#z

Defined in:
lib/statsample/test/umannwhitney.rb

#zObject

Z value for U, with adjust for ties. For large samples, U is approximately normally distributed. In that case, you can use z to obtain probabily for U.

Reference:

  • SPSS Manual


187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/statsample/test/umannwhitney.rb', line 187

def z
  mu=(@n1*@n2).quo(2)
  if(!@ties)
    ou=Math::sqrt(((@n1*@n2)*(@n1+@n2+1)).quo(12))
  else
    n=@n1+@n2
    first=(@n1*@n2).quo(n*(n-1))
    second=((n**3-n).quo(12))-@t
    ou=Math::sqrt(first*second)
  end
  (@u-mu).quo(ou)
end