tamhane:

Usage Arguments Examples

Usage

1
tamhane(x, x2 = NA, cil = NA, crit = NA)

Arguments

x
x2
cil
crit

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
##---- 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, x2 = NA, cil = NA, crit = NA) 
{
    if (is.matrix(x)) 
        x <- listm(x)
    if (!is.list(x)) 
        stop("Data must be stored in list mode or in matrix mode.")
    J <- length(x)
    tempn <- 0
    svec <- NA
    for (j in 1:J) {
        temp <- x[[j]]
        temp <- temp[!is.na(temp)]
        tempn[j] <- length(temp)
        x[[j]] <- temp
        svec[j] <- var(temp)
    }
    A <- sum(1/(tempn - 1))
    df <- J/A
    paste("The degrees of freedom are:", df)
    if (is.na(crit)) 
        stop("Enter a critical value and reexecute this function")
    if (is.na(cil)) 
        stop("To proceed, you must specify the length of the confidence intervals.")
    d <- (cil/(2 * crit))^2
    n.vec <- NA
    for (j in 1:J) {
        n.vec[j] <- max(tempn[j] + 1, floor(svec[j]/d) + 1)
    }
    ci.mat <- NA
    if (!is.na(x2[1])) {
        if (is.matrix(x2)) 
            x2 <- listm(x2)
        if (!is.list(x2)) 
            stop("Data must be stored in list mode or in matrix mode.")
        TT <- NA
        U <- NA
        J <- length(x)
        nvec2 <- NA
        for (j in 1:length(x)) {
            nvec2[j] <- length(x2[[j]])
            if (nvec2[j] < n.vec[j] - tempn[j]) {
                paste("The required number of observations for group", 
                  j, " in the second stage is ")
                paste(n.vec[j] - tempn[j], " but only ", nvec2[j], 
                  " are available")
                stop()
            }
            TT[j] <- sum(x[[j]])
            U[j] <- sum(x2[[j]])
            print(c(TT[j], U[j], nvec2[j]))
        }
        b <- sqrt(tempn * ((tempn + nvec2) * d - svec)/(nvec2 * 
            svec))
        b <- (b + 1)/(tempn + nvec2)
        print(c(b, svec))
        xtil <- TT * (1 - nvec2 * b)/tempn + b * U
        print(xtil)
        jall <- (J^2 - J)/2
        ci.mat <- matrix(0, ncol = 4, nrow = jall)
        dimnames(ci.mat) <- list(NULL, c("Group", "Group", "ci.low", 
            "ci.high"))
        ic <- 0
        for (j in 1:J) {
            for (k in 1:J) {
                if (j < k) {
                  ic <- ic + 1
                  ci.mat[ic, 1] <- j
                  ci.mat[ic, 2] <- k
                  ci.mat[ic, 3] <- xtil[j] - xtil[k] - cil/2
                  ci.mat[ic, 4] <- xtil[j] - xtil[k] + cil/2
                }
            }
        }
    }
    list(n.vec = n.vec, ci.mat = ci.mat)
  }

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