1 |
x |
|
y |
|
nboot |
|
plotit |
|
plotop |
|
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ##---- 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, nboot = 200, plotit = TRUE, plotop = FALSE, SEED = TRUE)
{
plotit <- as.logical(plotit)
x <- x[!is.na(x)]
y <- y[!is.na(y)]
if (SEED)
set.seed(2)
crit <- 80.1/(min(length(x), length(y)))^2 + 2.73
m <- matrix(0, 9, 3)
for (i in 1:9) {
q <- i/10
data <- matrix(sample(x, size = length(x) * nboot, replace = TRUE),
nrow = nboot)
bvec <- apply(data, 1, hd, q)
sex <- var(bvec)
data <- matrix(sample(y, size = length(y) * nboot, replace = TRUE),
nrow = nboot)
bvec <- apply(data, 1, hd, q)
sey <- var(bvec)
dif <- hd(y, q) - hd(x, q)
m[i, 3] <- dif
m[i, 1] <- dif - crit * sqrt(sex + sey)
m[i, 2] <- dif + crit * sqrt(sex + sey)
}
dimnames(m) <- list(NULL, c("ci.lower", "ci.upper", "Delta.hat"))
if (plotit) {
if (plotop) {
xaxis <- c(1:9)/10
xaxis <- c(xaxis, xaxis)
}
if (!plotop)
xaxis <- c(deciles(x), deciles(x))
par(pch = "+")
yaxis <- c(m[, 1], m[, 2])
if (!plotop)
plot(xaxis, yaxis, ylab = "delta", xlab = "x (first group)")
if (plotop)
plot(xaxis, yaxis, ylab = "delta", xlab = "Deciles")
par(pch = "*")
if (!plotop)
points(deciles(x), m[, 3])
if (plotop)
points(c(1:9)/10, m[, 3])
}
m
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.