uwIntroStats (version 0.0.7)

wilcoxon: 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, and prints the z-score and p-value in addition to the test statistic and p-value.

Usage

## S3 method for class 'wilcoxon'
wilcoxon(y, x=NULL, alternative="two.sided", mu=0, paired=FALSE, 
        exact=NULL, correct=FALSE, conf.int=FALSE, conf.level=0.95)

Arguments

y

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

x

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".

mu

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' (performs a semi-parametric test on medians, and is non-robust) and point estimate.

conf.level

confidence level for the interval.

only used in the generic S3 class.

Value

A list with 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 mu.

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.

%% \item{comp2 }{Description of 'comp2'} %% ...

Details

See above.

See Also

wilcox.test

Examples

Run this code
# NOT RUN {
#- 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)
# }

Run the code above in your browser using DataCamp Workspace