Learn R Programming

RVAideMemoire (version 0.9-45-2)

wilcox.signtest: Wilcoxon sign test

Description

Performs a Wilcoxon sign test to compare medians of two paired samples or one median to a given value.

Usage

wilcox.signtest(x, ...)

## S3 method for class 'default':
wilcox.signtest(x, y = NULL, mu = 0, conf.level = 0.95, ...)

## S3 method for class 'formula':
wilcox.signtest(formula, data, subset, ...)

Arguments

x
a numeric vector of data values.
y
an optional numeric vector of data values (for paired two-sample test).
mu
theoretical median (one-sample test) or theoretical median of x-y differences.
conf.level
confidence level of the interval.
formula
a formula of the form a ~ b, where a and b give the data values and corresponding groups.
data
an optional data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).
subset
an optional vector specifying a subset of observations to be used.
...
further arguments to be passed to or from other methods.

Value

  • methoda character string indicating the name of the test.
  • data.namea character string giving the name(s) of the data.
  • null.valuethe specified hypothesized value of the median or median difference depending on the test performed.
  • p.valuethe p-value of the test.
  • alternativea character string giving the alternative hypothesis, always "two.sided"
  • estimatethe estimated median or median of x-y differences, depending on the test performed.
  • conf.inta confidence interval for the median tested.

Details

If zeroes (i.e. null differences with mu) are present, the median of the data different from mu is tested in the one-sample situation; the median of the x-y differences different from mu in the two-sample situation.

See Also

wilcox.test

Examples

Run this code
set.seed(1706)
response <- c(rnorm(7,3,1.5),rnorm(7,5.5,2))

# Comparison of 2 samples
fact <- gl(2,7,labels=LETTERS[1:2])
wilcox.signtest(response~fact)

# Comparison to a given value
theo <- 4
wilcox.signtest(response,mu=theo)

Run the code above in your browser using DataLab