1 |
x |
|
alpha |
|
plotit |
|
sm |
|
SEED |
|
nboot |
|
grp |
|
xlab |
|
ylab |
|
crit |
|
print.all |
|
plot.op |
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 | ##---- 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, plotit = TRUE, sm = TRUE, SEED = TRUE,
nboot = 500, grp = c(1:4), xlab = "X (First Factor)", ylab = "Delta",
crit = NA, print.all = FALSE, plot.op = FALSE)
{
if (!is.list(x) && !is.matrix(x))
stop("store data in list mode or a matrix")
if (SEED)
set.seed(2)
if (is.matrix(x))
x <- listm(x)
for (j in 1:length(x)) x[[j]] = elimna(x[[j]])/2
if (length(grp) < 4)
stop("There must be at least 4 groups")
if (length(x) != 4)
stop("The argument grp must have 4 values")
x <- x[grp]
n <- c(length(x[[1]]), length(x[[2]]), length(x[[3]]), length(x[[4]]))
vals <- NA
y <- list()
if (is.na(crit)) {
print("Approximating critical value. Please wait.")
for (i in 1:nboot) {
for (j in 1:4) y[[j]] <- rnorm(n[j])
temp <- ks.test(outer(y[[1]], y[[2]], FUN = "+"),
outer(y[[3]], y[[4]], FUN = "+"))
vals[i] <- temp[1]$statistic
}
vals <- sort(vals)
ic <- (1 - alpha) * nboot
crit <- vals[ic]
}
if (plot.op) {
plotit <- F
g2plot(v1, v2)
}
output <- sband(outer(x[[1]], x[[2]], FUN = "+"), outer(x[[3]],
x[[4]], FUN = "+"), plotit = plotit, crit = crit, flag = FALSE,
sm = sm, xlab = xlab, ylab = ylab)
if (!print.all) {
numsig <- output$numsig
ks.test.stat <- ks.test(outer(x[[1]], x[[2]], FUN = "+"),
outer(x[[3]], x[[4]], FUN = "+"))$statistic
output <- matrix(c(numsig, crit, ks.test.stat), ncol = 1)
dimnames(output) <- list(c("number sig", "critical value",
"KS test statistics"), NULL)
}
output
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.