1 |
x |
|
y |
|
nboot |
|
SEED |
|
RAD |
|
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 | ##---- 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, nboot = 500, SEED = TRUE, RAD = TRUE, xout = FALSE,
outfun = outpro, ...)
{
if (SEED)
set.seed(2)
m <- elimna(cbind(x, y))
x <- as.matrix(x)
p <- ncol(x)
pp <- p + 1
x <- m[, 1:p]
y <- m[, pp]
if (xout) {
m <- cbind(x, y)
flag <- outfun(x, plotit = FALSE, ...)$keep
m <- m[flag, ]
x <- m[, 1:p]
y <- m[, pp]
}
x <- as.matrix(x)
temp <- lsfit(x, y)
yhat <- mean(y)
res <- y - yhat
test <- sum(temp$coef[2:pp]^2)
if (RAD)
data <- matrix(ifelse(rbinom(length(y) * nboot, 1, 0.5) ==
1, -1, 1), nrow = nboot)
if (!RAD) {
data <- matrix(runif(length(y) * nboot), nrow = nboot)
data <- (data - 0.5) * sqrt(12)
}
rvalb <- apply(data, 1, olstests1, yhat, res, x)
p.val <- sum(rvalb >= test)/nboot
list(p.value = p.val)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.