Description Usage Arguments Value Note Author(s) References See Also Examples
View source: R/compareMedians.r
Tests whether the medians of two samples are equal.
1 2 | compareMedians(x1, x2, alternative = "two.sided", n = 2000,
name1 = "median1", name2 = "median2")
|
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). |
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.
See example below.
David Kneis david.kneis@tu-dresden.de
Based on the code at https://stat.ethz.ch/pipermail/r-help/2010-May/238562.html.
No linkes.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.