1 |
x |
|
y |
|
plotit |
|
outfun |
|
se |
|
... |
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 = NA, plotit = TRUE, outfun = outbox, se = TRUE,
...)
{
if (is.na(y[1]))
m <- x
if (!is.na(y[1]))
m <- cbind(x, y)
m <- elimna(m)
if (se) {
for (i in 1:ncol(m)) m[, i] <- (m[, i] - median(m[, i]))/mad(m[,
i])
}
iflag <- rep(T, nrow(m))
dval <- 0
for (i in 1:nrow(m)) {
dval[i] <- gvar(m[-i, ])
}
temp2 <- outfun(dval, ...)
if (plotit && ncol(m) == 2) {
x <- m[, 1]
y <- m[, 2]
plot(x, y, type = "n", xlab = "X", ylab = "Y")
points(x[temp2$keep], y[temp2$keep], pch = "*")
if (!is.null(temp2$out.id))
points(x[temp2$out.id], y[temp2$out.id], pch = "o")
}
list(n = temp2$n, out.id = temp2$out.id, keep = temp2$keep,
out.val = m[temp2$out.id, ], depth.values = dval)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.