compareMedians: Permutation test for difference in medians of unpaired...

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/compareMedians.r

Description

Tests whether the medians of two samples are equal.

Usage

1
2
compareMedians(x1, x2, alternative = "two.sided", n = 2000,
  name1 = "median1", name2 = "median2")

Arguments

x1

First sample (numeric vector).

x2

Second sample (numeric vector).

alternative

One of 'two.sided', 'less', or 'greater'.

n

Number of replicates (integer).

name1

Name of 1st sample to be used in output (character string).

name2

Name of 2nd sample to be used in output (character string).

Value

Numeric vector of length 3. The first two elements hold the empirical sample medians. The third element, named 'p', holds the p-value representing the probability that the two medians are equal.

Note

See example below.

Author(s)

David Kneis david.kneis@tu-dresden.de

References

Based on the code at https://stat.ethz.ch/pipermail/r-help/2010-May/238562.html.

See Also

No linkes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- c( 18,1.2,2.44,2.35,4.68,7.5 )
y <- c( 40.2,11.4,5.78,11.5,9.13,15.3,12.5 )
print(compareMedians(x, y, alternative="less"))
print(compareMedians(x, y, alternative="two.sided"))
print(compareMedians(x, y, alternative="greater"))
## Not run: 
library("rcompanion")
print(percentileTest(x=x, y=y, test="median", r=2000))

## End(Not run)

dkneis/knut documentation built on Jan. 7, 2020, 4:27 a.m.