1 |
x |
|
y |
|
a1 |
|
a2 |
|
xout |
|
outfun |
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, a1 = 0.1, a2, xout = FALSE, outfun = outpro)
{
library(quantreg)
x <- as.matrix(x)
p1 <- ncol(x) + 1
p <- ncol(x)
xy <- cbind(x, y)
xy <- elimna(xy)
x <- xy[, 1:p]
y <- xy[, p1]
if (xout) {
m <- cbind(x, y)
flag <- outfun(x, plotit = FALSE, ...)$keep
m <- m[flag, ]
x <- m[, 1:p]
y <- m[, p1]
}
n = length(y)
xx = cbind(rep(1, n), x)
z <- rq.fit.br(xx, y, tau = -1)
res = trq.fit(x, y, z = z, a1 = a1, a2)
coef = res$coef[1:p1]
list(coef = coef)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.