1 |
J |
|
K |
|
x |
|
grp |
|
p |
|
q |
|
bop |
|
alpha |
|
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | ##---- 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, grp = c(1:p), p = J * K, q = 0.5, bop = FALSE,
alpha = 0.05, nboot = 100, SEED = TRUE)
{
Qa <- NA
Qab <- NA
if (is.data.frame(x))
x = as.matrix(x)
if (is.list(x))
x <- elimna(matl(x))
if (is.matrix(x))
x <- elimna(x)
data <- x
if (is.matrix(data))
data <- listm(data)
if (!is.list(data))
stop("Data are not stored in list mode or a matrix")
if (p != length(data)) {
print("The total number of groups, based on the specified levels, is")
print(p)
print("The number of groups stored in x is")
print(length(data))
print("Warning: These two values are not equal")
}
if (p != length(grp))
stop("Apparently a subset of the groups was specified that does not match the total number of groups indicated by the values for J and K.")
tmeans <- 0
Ja <- (J^2 - J)/2
Ka <- (K^2 - K)/2
JK <- J * K
conA <- matrix(0, nrow = JK, ncol = Ja)
ic <- 0
for (j in 1:J) {
for (jj in 1:J) {
if (j < jj) {
ic <- ic + 1
mat <- matrix(0, nrow = J, ncol = K)
mat[j, ] <- 1
mat[jj, ] <- 0 - 1
conA[, ic] <- t(mat)
}
}
}
conB <- matrix(0, nrow = JK, ncol = Ka)
ic <- 0
for (k in 1:K) {
for (kk in 1:K) {
if (k < kk) {
ic <- ic + 1
mat <- matrix(0, nrow = J, ncol = K)
mat[, k] <- 1
mat[, kk] <- 0 - 1
conB[, ic] <- t(mat)
}
}
}
conAB <- matrix(0, nrow = JK, ncol = Ka * Ja)
ic <- 0
for (j in 1:J) {
for (jj in 1:J) {
if (j < jj) {
for (k in 1:K) {
for (kk in 1:K) {
if (k < kk) {
ic <- ic + 1
mat <- matrix(0, nrow = J, ncol = K)
mat[j, k] <- 1
mat[j, kk] <- 0 - 1
mat[jj, k] <- 0 - 1
mat[jj, kk] <- 1
}
conAB[, ic] <- t(mat)
}
}
}
}
}
Qa <- lincdm(x, con = conA, alpha = alpha, mop = bop, nboot = nboot,
SEED = SEED)
Qb <- lincdm(x, con = conB, alpha = alpha, mop = bop, nboot = nboot,
SEED = SEED)
Qab <- lincdm(x, con = conAB, alpha = alpha, mop = bop, nboot = nboot,
SEED = SEED)
list(Qa = Qa, Qb = Qb, Qab = Qab)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.