1 |
x |
|
y |
|
fr |
|
est |
|
nmin |
|
varfun |
|
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 38 39 40 | ##---- 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, est = tmean, nmin = 1, varfun = winvar,
xout = FALSE, outfun = outpro, ...)
{
xy = elimna(cbind(x, y))
if (xout) {
flag = outfun(x, plotit = FALSE)$keep
xy = xy[flag, ]
}
p = ncol(xy)
pm1 = p - 1
x = xy[, 1:pm1]
y = xy[, p]
x = as.matrix(x)
px = ncol(x)
px1 = px + 1
n = nrow(xy)
val = NA
for (i in 1:n) {
if (px == 1)
val[i] = runhat(xy[-i, 1:px], xy[-i, px1], x[i, 1:px],
fr = fr, nmin = nmin, est = est)
if (px > 1)
val[i] = rung3hat(xy[-i, 1:px], xy[-i, px1], pts = t(as.matrix(x[i,
1:px])), fr = fr, est = est, ...)$rmd
}
dif = y - val
dif = elimna(dif)
pe = varfun(dif)
nopre = locCV(y, varfun = varfun, locfun = est, ...)
rat = (nopre - pe)/nopre
str = 0
if (rat > 0)
str = sqrt(rat)
list(str = str, pred.error = pe)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.