indt:

Usage Arguments Examples

Usage

1
indt(x, y, nboot = 500, flag = 1, SEED = TRUE)

Arguments

x
y
nboot
flag
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
##---- 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, nboot = 500, flag = 1, SEED = TRUE) 
{
    tr = 0
    if (SEED) 
        set.seed(2)
    x <- as.matrix(x)
    temp <- cbind(x, y)
    temp <- elimna(temp)
    pval <- ncol(temp) - 1
    x <- temp[, 1:pval]
    y <- temp[, pval + 1]
    x <- as.matrix(x)
    mflag <- matrix(NA, nrow = length(y), ncol = length(y))
    for (j in 1:length(y)) {
        for (k in 1:length(y)) {
            mflag[j, k] <- (sum(x[j, ] <= x[k, ]) == ncol(x))
        }
    }
    yhat <- mean(y)
    res <- y - yhat
    print("Taking bootstrap sample, please wait.")
    data <- matrix(runif(length(y) * nboot), nrow = nboot)
    data <- (data - 0.5) * sqrt(12)
    rvalb <- apply(data, 1, regts1, yhat, res, mflag, x, tr)
    rvalb <- rvalb/sqrt(length(y))
    dstatb <- apply(abs(rvalb), 2, max)
    wstatb <- apply(rvalb^2, 2, mean, tr = tr)
    v <- c(rep(1, length(y)))
    rval <- regts1(v, yhat, res, mflag, x, tr = 0)
    rval <- rval/sqrt(length(y))
    dstat <- NA
    wstat <- NA
    critd <- NA
    critw <- NA
    p.vald <- NA
    p.valw <- NA
    if (flag == 1 || flag == 3) {
        dstat <- max(abs(rval))
        p.vald <- 1 - sum(dstat >= dstatb)/nboot
    }
    if (flag == 2 || flag == 3) {
        wstat <- mean(rval^2, tr = tr)
        p.valw <- 1 - sum(wstat >= wstatb)/nboot
    }
    list(dstat = dstat, wstat = wstat, p.value.d = p.vald, p.value.w = p.valw)
  }

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