1 |
J |
|
K |
|
x |
|
JK |
|
grp |
|
con |
|
alpha |
|
dif |
|
pool |
|
bop |
|
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ##---- 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, JK = J * K, grp = c(1:JK), con = 0, alpha = 0.05,
dif = FALSE, pool = FALSE, bop = FALSE, nboot = 100, SEED = TRUE)
{
if (is.matrix(x)) {
y <- list()
for (j in 1:ncol(x)) y[[j]] <- x[, j]
x <- y
}
JK <- J * K
data <- list()
for (j in 1:length(x)) {
data[[j]] <- x[[grp[j]]]
}
x <- data
if (pool) {
data <- list()
m1 <- matrix(c(1:JK), J, K, byrow = T)
for (k in 1:K) {
for (j in 1:J) {
flag <- m1[j, k]
if (j == 1)
temp <- x[[flag]]
if (j > 1) {
temp <- c(temp, x[[flag]])
}
}
data[[k]] <- temp
}
print("Group numbers refer to levels of Factor B")
if (!dif)
temp <- lincdm(data, con = con, alpha = alpha, nboot = nboot,
mop = bop)
if (dif)
temp <- qdmcpdif(data, con = con, alpha = alpha)
return(temp)
}
if (!pool) {
mat <- matrix(c(1:JK), ncol = K, byrow = T)
for (j in 1:J) {
data <- list()
ic <- 0
for (k in 1:K) {
ic <- ic + 1
data[[ic]] <- x[[mat[j, k]]]
}
print(paste("For level ", j, " of Factor A:"))
if (!dif)
temp <- lincdm(data, con = con, alpha = alpha,
nboot = nboot, mop = bop)
if (dif)
temp <- qdmcpdif(data, con = con, alpha = alpha)
print(temp$test)
print(temp$psihat)
}
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.