1 |
x |
|
y |
|
tr |
|
nboot |
|
alpha |
|
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 | ##---- 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 = 1000, alpha = 0.05, SEED = TRUE)
{
if (SEED)
set.seed(2)
if (is.null(y)) {
if (!is.matrix(x))
stop("y is null and x is not a matrix")
}
if (!is.null(y))
x = cbind(x, y)
if (ncol(x) != 2)
print("warning: x has more than one column; columns 1 and 2 are used")
n = nrow(x)
test = yuendna(x, tr = tr)
cen = x
cen[, 1] = cen[, 1] - mean(x[, 1], na.rm = TRUE, tr = tr)
cen[, 2] = cen[, 2] - mean(x[, 2], na.rm = TRUE, tr = tr)
data = matrix(sample(n, n * nboot, replace = TRUE), ncol = nboot)
tval = apply(data, 2, FUN = rm2miss.sub, x = cen, tr = tr)
tval = sort(abs(tval))
icrit <- floor((1 - alpha) * nboot + 0.5)
ci = test$est - tval[icrit] * test$se
ci[2] = test$est + tval[icrit] * test$se
pv = mean(abs(test$test) <= abs(tval))
list(ci = ci, p.value = pv)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.