1 |
x1 |
|
y1 |
|
x2 |
|
y2 |
|
regfun |
|
pts |
|
nboot |
|
xout |
|
outfun |
|
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 | ##---- 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 (x1, y1, x2, y2, regfun = tsreg, pts = NULL, nboot = 100,
xout = FALSE, outfun = out, SEED = TRUE, ...)
{
X = elimna(cbind(x1, y1, x2, y2))
x1 = as.matrix(x1)
x2 = as.matrix(x2)
p = ncol(x1)
p1 = p + 1
p2 = p + 2
p3 = p1 + p
p4 = p3 + 1
x1 = X[, 1:p]
y1 = X[, p1]
x2 = X[, p2:p3]
y2 = X[, p4]
x1 <- as.matrix(x1)
x2 = as.matrix(x2)
if (is.null(pts)) {
pts = rbind(x1, x2)
pts = unique(pts)
}
pts = as.matrix(pts)
nvpts = nrow(pts)
bvec1 = matrix(NA, nrow = nboot, ncol = nvpts)
bvec2 = matrix(NA, nrow = nboot, ncol = nvpts)
if (SEED)
set.seed(2)
data <- matrix(sample(length(y1), size = length(y1) * nboot,
replace = TRUE), nrow = nboot)
for (ib in 1:nboot) {
bvec1[ib, ] = regYsub(x1[data[ib, ], ], y1[data[ib, ]],
pts, p1 = p1, regfun = regfun, ...)
bvec2[ib, ] = regYsub(x2[data[ib, ], ], y2[data[ib, ]],
pts, p1 = p1, regfun = regfun, ...)
}
bvec = bvec1 - bvec2
sqsd = apply(bvec, 2, var)
sqsd
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.