1 | yuend(x, y, tr = 0.2, alpha = 0.05)
|
x |
|
y |
|
tr |
|
alpha |
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 | ##---- 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, tr = 0.2, alpha = 0.05)
{
if (length(x) != length(y))
stop("The number of observations must be equal")
m <- cbind(x, y)
m <- elimna(m)
x <- m[, 1]
y <- m[, 2]
h1 <- length(x) - 2 * floor(tr * length(x))
q1 <- (length(x) - 1) * winvar(x, tr)
q2 <- (length(y) - 1) * winvar(y, tr)
q3 <- (length(x) - 1) * wincor(x, y, tr)$cov
df <- h1 - 1
se <- sqrt((q1 + q2 - 2 * q3)/(h1 * (h1 - 1)))
crit <- qt(1 - alpha/2, df)
dif <- mean(x, tr) - mean(y, tr)
low <- dif - crit * se
up <- dif + crit * se
test <- dif/se
yuend <- 2 * (1 - pt(abs(test), df))
list(ci = c(low, up), p.value = yuend, est1 = mean(x, tr),
est2 = mean(y, tr), dif = dif, se = se, teststat = test,
n = length(x), df = df)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.