1 |
x |
|
y |
|
tr |
|
nboot |
|
SEED |
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 | ##---- 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 = NULL, tr = 0, nboot = 500, SEED = TRUE)
{
x <- as.matrix(x)
if (!is.null(y[1])) {
temp <- cbind(x, y)
temp <- elimna(temp)
pval <- ncol(temp) - 1
x <- temp[, 1:pval]
y <- temp[, pval + 1]
}
x <- as.matrix(x)
if (is.null(y[1])) {
ntest <- (ncol(x)^2 - ncol(x))/2
if (ntest == 0)
stop("Something is wrong. Does x have only one column?")
output <- matrix(NA, nrow = ntest, ncol = 4)
dimnames(output) <- list(NULL, c("VAR", "VAR", "Test Stat.",
"p-value"))
x <- elimna(x)
ic <- 0
for (j in 1:ncol(x)) {
for (jj in 1:ncol(x)) {
if (j < jj) {
temp <- indt(x[, j], x[, jj], tr = tr, nboot = nboot,
SEED = SEED)
ic <- ic + 1
output[ic, 1] <- j
output[ic, 2] <- jj
output[ic, 3] <- temp$dstat
output[ic, 4] <- temp$p.value.d
}
}
}
}
if (!is.null(y[1])) {
ntest <- ncol(x)
output <- matrix(NA, nrow = ntest, ncol = 3)
dimnames(output) <- list(NULL, c("VAR", "Test Stat.",
"p-value"))
ic <- 0
for (j in 1:ncol(x)) {
temp <- indt(x[, j], y, tr = tr, nboot = nboot, SEED = SEED)
ic <- ic + 1
output[ic, 1] <- j
output[ic, 2] <- temp$dstat
output[ic, 3] <- temp$p.value.d
}
}
list(output = output)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.