bd1way:

Usage Arguments Examples

Usage

1
bd1way(x, est = tmean, nboot = 599, alpha = 0.05, SEED = TRUE, misran = FALSE, na.rm = NULL, pr = TRUE, ...)

Arguments

x
est
nboot
alpha
SEED
misran
na.rm
pr
...

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
##---- 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 = tmean, nboot = 599, alpha = 0.05, SEED = TRUE, 
    misran = FALSE, na.rm = NULL, pr = TRUE, ...) 
{
    if (!is.list(x) && !is.matrix(x)) 
        stop("Data must be stored in list mode or in an n by J matrix.")
    if (pr) 
        print("As of Oct, 2015, the default measure of location is a trimmed mean, not the one-step M-estimator")
    if (is.list(x)) {
        m <- matrix(0, length(x[[1]]), length(x))
        for (j in 1:length(x)) m[, j] <- x[[j]]
    }
    if (is.matrix(x)) 
        m <- x
    if (!is.null(na.rm)) 
        misran = !na.rm
    if (!misran) 
        m = elimna(m)
    xcen <- m
    locval = apply(m, 2, est, na.rm = TRUE, ...)
    for (j in 1:ncol(m)) xcen[, j] <- m[, j] - est(m[, j], na.rm = misran, 
        ...)
    if (SEED) 
        set.seed(2)
    print("Taking bootstrap samples. Please wait.")
    data <- matrix(sample(nrow(m), size = nrow(m) * nboot, replace = TRUE), 
        nrow = nboot)
    bvec <- vector("numeric")
    bvec <- apply(data, 1, bd1way1, xcen, est, misran = misran, 
        ...)
    icrit <- floor((1 - alpha) * nboot + 0.5)
    testv <- vector("numeric")
    for (j in 1:ncol(m)) testv[j] <- est(m[, j], na.rm = misran, 
        ...)
    test <- (length(testv) - 1) * var(testv)
    pv = mean((test < bvec))
    list(test = test, estimates = locval, p.value = pv)
  }

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