1 |
x |
|
y |
|
xout |
|
regfun |
|
outfun |
|
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 | ##---- 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, xout = FALSE, regfun = tsreg, outfun = outpro,
nboot = 200, SEED = TRUE, ...)
{
if (SEED)
set.seed(2)
x <- as.matrix(x)
p1 <- ncol(x) + 1
p <- ncol(x)
xy <- cbind(x, y)
xy <- elimna(xy)
x <- xy[, 1:p]
y <- xy[, p1]
nrem = length(y)
estit = regfun(x, y, xout = xout, ...)$coef
if (xout) {
m <- cbind(x, y)
flag <- outfun(x, plotit = FALSE, ...)$keep
m <- m[flag, ]
x <- m[, 1:p]
y <- m[, p1]
}
x <- as.matrix(x)
if (SEED)
set.seed(2)
data <- matrix(sample(length(y), size = length(y) * nboot,
replace = TRUE), nrow = nboot)
bvec <- apply(data, 1, regboot, x, y, regfun, xout = FALSE,
...)
sqe = var(t(bvec))
list(param.estimates = estit, covar = sqe, s.e. = sqrt(diag(sqe)))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.