1 |
x |
|
y |
|
qval |
|
alpha |
|
xout |
|
outfun |
|
res |
|
method |
|
... |
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, y, qval = 0.5, alpha = 0.05, xout = FALSE, outfun = out,
res = FALSE, method = "br", ...)
{
if (alpha != 0.05)
stop("This function only allows alpha=.05. Use qregci")
library(quantreg)
xx <- cbind(x, y)
p <- ncol(xx) - 1
xx <- elimna(xx)
x <- xx[, 1:p]
y <- xx[, ncol(xx)]
x = as.matrix(x)
if (xout) {
flag <- outfun(x, ...)$keep
x <- x[flag, ]
y <- y[flag]
}
residuals <- NA
if (res)
residuals <- rq(y ~ x)$residuals
temp <- summary(rq(y ~ x, tau = qval, alpha = alpha, method = method))
temp0 <- temp[[4]]
if (is.matrix(temp[[3]]))
temp0 <- temp[[3]]
temp <- temp0
coef <- temp[, 1]
ci <- temp[, 2:3]
list(coef = coef, ci = ci, residuals = residuals)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.