M-W Subcommand (NPAR TESTS command)

NPAR TESTS M-W=varlist BY variable(value1,value2)

M-W (alias MANN-WHITNEY) tests whether two independent samples that are defined by a grouping variable are from the same population. The test statistic uses the rank of each case to test whether the groups are drawn from the same population. The output shows the number of valid cases of each group; the mean rank of the variable within each group and the sum of ranks in the Ranks table and the Mann-Whitney U; Wilcoxon W (the rank sum of the smaller group); Z statistic; and probability in the Test Statistics table.

Syntax

  • The minimum specification is a test variable, the keyword BY, a grouping variable, and a pair of values in parentheses.
  • Cases with the first value form one group and cases with the second value form the other group. The order in which the values are specified is unimportant.

Operations

  • Cases are ranked in order of increasing size, and test statistic U (the number of times that a score from group 1 precedes a score from group 2) is computed.
  • An exact significance level is computed if there are 40 or fewer cases. For more than 40 cases, U is transformed into a normally distributed Z statistic, and a normal approximation p value is computed.
  • A test statistic is calculated for each variable that is named before BY.
  • Cases with values other than values that are specified for the grouping variable are excluded.

Example

NPAR TESTS M-W=V1 BY V2(1,2).
  • This example tests V1 based on the two groups that are defined by values 1 and 2 of V2.