1 |
x |
|
pts |
|
fr |
|
MM |
|
MC |
|
STAND |
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 | ##---- 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, pts = x, fr = 1, MM = FALSE, MC = FALSE, STAND = TRUE)
{
x <- as.matrix(x)
pts <- as.matrix(pts)
if (ncol(x) > 1) {
if (STAND) {
x = standm(x)
m1 = apply(x, 1, mean)
v = apply(x, 1, sd)
for (j in 1:ncol(x)) pts[, j] = (pts[, j] - m1[j])/v[j]
}
}
outmat <- matrix(NA, ncol = nrow(x), nrow = nrow(pts))
for (i in 1:nrow(pts)) {
center <- pts[i, ]
if (!MC)
blob <- pdis(x, center = center, MM = MM)
if (MC)
blob <- pdisMC(x, center = center, MM = MM)
flag2 <- (blob < fr)
outmat[i, ] <- flag2
}
outmat
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.