1 |
x |
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 | ##---- 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)
{
x = lapply(x, elimna)
vals = lapply(x, unique)
vals = sort(elimna(unique(list2vec(vals))))
n = lapply(x, length)
n = list2vec(n)
K = length(vals)
J = length(x)
C1 = matrix(0, nrow = K, ncol = J)
for (j in 1:J) {
for (i in 1:K) {
C1[i, j] = C1[i, j] + sum(x[[j]] == vals[i])
}
C1[, j] = C1[, j]/n[j]
}
test = 0
for (i in 1:K) test = test + var(C1[i, ])
list(test = test, C1 = C1)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.