Learn R Programming

RVAideMemoire (version 0.9-35)

wilcox.signtest: Wilcoxon sign test

Description

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

Usage

wilcox.signtest(x, data, mu = 0)

Arguments

x
either a formula of the form a ~ b where a gives the data values and b a factor with 2 levels giving the corresponding groups (comparison of two medians); or a numeric vector (comparison of one median to a given valu
data
an optional data frame containing the variables in the formula x (if x is a formula). By default the variables are taken from environment(x). Not used if x is a numeric vector.
mu
theoretical median.

Value

  • methoda character string indicating what type of test was performed.
  • 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.valuep-value of the test.
  • estimatethe estimated median or difference in medians depending on the test performed.
  • alternativea character string giving the alternative hypothesis, always "two.sided"

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