1 |
x |
|
q |
|
alpha |
|
op |
|
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 | ##---- 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, q = 0.5, alpha = 0.05, op = 1, pr = TRUE)
{
x = elimna(x)
if (pr) {
if (sum(duplicated(x) > 0))
print("Duplicate values detected; use hdpb")
}
if (q <= 0 || q >= 1)
stop("q must be between 0 and 1")
y <- sort(x)
m <- floor(q * length(x) + 0.5)
crit <- qnorm(1 - alpha/2)
qmjci <- vector(mode = "numeric", 2)
se <- NA
if (op == 1)
se <- mjse(x)
if (op == 2) {
if (q != 0.5)
stop("op=2 works only with q=.5")
se <- msmedse(x)
}
if (op == 3)
se <- qse(x, q)
if (is.na(se))
stop("Something is wrong, op should be 1, 2 or 3")
qmjci[1] <- y[m] - crit * se
qmjci[2] <- y[m] + crit * se
qmjci
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.