stein2.tr:

Usage Arguments Examples

Usage

1
stein2.tr(x, y, alpha = 0.05, tr = 0.2, null.value = 0)

Arguments

x
y
alpha
tr
null.value

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
##---- 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, alpha = 0.05, tr = 0.2, null.value = 0) 
{
    if (tr < 0 || tr >= 0.5) 
        stop("Argument tr must be between 0 and .5")
    if (is.matrix(x)) 
        m <- x
    if (is.list(x)) 
        m <- matl(x)
    if (is.list(y)) 
        y <- matl(y)
    if (!is.matrix(x) && !is.list(x)) 
        m <- matrix(x, ncol = 1)
    if (!is.matrix(y) && !is.list(y)) 
        y <- matrix(y, ncol = 1)
    m <- elimna(m)
    m <- as.matrix(m)
    g <- floor(tr * nrow(m))
    df <- nrow(m) - 2 * g - 1
    m <- rbind(m, y)
    ic <- 0
    ntest <- (ncol(m)^2 - ncol(m))/2
    if (ntest == 0) 
        ntest <- 1
    test <- matrix(NA, ncol = 3, nrow = ntest)
    for (j in 1:ncol(m)) {
        for (jj in 1:ncol(m)) {
            if (j < jj) {
                ic <- ic + 1
                dif <- m[, j] - m[, jj]
                test[ic, 1] <- j
                test[ic, 2] <- jj
                test[ic, 3] <- sqrt(nrow(m)) * (1 - 2 * tr) * 
                  (mean(dif, tr = tr, na.rm = TRUE) - null.value)/sqrt(winvar(dif))
            }
        }
    }
    crit <- qt(1 - alpha/(2 * ntest), df)
    if (ntest == 1) 
        test <- sqrt(nrow(m)) * (1 - 2 * tr) * mean(m[, 1], tr = tr, 
            na.rm = TRUE)/sqrt(winvar(m[, 1]))
    list(test.stat = test, crit.val = crit)
  }

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