1 |
x |
|
y |
|
alpha |
|
nboot |
|
est |
|
SEED |
|
pr |
|
... |
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, alpha = 0.05, nboot = 2000, est = onestep, SEED = TRUE,
pr = FALSE, ...)
{
library(parallel)
x <- x[!is.na(x)]
y <- y[!is.na(y)]
if (SEED)
set.seed(2)
if (pr)
print("Taking bootstrap samples. Please wait.")
datax <- matrix(sample(x, size = length(x) * nboot, replace = TRUE),
nrow = nboot)
datay <- matrix(sample(y, size = length(y) * nboot, replace = TRUE),
nrow = nboot)
datax = t(datax)
datay = t(datay)
datax = listm(datax)
datay = listm(datay)
bvecx <- mclapply(datax, est, mc.preschedule = TRUE, ...)
bvecy <- mclapply(datay, est, mc.preschedule = TRUE, ...)
bvec = sort(matl(bvecx) - matl(bvecy))
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))
se <- var(bvec)
list(est.1 = est(x, ...), est.2 = est(y, ...), ci = c(bvec[low],
bvec[up]), p.value = sig.level, sq.se = se, n1 = length(x),
n2 = length(y))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.