1 |
J |
|
K |
|
x |
|
tr |
|
grp |
|
p |
|
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 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 (J, K, x, tr = 0.2, grp = c(1:p), p = J * K, nboot = 599,
SEED = TRUE)
{
if (is.data.frame(x))
x = as.matrix(x)
if (is.matrix(x))
x <- listm(x)
if (!is.list(x))
stop("Data must be stored in a matrix or in list mode.")
if (SEED)
set.seed(2)
tests = t2way.no.p(J = J, K = K, x, tr = tr, grp = grp)
TA = NULL
TB = NULL
TAB = NULL
data = list()
xcen = list()
for (j in 1:length(x)) xcen[[j]] <- x[[j]] - mean(x[[j]],
tr)
print("Taking bootstrap samples. Please wait.")
for (b in 1:nboot) {
for (j in 1:length(x)) data[[j]] <- sample(xcen[[j]],
size = length(x[[j]]), replace = TRUE)
bt = t2way.no.p(J, K, data, tr = tr, grp = grp)
TA[b] = bt$Qa
TB[b] = bt$Qb
TAB[b] = bt$Qab
}
pA <- sum(tests$Qa <= TA)/nboot
pB <- sum(tests$Qb <= TB)/nboot
pAB <- sum(tests$Qab <= TAB)/nboot
list(A.p.value = pA, B.p.value = pB, AB.p.value = pAB)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.