1 |
x |
|
y |
|
est |
|
alpha |
|
nboot |
|
SEED |
|
pr |
|
na.rm |
|
... |
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 | ##---- 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, est = median, alpha = 0.05, nboot = 500,
SEED = TRUE, pr = TRUE, na.rm = TRUE, ...)
{
if (is.null(y[1])) {
if (!is.matrix(x) & !is.data.frame(x))
stop("With y missing, x should be a matrix")
}
if (!is.null(y[1])) {
if (length(x) != length(y))
stop("Unequal sample sizes. Might use wmwpb instead")
x <- cbind(x, y)
}
if (ncol(x) != 2)
stop("Should have bivariate data")
if (na.rm)
x = elimna(x)
if (SEED)
set.seed(2)
data <- matrix(sample(nrow(x), size = nrow(x) * nboot, replace = TRUE),
nrow = nboot)
bvec <- NA
for (i in 1:nboot) bvec[i] <- loc2dif(x[data[i, ], 1], x[data[i,
], 2], est = est, na.rm = na.rm, ...)
bvec <- sort(bvec)
low <- round((alpha/2) * nboot) + 1
up <- nboot - low
temp <- sum(bvec < 0)/nboot + sum(bvec == 0)/(2 * nboot)
sig.level <- 2 * (min(temp, 1 - temp))
list(ci = c(bvec[low], bvec[up]), p.value = sig.level)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.