1 |
x |
|
alpha |
|
bhop |
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, alpha = 0.05, bhop = FALSE)
{
if (is.matrix(x))
x <- listm(x)
if (!is.list(x))
stop("Data must be stored in list mode or a matrix.")
J <- length(x)
for (j in 1:J) {
xx <- x[[j]]
x[[j]] <- xx[!is.na(xx)]
}
CC <- (J^2 - J)/2
ncon <- CC
if (!bhop) {
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)
}
if (bhop)
dvec <- (ncon - c(1:ncon) + 1) * alpha/ncon
output <- matrix(0, CC, 5)
dimnames(output) <- list(NULL, c("Level", "Level", "test.stat",
"p.value", "p.crit"))
ic <- 0
for (j in 1:J) {
for (jj in 1:J) {
if (j < jj) {
ic <- ic + 1
output[ic, 1] <- j
output[ic, 2] <- jj
temp <- bdm(x[c(j, jj)])
output[ic, 3] <- temp$output$F
output[ic, 4] <- temp$output$sig
}
}
}
temp2 <- order(0 - output[, 4])
output[temp2, 5] <- dvec[1:length(temp2)]
list(output = output)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.