pbanovag:

Usage Arguments Examples

Usage

1
pbanovag(x, alpha = 0.05, nboot = NA, grp = NA, est = onestep, ...)

Arguments

x
alpha
nboot
grp
est
...

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
##---- 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, alpha = 0.05, nboot = NA, grp = NA, est = onestep, 
    ...) 
{
    con <- as.matrix(con)
    if (is.matrix(x)) 
        x <- listm(x)
    if (!is.list(x)) 
        stop("Data must be stored in list mode or in matrix mode.")
    if (!is.na(sum(grp))) {
        xx <- list()
        for (i in 1:length(grp)) xx[[i]] <- x[[grp[1]]]
        x <- xx
    }
    J <- length(x)
    tempn <- 0
    for (j in 1:J) {
        temp <- x[[j]]
        temp <- temp[!is.na(temp)]
        tempn[j] <- length(temp)
        x[[j]] <- temp
    }
    Jm <- J - 1
    icl <- ceiling(crit * nboot)
    icu <- ceiling((1 - crit) * nboot)
    con <- matrix(0, J, J - 1)
    for (j in 1:Jm) {
        jp <- j + 1
        con[j, j] <- 1
        con[jp, j] <- 0 - 1
    }
    if (is.na(nboot)) {
        nboot <- 5000
        if (J <= 8) 
            nboot <- 4000
        if (J <= 3) 
            nboot <- 2000
    }
    if (alpha == 0.05) {
        dvec <- c(0.05, 0.025, 0.0169, 0.0127, 0.0102, 0.00851, 
            0.0073, 0.00639, 0.00568, 0.00511)
        if (Jm > 10) {
            avec <- 0.05/c(11:Jm)
            dvec <- c(dvec, avec)
        }
    }
    if (alpha == 0.01) {
        dvec <- c(0.01, 0.005, 0.00334, 0.00251, 0.00201, 0.00167, 
            0.00143, 0.00126, 0.00112, 0.00101)
        if (Jm > 10) {
            avec <- 0.01/c(11:Jm)
            dvec <- c(dvec, avec)
        }
    }
    if (alpha != 0.05 && alpha != 0.01) 
        dvec <- alpha/c(1:Jm)
    bvec <- matrix(NA, nrow = J, ncol = nboot)
    set.seed(2)
    print("Taking bootstrap samples. Please wait.")
    for (j in 1:J) {
        paste("Working on group ", j)
        data <- matrix(sample(x[[j]], size = length(x[[j]]) * 
            nboot, replace = TRUE), nrow = nboot)
        bvec[j, ] <- apply(data, 1, est, ...)
    }
    test <- NA
    for (d in 1:Jm) {
        dp <- d + 1
        test[d] <- sum(bvec[d, ] > bvec[dp, ])/nboot
        if (test[d] > 0.5) 
            test[d] <- 1 - test[d]
    }
    test <- (0 - 1) * sort(-2 * test)
    sig <- sum((test < dvec[1:Jm]))
    if (sig > 0) 
        print("Significant result obtained: Reject")
    if (sig == 0) 
        print("No significant result obtained: Fail to reject")
    list(test.vec = test, crit.vec = dvec[1:Jm])
  }

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