1 |
x |
|
y |
|
est |
|
qval |
|
sm |
|
plotit |
|
pyhat |
|
fr |
|
nboot |
|
xlab |
|
ylab |
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 | ##---- 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, est = hd, qval = 0.5, sm = TRUE, plotit = TRUE,
pyhat = FALSE, fr = 0.8, nboot = 40, xlab = "X", ylab = "Y")
{
x <- as.matrix(x)
X <- cbind(x, y)
X <- elimna(X)
np <- ncol(X)
p <- np - 1
x <- X[, 1:p]
x <- as.matrix(x)
y <- X[, np]
vals <- matrix(NA, ncol = length(y), nrow = length(qval))
for (i in 1:length(qval)) {
if (sm)
vals[i, ] <- rplotsm(x, y, est = est, q = qval[i],
pyhat = TRUE, plotit = FALSE, fr = fr, nboot = nboot)$yhat
if (!sm)
vals[i, ] <- rungen(x, y, est = est, q = qval[i],
pyhat = TRUE, plotit = FALSE, fr = fr)$output
}
if (p == 1) {
if (plotit) {
plot(x, y, xlab = xlab, ylab = ylab)
for (i in 1:length(qval)) {
sx <- sort(x)
xorder <- order(x)
sysm <- vals[i, ]
lines(sx, sysm[xorder])
}
}
}
output <- "Done"
if (pyhat)
output <- vals
output
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.