Learn R Programming

RVAideMemoire (version 0.9-83-7)

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 default wilcox.signtest(x, y = NULL, mu = 0, conf.level = 0.95, ...)

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

Value

method

a character string indicating the name of the test.

data.name

a character string giving the name(s) of the data.

null.value

the specified hypothesized value of the median or median difference depending on the test performed.

p.value

the p-value of the test.

alternative

a character string giving the alternative hypothesis, always "two.sided"

estimate

the estimated median or median of x-y differences, depending on the test performed.

conf.int

a confidence interval for the median tested.

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.

Author

Maxime HERVE <maxime.herve@univ-rennes1.fr>

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

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