1 |
x |
|
y |
|
fr |
|
est |
|
nmin |
|
pts |
|
plotit |
|
xlab |
|
ylab |
|
SEED |
|
nboot |
|
xout |
|
RNA |
|
atr |
|
scat |
|
pyhat |
|
... |
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 | ##---- 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 = 10, pts = x, plotit = FALSE,
xlab = "X", ylab = "Y", SEED = TRUE, nboot = 40, xout = FALSE,
RNA = TRUE, atr = 0.2, scat = TRUE, pyhat = TRUE, ...)
{
if (SEED)
set.seed(2)
temp <- cbind(x, y)
if (ncol(temp) != 2)
stop("One predictor only is allowed")
temp <- elimna(temp)
if (xout) {
flag <- outfun(temp[, 1], plotit = FALSE)$keep
temp <- temp[flag, ]
x <- temp[, 1]
y <- temp[, 2]
}
flag <- order(x)
x <- x[flag]
y <- y[flag]
mat <- matrix(NA, nrow = nboot, ncol = length(pts))
vals <- NA
for (it in 1:nboot) {
idat <- sample(c(1:length(y)), replace = T)
xx <- temp[idat, 1]
yy <- temp[idat, 2]
mat[it, ] <- rslope(xx, yy, fr = fr, est = est, nmin = nmin,
pts = x, plotit = FALSE)
}
rmd <- apply(mat, 2, mean, na.rm = RNA, tr = atr)
flag <- is.na(rmd)
rmdsm <- lplot(x, rmd, pyhat = TRUE, plotit = plotit)
output <- "Done"
if (pyhat) {
temp <- rep(NA, length(x))
temp[!flag] <- rmdsm$yhat.values
output <- temp
}
output
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.