wwtrimbt:

Usage Arguments Examples

Usage

1
wwtrimbt(J, K, x, tr = 0.2, JK = J * K, con = 0, alpha = 0.05, grp = c(1:JK), nboot = 599, SEED = TRUE, ...)

Arguments

J
K
x
tr
JK
con
alpha
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 (J, K, x, tr = 0.2, JK = J * K, con = 0, alpha = 0.05, 
    grp = c(1:JK), nboot = 599, SEED = TRUE, ...) 
{
    if (is.data.frame(x)) 
        x = as.matrix(x)
    if (is.matrix(x)) {
        y <- list()
        for (j in 1:ncol(x)) y[[j]] <- x[, j]
        x = y
    }
    ncon = ncol(con)
    p <- J * K
    JK = p
    if (p > length(x)) 
        stop("JK is less than the Number of groups")
    JK = J * K
    data <- list()
    xx = list()
    for (j in 1:length(x)) {
        xx[[j]] = x[[grp[j]]]
        data[[j]] = xx[[j]] - mean(xx[[j]], tr = tr)
    }
    if (SEED) 
        set.seed(2)
    bsam = list()
    bdat = list()
    aboot = NA
    bboot = NA
    cboot = NA
    abboot = NA
    test.stat = wwtrim(J, K, xx, tr = tr)
    nv = length(x[[1]])
    for (ib in 1:nboot) {
        bdat[[j]] = sample(nv, size = nv, replace = T)
        for (k in 1:JK) bsam[[k]] = data[[k]][bdat[[j]]]
        temp = wwtrim(J, K, bsam, tr = tr)
        aboot[ib] = temp$Qa
        bboot[ib] = temp$Qb
        abboot[ib] = temp$Qab
    }
    pbA = NA
    pbB = NA
    pbAB = NA
    pbA = mean(test.stat$Qa[1, 1] < aboot)
    pbB = mean(test.stat$Qb[1, 1] < bboot)
    pbAB = mean(test.stat$Qab[1, 1] < abboot)
    list(p.value.A = pbA, p.value.B = pbB, p.value.AB = pbAB)
  }

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