1 |
x |
|
y |
|
nboot |
|
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 | ##---- 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, xout = FALSE, outfun = out)
{
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]
}
n = length(y)
data1 <- matrix(sample(n, size = n * nboot, replace = TRUE),
nrow = nboot)
data2 <- matrix(sample(n, size = n * nboot, replace = TRUE),
nrow = nboot)
val = NA
x = as.matrix(x)
for (i in 1:nboot) {
val[i] = gamplotv2(x[data1[i, ], ], y[data2[i, ]], plotit = FALSE,
pr = FALSE)$Strength.Assoc
}
val = sort(val)
est = gamplotv2(x, y, plotit = FALSE)$Strength.Assoc
p.value = mean((est < val))
p.value
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.