wilcoxon: Wilcoxon Signed Rank and Mann-Whitney-Wilcoxon Rank Sum Test

View source: R/wilcoxon.R

wilcoxonR Documentation

Wilcoxon Signed Rank and Mann-Whitney-Wilcoxon Rank Sum Test

Description

Performs Wilcoxon signed rank test or Mann-Whitney-Wilcoxon rank sum test depending on data and logicals entered. Relies heavily on the function wilcox.test. Adds formatting and variances.

Usage

wilcoxon(
  var1,
  var2 = NULL,
  alternative = "two.sided",
  null.hypoth = 0,
  paired = FALSE,
  exact = FALSE,
  correct = FALSE,
  conf.int = FALSE,
  conf.level = 0.95
)

Arguments

var1

numeric vector of data values. Non-finite (missing or infinite) values will be omitted.

var2

optional numeric vector of data values. Non-finite (missing or infinite) values will be omitted.

alternative

specifies the alternative hypothesis for the test; acceptable values are "two.sided", "greater", or "less".

null.hypoth

the value of the null hypothesis.

paired

logical indicating whether the data are paired or not. Default is FALSE. If TRUE, data must be the same length.

exact

logical value indicating whether or not an exact test should be computed.

correct

logical indicating whether or not a continuity correction should be used and displayed.

conf.int

logical indicating whether or not to calculate and display a confidence interval

conf.level

confidence level for the interval. Defaults to 0.95.

Details

In the one-sample case, the returned confidence interval (when conf.int = TRUE) is a confidence interval for the pseudo-median of the underlying distribution. In the two-sample case, the function returns a confidence interval for the median of the difference between samples from the two distributions. See wilcox.test for more information.

Value

A list of class wilcoxon is returned. The print method lays out the information in an easy-to-read format.

statistic

the value of the test statistic with a name describing it.

parameter

the parameter(s) for the exact distribution of the test statistic.

p.value

the p-value for the test (calculated for the test statistic).

null.value

the parameter null.hypoth.

alternative

character string describing the alternative hypothesis.

method

the type of test applied.

data.name

a character string giving the names of the data.

conf.int

a confidence interval for the location parameter (only present if the argument conf.int=TRUE).

estimate

an estimate of the location parameter (only present if the argument conf.int=TRUE).

table

a formatted table of rank sum and number of observation values, for printing.

vars

a formatted table of variances, for printing.

hyps

a formatted table of the hypotheses, for printing.

inf

a formatted table of inference values, for printing.

See Also

wilcox.test

Examples


#- Create the data -#
cf <- c(1153, 1132, 1165, 1460, 1162, 1493, 1358, 1453, 1185, 1824, 1793, 1930, 2075)
healthy <- c(996, 1080, 1182, 1452, 1634, 1619, 1140, 1123, 1113, 1463, 1632, 1614, 1836)

#- Perform the test -#
wilcoxon(cf, healthy, paired=TRUE)

#- Perform the test -#
wilcoxon(cf, healthy, conf.int=TRUE)


rigr documentation built on Sept. 7, 2022, 1:05 a.m.