selscree | R Documentation |
The function helps selecting the dimension (i.e. nb. components) of a PCA or PLS model by ploting the variability of the scores.
Depending on the following values of argument scree
- "log"
(default): log-eigenvalues are plotted (e.g. Faber et al. 1994). Patterns in eigen-values are often more apparent in the logarithm scale. Eigenvalues associated with eigenvectors that are dominated by noise are expected decaying geometrically (Cangelosi & Goriely 2007) leading to a straight line in the log-scale.
- "eig"
: raw eigenvalues are plotted. For a PCA model, eigenvalues are the output eig
of the fitted model. For a PLS model, they are the variances of the scores T
.
- "split"
: Observation score values (i.e. rows of T
) are plotted.
selscree(fm, ncomp = NULL,
scree = c("log", "eig", "split"),
...)
fm |
A PCA or PLS model (e.g. output of |
ncomp |
The number of components (latent variables) to consider. |
scree |
Type of plot. Possible values are "log" (Default; log-eigenvalues), "eig" (eigenvalues) or "split" (score values). |
... |
Optionnal arguments to pass through function |
A list of outputs, see the examples.
Cangelosi, R., Goriely, A., 2007. Component retention in principal component analysis with application to cDNA microarray data. Biology Direct 2, 2. https://doi.org/10.1186/1745-6150-2-2
Faber, N.M., Buydens, L.M.C., Kateman, G., 1994. Aspects of pseudorank estimation methods based on the eigenvalues of principal component analysis of random matrices. Chemometrics and Intelligent Laboratory Systems 25, 203-226. https://doi.org/10.1016/0169-7439(94)85043-7
data(datoctane)
X <- datoctane$X
## removing outliers
zX <- X[-c(25:26, 36:39), ]
plotsp(zX)
ncomp <- 30
fm <- pca_eigen(zX, ncomp = ncomp)
selscree(fm)
selscree(fm, scree = "eig")
selscree(fm, scree = "split")
z <- selscree(fm, scree = "eig", plot = "none")
z
## Random matrix with uncorrelated structure
n <- 50
p <- 1000
z <- matrix(rnorm(n * p), nrow = n)
fm <- pca_eigenk(z, ncomp = 40)
selscree(fm, plot = "diff")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.