1 |
x |
|
y |
|
tr |
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 | ##---- 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 = NULL, tr = 0.2)
{
if (is.null(y[1])) {
y = x[, 2]
x = x[, 1]
}
sig <- NA
if (length(x) != length(y))
stop("Lengths of vectors are not equal")
m1 = cbind(x, y)
m1 <- elimna(m1)
nval = nrow(m1)
x <- m1[, 1]
y <- m1[, 2]
g <- floor(tr * length(x))
xvec <- winval(x, tr)
yvec <- winval(y, tr)
wcor <- cor(xvec, yvec)
wcov <- var(xvec, yvec)
if (sum(x == y) != length(x)) {
test <- wcor * sqrt((length(x) - 2)/(1 - wcor^2))
sig <- 2 * (1 - pt(abs(test), length(x) - 2 * g - 2))
}
list(cor = wcor, cov = wcov, p.value = sig, n = nval)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.