Description Usage Arguments See Also Examples
Compute the percentage bend correlation between x and y.
1 |
x |
|
y |
|
beta |
beta is the bending constant for omega sub N. |
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, beta = 0.2)
{
if (length(x) != length(y))
stop("The vectors do not have equal lengths")
if (sum(is.na(c(x, y))) != 0) {
m1 <- matrix(c(x, y), length(x), 2)
m1 <- elimna(m1)
x <- m1[, 1]
y <- m1[, 2]
}
temp <- sort(abs(x - median(x)))
omhatx <- temp[floor((1 - beta) * length(x))]
temp <- sort(abs(y - median(y)))
omhaty <- temp[floor((1 - beta) * length(y))]
a <- (x - pbos(x, beta))/omhatx
b <- (y - pbos(y, beta))/omhaty
a <- ifelse(a <= -1, -1, a)
a <- ifelse(a >= 1, 1, a)
b <- ifelse(b <= -1, -1, b)
b <- ifelse(b >= 1, 1, b)
pbcor <- sum(a * b)/sqrt(sum(a^2) * sum(b^2))
test <- pbcor * sqrt((length(x) - 2)/(1 - pbcor^2))
sig <- 2 * (1 - pt(abs(test), length(x) - 2))
list(cor = pbcor, test = test, siglevel = sig)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.