1 |
x |
|
y |
|
q |
|
xout |
|
outfun |
|
plotit |
|
... |
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 | ##---- 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, q = 0.5, xout = FALSE, outfun = outpro, plotit = FALSE,
...)
{
X = cbind(x, y)
X = elimna(X)
x <- as.matrix(x)
p = ncol(x)
x = X[, 1:p]
p1 = p + 1
y = X[, p1]
if (xout) {
x <- as.matrix(x)
flag <- outfun(x, plotit = plotit, ...)$keep
x <- x[flag, ]
y <- y[flag]
x <- as.matrix(x)
X = cbind(x, y)
}
est = qreg(x, y, q = q)$coef
top = qreg.sub(X, est, qval = q)
null = hd(y, q)
v = c(null, rep(0, p))
bot = qreg.sub(X, v, qval = q)
ce = sqrt(1 - top/bot)
if (p == 1)
ce = sign(est[2]) * ce
list(cor = ce)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.