rmdzero:

Usage Arguments Examples

Usage

1
rmdzero(x, est = onestep, grp = NA, nboot = 500, SEED = TRUE, ...)

Arguments

x
est
grp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
##---- 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, est = onestep, grp = NA, nboot = 500, SEED = TRUE, 
    ...) 
{
    if (!is.list(x) && !is.matrix(x)) 
        stop("Data must be stored in a matrix or in list mode.")
    if (is.list(x)) {
        mat <- matrix(0, length(x[[1]]), length(x))
        for (j in 1:length(x)) mat[, j] <- x[[j]]
    }
    if (is.matrix(x)) 
        mat <- x
    if (!is.na(grp[1])) {
        mat <- mat[, grp]
    }
    mat <- elimna(mat)
    J <- ncol(mat)
    jp <- 0
    Jall <- (J^2 - J)/2
    dif <- matrix(NA, nrow = nrow(mat), ncol = Jall)
    ic <- 0
    for (j in 1:J) {
        for (k in 1:J) {
            if (j < k) {
                ic <- ic + 1
                dif[, ic] <- mat[, j] - mat[, k]
            }
        }
    }
    dif <- as.matrix(dif)
    if (SEED) 
        set.seed(2)
    data <- matrix(sample(nrow(mat), size = nrow(mat) * nboot, 
        replace = T), nrow = nboot)
    bvec <- matrix(NA, ncol = ncol(dif), nrow = nboot)
    for (j in 1:ncol(dif)) {
        temp <- dif[, j]
        bvec[, j] <- apply(data, 1, rmanogsub, temp, est)
    }
    center <- apply(dif, 2, est, ...)
    bcen <- apply(bvec, 2, mean)
    cmat <- var(bvec - bcen + center)
    zvec <- rep(0, Jall)
    m1 <- rbind(bvec, zvec)
    bplus <- nboot + 1
    discen <- mahalanobis(m1, center, cmat)
    sig.level <- sum(discen[bplus] <= discen)/bplus
    list(p.value = sig.level, center = center)
  }

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