1 |
x1 |
|
y1 |
|
x2 |
|
y2 |
|
xlab |
|
ylab |
|
qval |
|
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 30 31 32 33 34 35 36 37 | ##---- 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 (x1, y1, x2, y2, xlab = "X", ylab = "Y", qval = 0.5,
xout = FALSE, outfun = out, ...)
{
if (xout) {
flag <- outfun(x1, ...)$keep
x1 <- x1[flag]
y1 <- y1[flag]
flag <- outfun(x2, ...)$keep
x2 <- x2[flag]
y2 <- y2[flag]
}
library(cobs)
xy = elimna(cbind(x1, y1))
x1 = xy[, 1]
xord = order(x1)
x1 = x1[xord]
y1 = xy[xord, 2]
xy = elimna(cbind(x2, y2))
x2 = xy[, 1]
xord = order(x2)
x2 = x2[xord]
y2 = xy[xord, 2]
plot(c(x1, x2), c(y1, y2), type = "n", xlab = xlab, ylab = ylab)
temp1 = cobs(x1, y1, print.mesg = FALSE, print.warn = FALSE,
tau = qval)
temp2 = cobs(x2, y2, print.mesg = FALSE, print.warn = FALSE,
tau = qval)
points(x1, y1)
points(x2, y2, pch = "+")
lines(x1, temp1$fitted)
lines(x2, temp2$fitted, lty = 2)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.