wilcoxonZ function

Wilcoxon z statistic

Wilcoxon z statistic

Calculates the z statistic for a Wilcoxon two-sample, paired, or one-sample test.

wilcoxonZ( x, y = NULL, mu = 0, paired = FALSE, exact = FALSE, correct = FALSE, digits = 3 )

Arguments

  • x: A vector of observations.
  • y: For the two-sample and paired cases, a second vector of observations.
  • mu: For the one-sample case, the value to compare x to, as in wilcox.test
  • paired: As used in wilcox.test.
  • exact: As used in wilcox.test, default here is FALSE.
  • correct: As used in wilcox.test, default here is FALSE.
  • digits: The number of significant digits in the output.

Returns

A single statistic, z.

Details

This function uses code from wilcox.test, and reports the z statistic, which is calculated by the original function but isn't returned.

The returned value will be NA if the function attempts an exact test.

For the paired case, the observations in x and and y should be ordered such that the first observation in x is paired with the first observation in y, and so on.

Examples

data(Pooh) wilcoxonZ(x = Pooh$Likert[Pooh$Time==1], y = Pooh$Likert[Pooh$Time==2], paired=TRUE, exact=FALSE, correct=FALSE)

Author(s)

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu , R Core Team