1 |
x |
|
alpha |
|
g |
|
dp |
|
CI.FWE |
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 | ##---- 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, g = NULL, dp = NULL, CI.FWE = FALSE)
{
if (!is.null(g)) {
if (is.null(dp))
stop("Specify a value for dp, the column containing the data")
x = fac2list(x[, dp], x[, g])
}
if (is.data.frame(x))
x = as.matrix(x)
if (is.matrix(x))
x <- listm(x)
if (!is.list(x))
stop("Data must be stored in a matrix or in list mode.")
J <- length(x)
CC <- (J^2 - J)/2
test <- matrix(NA, CC, 7)
c.sum = matrix(NA, CC, 5)
for (j in 1:J) {
xx <- !is.na(x[[j]])
val <- x[[j]]
x[[j]] <- val[xx]
}
dimnames(test) <- list(NULL, c("Group", "Group", "p.hat",
"p.ci.lower", "p.ci.uppper", "p-value", "p.crit"))
dvec <- alpha/c(1:CC)
dimnames(c.sum) <- list(NULL, c("Group", "Group", "P(X<Y)",
"P(X=Y)", "P(X>Y)"))
jcom <- 0
n = matl(lapply(x, length))
for (j in 1:J) {
for (k in 1:J) {
if (j < k) {
temp <- cidv2(x[[j]], x[[k]], alpha, plotit = FALSE)
jcom <- jcom + 1
test[jcom, 1] <- j
test[jcom, 2] <- k
c.sum[jcom, 1] <- j
c.sum[jcom, 2] <- k
c.sum[jcom, 3:5] = cid(x[[j]], x[[k]])$summary.dvals
test[jcom, 3] <- temp$p.hat
test[jcom, 4] <- temp$p.ci[1]
test[jcom, 5] <- temp$p.ci[2]
test[jcom, 6] <- temp$p.value
}
}
}
temp2 <- order(0 - test[, 6])
test[temp2, 7] = dvec
if (CI.FWE) {
jcom <- 0
for (j in 1:J) {
for (k in 1:J) {
if (j < k) {
jcom <- jcom + 1
temp <- cidv2(x[[j]], x[[k]], alpha = test[jcom,
7], plotit = FALSE)
test[jcom, 4] <- temp$p.ci[1]
test[jcom, 5] <- temp$p.ci[2]
}
}
}
}
list(n = n, test = test, summary.dvals = c.sum)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.