regpca:

Usage Arguments Examples

Usage

1
regpca(x, cor = TRUE, loadings = TRUE, SCORES = FALSE, pval = ncol(x), scree = TRUE, xlab = "Principal Component", ylab = "Proportion of Variance")

Arguments

x
cor
loadings
SCORES
pval
scree
xlab
ylab

Examples

 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
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.