1 | mlrregWtest(x, y, nboot = 300, MC = FALSE, SEED = TRUE)
|
x |
|
y |
|
nboot |
|
MC |
|
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 | ##---- 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 = 300, MC = FALSE, SEED = TRUE)
{
if (SEED)
set.seed(2)
if (MC)
library(parallel)
estit = mlrreg.subest(y, x)
n = nrow(x)
JK = ncol(x) * ncol(y)
vals = matrix(0, nrow = nboot, ncol = JK)
data = list()
for (i in 1:nboot) {
bsam = sample(n, replace = TRUE)
data[[i]] = y[bsam, ]
}
if (!MC) {
vals = lapply(data, mlrreg.subest, x)
}
if (MC) {
vals = mclapply(data, mlrreg.subest, x, mc.preschedule = TRUE)
}
vals = t(matl(vals))
nullv = rep(0, JK)
vals = rbind(vals, estit)
cen = rep(0, ncol(vals))
if (MC)
dv = pdisMC(vals, center = cen)
if (!MC)
dv = pdis(vals, center = cen)
bplus = nboot + 1
pv = 1 - sum(dv[bplus] >= dv[1:nboot])/nboot
list(p.value = pv)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.