med2g:

Usage Arguments Examples

Usage

1
med2g(x, y, alpha = 0.05, nboot = 1000, SEED = TRUE, ...)

Arguments

x
y
alpha
nboot
SEED
...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, y, alpha = 0.05, nboot = 1000, SEED = TRUE, ...) 
{
    x <- elimna(x)
    y <- elimna(y)
    mvec <- NA
    mvec[1] <- median(x)
    mvec[2] <- median(y)
    bvec <- NA
    if (SEED) 
        set.seed(2)
    datax <- matrix(sample(x, size = length(x) * nboot, replace = TRUE), 
        nrow = nboot)
    datay <- matrix(sample(y, size = length(x) * nboot, replace = TRUE), 
        nrow = nboot)
    bvec1 <- apply(datax, 1, median)
    bvec2 <- apply(datay, 1, median)
    test <- sum((bvec1 > bvec2))/nboot
    tv <- sum(bvec1 == bvec2)/nboot
    test <- test + 0.5 * tv
    if (test > 0.5) 
        test <- 1 - test
    test <- 2 * test
    dvec <- sort(bvec1 - bvec2)
    icl <- round(alpha * nboot/2) + 1
    icu <- nboot - icl - 1
    cilow <- dvec[icl]
    ciup <- dvec[icu]
    list(p.value = test, est.1 = mvec[1], est.2 = mvec[2], est.dif = mvec[1] - 
        mvec[2], ci.low = cilow, ci.up = ciup)
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.