1 | Ppca.summary(x, MC = FALSE, SCALE = TRUE, p = NULL)
|
x |
|
MC |
|
SCALE |
|
p |
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 | ##---- 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, MC = FALSE, SCALE = TRUE, p = NULL)
{
x = as.matrix(x)
if (!is.matrix(x))
stop("x should be a matrix")
x = elimna(x)
gv = NA
if (is.null(p))
p = ncol(x)
if (!MC)
for (j in 1:p) gv[j] = Ppca(x, p = j, pr = FALSE, SCALE = SCALE)$gen.sd
if (MC) {
library(parallel)
y = list()
for (j in 1:p) y[[j]] = j
gv = mclapply(y, Ppca.sum.sub, x, SCALE = SCALE, mc.preschedule = TRUE)
gv = as.vector(matl(gv))
}
res = matrix(NA, nrow = 3, ncol = p)
res[1, ] = c(1:p)
res[2, ] = gv
res[3, ] = gv/max(gv)
dimnames(res) = list(c("Num. of Comp.", "Gen.Stand.Dev",
"Relative Size"), NULL)
list(summary = res)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.