1 |
x |
|
y |
|
fr |
|
est |
|
xlab |
|
ylab |
|
pts |
|
RNA |
|
atr |
|
pyhat |
|
eout |
|
outfun |
|
plotit |
|
xout |
|
scat |
|
nboot |
|
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | ##---- 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, xlab = "X", ylab = "Y",
pts = x, RNA = FALSE, atr = 0, pyhat = FALSE, eout = FALSE,
outfun = out, plotit = TRUE, xout = FALSE, scat = TRUE, nboot = 40,
SEED = TRUE, ...)
{
if (SEED)
set.seed(2)
temp <- cbind(x, y)
if (ncol(temp) > 2)
stop("Use run3bo with more than 1 predictor")
temp <- elimna(temp)
if (eout && xout)
stop("Not allowed to have eout=xout=T")
if (eout) {
flag <- outfun(temp, plotit = FALSE)$keep
temp <- temp[flag, ]
}
if (xout) {
flag <- outfun(x, plotit = FALSE)$keep
temp <- temp[flag, ]
}
x <- temp[, 1]
y <- temp[, 2]
pts <- as.matrix(pts)
mat <- matrix(NA, nrow = nboot, ncol = nrow(pts))
vals <- NA
for (it in 1:nboot) {
idat <- sample(c(1:length(y)), replace = TRUE)
xx <- temp[idat, 1]
yy <- temp[idat, 2]
mat[it, ] <- runhat(xx, yy, pts = pts, est = est, fr = fr,
...)
}
rmd <- apply(mat, 2, mean, na.rm = RNA, tr = atr)
if (plotit) {
if (scat) {
plot(c(x, x), c(y, rmd), xlab = xlab, ylab = ylab,
type = "n")
points(x, y)
}
if (!scat)
plot(c(x, x), c(y, rmd), type = "n", xlab = xlab,
ylab = ylab)
points(x, rmd, type = "n")
sx <- sort(x)
xorder <- order(x)
sysm <- rmd[xorder]
lines(sx, sysm)
}
output = "Done"
if (pyhat)
output <- rmd
output
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.