m2ci:

Usage Arguments Examples

Usage

1
m2ci(x, y, alpha = 0.05, nboot = 1000, bend = 1.28, os = FALSE)

Arguments

x
y
alpha
nboot
bend
os

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
##---- 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, bend = 1.28, os = FALSE) 
{
    os <- as.logical(os)
    x <- x[!is.na(x)]
    y <- y[!is.na(y)]
    if (length(x) <= 19 || length(y) <= 19) 
        warning(paste("The number of observations in at least one group\nis less than 20. This function might fail due to division by zero,\nwhich in turn causes an error in function hpsi having to do with\na missing value."))
    set.seed(2)
    print("Taking bootstrap samples. Please wait.")
    datax <- matrix(sample(x, size = length(x) * nboot, replace = TRUE), 
        nrow = nboot)
    datay <- matrix(sample(y, size = length(y) * nboot, replace = TRUE), 
        nrow = nboot)
    if (!os) {
        bvecx <- apply(datax, 1, mest, bend)
        bvecy <- apply(datay, 1, mest, bend)
    }
    if (os) {
        bvecx <- apply(datax, 1, onestep, bend)
        bvecy <- apply(datay, 1, onestep, bend)
    }
    bvec <- sort(bvecx - bvecy)
    test <- sum(bvec < 0)/nboot + 0.5 * sum(bvec == 0)/nboot
    pv = 2 * min(c(test, 1 - test))
    low <- round((alpha/2) * nboot)
    up <- round((1 - alpha/2) * nboot)
    se <- sqrt(var(bvec))
    list(ci = c(bvec[low], bvec[up]), se = se, p.value = pv)
  }

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