1 |
x |
|
alpha |
|
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 36 37 38 39 | ##---- 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, alpha = 0.05, pr = FALSE)
{
x = elimna(x)
if (pr) {
if (sum(duplicated(x) > 0))
print("Duplicate values detected; hdpb might have more power")
}
k <- qbinom(alpha/2, length(x), 0.5)
gk <- pbinom(length(x) - k, length(x), 0.5) - pbinom(k -
1, length(x), 0.5)
if (gk >= 1 - alpha) {
gkp1 <- pbinom(length(x) - k - 1, length(x), 0.5) - pbinom(k,
length(x), 0.5)
kp <- k + 1
}
if (gk < 1 - alpha) {
k <- k - 1
gk <- pbinom(length(x) - k, length(x), 0.5) - pbinom(k -
1, length(x), 0.5)
gkp1 <- pbinom(length(x) - k - 1, length(x), 0.5) - pbinom(k,
length(x), 0.5)
kp <- k + 1
}
xsort <- sort(x)
nmk <- length(x) - k
nmkp <- nmk + 1
ival <- (gk - 1 + alpha)/(gk - gkp1)
lam <- ((length(x) - k) * ival)/(k + (length(x) - 2 * k) *
ival)
low <- lam * xsort[kp] + (1 - lam) * xsort[k]
hi <- lam * xsort[nmk] + (1 - lam) * xsort[nmkp]
sint <- c(low, hi)
sint
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.