K-W Subcommand (NPAR TESTS command)

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

K-W (alias KRUSKAL-WALLIS) tests whether k independent samples that are defined by a grouping variable are from the same population. The output shows the number of valid cases and the mean rank of the variable in each group in the Ranks table. the output also shows the chi-square, degrees of freedom, 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.
  • Every value in the range defined by the pair of values for the grouping variable forms a group.

Operations

  • Cases from the k groups are ranked in a single series, and the rank sum for each group is computed. A test statistic is calculated for each variable that is specified before BY.
  • Kruskal-Wallis H has approximately a chi-square distribution.
  • Cases with values other than values in the range that is specified for the grouping variable are excluded.

Example

NPAR TESTS K-W=V1 BY V2(0,4).
  • This example tests V1 for groups that are defined by values 0 through 4 of V2.