

   Wilcoxon {base}                              R Documentation

   DDiissttrriibbuuttiioonn ooff tthhee WWiillccooxxoonn RRaannkk SSuumm SSttaattiissttiicc

   DDeessccrriippttiioonn::

        These functions provide information about the distribu-
        tion of the Wilcoxon rank sum statistic obtained from
        samples with size `m' and `n', respectively.  `dwilcox'
        gives the density, `pwilcox' gives the distribution
        function, `qwilcox' gives the quantile function, and
        `rwilcox' generates random deviates.

   UUssaaggee::

        dwilcox(x, m, n)
        pwilcox(q, m, n)
        qwilcox(p, m, n)
        rwilcox(nn, m, n)

   AArrgguummeennttss::

        x,q: vector of quantiles.

          p: vector of probabilities.

         nn: number of observations to generate.

        m,n: numbers of observations in the first and second
             sample, respectively.  Must be positive integers
             less than 50.

   DDeettaaiillss::

        This distribution is obtained as follows.  Let `x' and
        `y' be two random, independent samples of size `m' and
        `n'.  Then the Wilcoxon rank sum statistic is the num-
        ber of all pairs `(x[i], y[j])' for which `y[j]' is not
        greater than `x[i]'.  This statistic takes values
        between `0' and `m * n', and its mean and variance are
        `m * n / 2' and `m * n * (m + n + 1) / 12', respec-
        tively.

   AAuutthhoorr((ss))::

        Kurt Hornik hornik@ci.tuwien.ac.at

   SSeeee AAllssoo::

        `dsignrank' etc, for the one-sample Wilcoxon rank
        statistic.

   EExxaammpplleess::

        x <- -1:(4*6 + 1)
        fx <- dwilcox(x, 4, 6)
        all(fx == dwilcox(x, 6, 4))
        Fx <- pwilcox(x, 4, 6)
        all(abs(Fx - cumsum(fx)) < 10 * .Machine$double.eps)

        layout(rbind(1,2),width=1,heights=c(3,2))
        plot(x, fx,type='h', col="violet",
             main= "Probabilities (density) of Wilcoxon-Statist.(n=6,m=4)")
        plot(x, Fx,type="s", col="blue",
             main= "Distribution of Wilcoxon-Statist.(n=6,m=4)")
        abline(h=0:1, col="gray20",lty=2)
        layout(1)# set back

        N <- 200
        hist(U <- rwilcox(N, m=4,n=6), breaks=0:25 - 1/2, border="red", col="pink",
             sub = paste("N =",N))
        mtext("N * f(x),  f() = true ``density''", side=3, col="blue")
         lines(x, N*fx, type='h', col='blue', lwd=2)
        points(x, N*fx, cex=2)

        ## Better is a Quantile-Quantile Plot
        qqplot(U, qw <- qwilcox((1:N - 1/2)/N, m=4,n=6),
               main = paste("Q-Q-Plot of empirical and theoretical quantiles",
                             "Wilcoxon Statistic,  (m=4, n=6)",sep="\n"))
        n <- as.numeric(names(print(tU <- table(U))))
        text(n+.2, n+.5, labels=tU, col="red")

