1 |
x |
|
y |
|
qval |
|
xlab |
|
ylab |
|
FIT |
|
pc |
|
plotit |
|
xout |
|
outfun |
|
q |
|
lambda |
|
... |
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 35 36 37 38 39 40 41 42 43 | ##---- 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, xlab = "X", ylab = "Y", FIT = TRUE,
pc = ".", plotit = TRUE, xout = FALSE, outfun = out, q = NULL,
lambda = 0, ...)
{
library(cobs)
if (!is.null(q))
qval = q
x = as.matrix(x)
if (xout) {
flag <- outfun(x, ...)$keep
x <- x[flag, ]
y <- y[flag]
}
yhat = NULL
res = NULL
if (plotit)
plot(x, y, xlab = xlab, ylab = ylab, pch = pc)
if (FIT) {
for (j in 1:length(qval)) {
if (plotit)
lines(predict(cobs(x, y, tau = qval[j], lambda = lambda,
print.mesg = FALSE, print.warn = FALSE)))
}
}
if (!FIT) {
for (j in 1:length(qval)) {
temp = cobs(x, y, tau = qval[j], print.mesg = FALSE,
print.warn = FALSE, lambda = lambda)
xord = order(x)
if (plotit)
lines(x[xord], temp$fitted[xord])
}
if (length(qval) == 1) {
yhat = temp$fitted
}
}
list(yhat = yhat)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.