1 |
x |
|
y |
|
fr |
|
tr |
|
pts |
|
RNA |
|
outfun |
|
xout |
|
SEED |
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 | ##---- 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, fr = 1, tr = 0.2, pts = x, RNA = FALSE, outfun = out,
xout = FALSE, SEED = TRUE)
{
if (SEED)
set.seed(2)
temp <- cbind(x, y)
if (ncol(temp) > 2)
stop(" 1 predictor only is allowed")
temp <- elimna(temp)
if (xout) {
flag <- outfun(x, plotit = FALSE)$keep
temp <- temp[flag, ]
}
x <- temp[, 1]
y <- temp[, 2]
pts <- as.matrix(pts)
vals <- NA
WSE = NA
df = NA
h = NA
for (i in 1:length(pts)) {
ysub = y[near(x, pts[i], fr)]
v = trimse(ysub, tr = tr, na.rm = TRUE)
if (is.na(v))
v = 0
if (v > 0) {
WSE[i] = trimse(ysub, tr = tr, na.rm = TRUE)
df[i] = length(ysub) - 2 * floor(tr * length(ysub)) -
1
}
if (v == 0) {
df[i] = 0
WSE[i] = 0
}
}
list(se = WSE, df = df)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.