trimcimul:

Usage Arguments Examples

Usage

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

Arguments

x
tr
alpha
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
48
49
50
51
52
53
54
55
56
57
58
59
60
##---- 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, tr = 0.2, alpha = 0.05, null.value = 0) 
{
    if (!is.matrix(x)) 
        x <- matl(x)
    if (!is.matrix(x)) 
        stop("Data must be stored in a matrix or in list mode.")
    J <- ncol(x)
    xbar <- vector("numeric", J)
    ncon <- J
    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 (ncon > 10) {
            avec <- 0.05/c(11:ncon)
            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 (ncon > 10) {
            avec <- 0.01/c(11:ncon)
            dvec <- c(dvec, avec)
        }
    }
    if (alpha != 0.05 && alpha != 0.01) 
        dvec <- alpha/c(1:ncon)
    psihat <- matrix(0, J, 4)
    dimnames(psihat) <- list(NULL, c("Variable", "estimate", 
        "ci.lower", "ci.upper"))
    test <- matrix(0, J, 5)
    dimnames(test) <- list(NULL, c("Variable", "test", "p.value", 
        "p.crit", "se"))
    temp1 <- NA
    nval = NULL
    for (d in 1:J) {
        psihat[d, 1] <- d
        dval = na.omit(x[, d])
        nval[d] = length(dval)
        temp = trimci(dval, tr = tr, pr = FALSE, null.value = null.value)
        test[d, 1] <- d
        test[d, 2] <- temp$test.stat
        test[d, 3] = temp$p.value
        test[d, 5] <- temp$se
        psihat[d, 2] <- temp$estimate
        psihat[d, 3] <- temp$ci[1]
        psihat[d, 4] <- temp$ci[2]
    }
    temp1 = test[, 3]
    temp2 <- order(0 - temp1)
    zvec <- dvec[1:ncon]
    test[temp2, 4] <- zvec
    num.sig = sum(test[, 3] <= test[, 4])
    list(n = nval, test = test, psihat = psihat, num.sig = num.sig)
  }

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