1 | stein1.tr(x, del, alpha = 0.05, pow = 0.8, tr = 0.2)
|
x |
|
del |
|
alpha |
|
pow |
|
tr |
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 | ##---- 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, del, alpha = 0.05, pow = 0.8, tr = 0.2)
{
if (tr < 0 || tr >= 0.5)
stop("Argument tr must be between 0 and .5")
if (is.matrix(x))
m <- x
if (is.list(x))
m <- matl(x)
if (!is.matrix(x) && !is.list(x))
m <- matrix(x, ncol = 1)
m <- elimna(m)
m <- as.matrix(m)
ntest <- 1
n <- nrow(m)
J <- ncol(m)
if (ncol(m) > 1)
ntest <- (J^2 - J)/2
g <- floor(tr * nrow(m))
df <- n - 2 * g - 1
t1 <- qt(pow, df)
t2 <- qt(alpha/(2 * ntest), df)
dv <- (del/(t1 - t2))^2
nvec <- NA
if (ntest > 1) {
ic <- 0
for (j in 1:ncol(m)) {
for (jj in 1:ncol(m)) {
if (j < jj) {
ic <- ic + 1
dif <- m[, j] - m[, jj]
nvec[ic] <- floor(winvar(dif, tr = tr)/dv) +
1
}
}
}
}
if (ntest == 1)
nvec[1] <- floor(winvar(m[, 1], tr = tr)/dv) + 1
N <- max(c(n, nvec))
N
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.