1 |
x |
|
cor |
|
loadings |
|
SCORES |
|
pval |
|
scree |
|
xlab |
|
ylab |
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, cor = TRUE, loadings = TRUE, SCORES = FALSE, pval = ncol(x),
scree = TRUE, xlab = "Principal Component", ylab = "Proportion of Variance")
{
x <- elimna(x)
temp <- princomp(x, cor = cor, scores = TRUE, scale = scale)
if (!SCORES)
temp <- summary(temp, loadings = loadings)
if (SCORES) {
return(temp$scores)
}
if (scree) {
z = temp$sdev
pv = z^2
cs = pv/sum(pv)
cm = cumsum(cs)
plot(rep(c(1:ncol(x)), 2), c(cs, cm), type = "n", xlab = xlab,
ylab = ylab)
points(c(1:ncol(x)), cs, pch = "*")
lines(c(1:ncol(x)), cs, lty = 1)
points(c(1:ncol(x)), cm, pch = ".")
lines(c(1:ncol(x)), cm, lty = 2)
}
temp
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.