tune.pca can be used to quickly visualise the proportion of explained variance
for a large number of principal components in PCA.tune.pca(X, ncomp = NULL, center = TRUE, scale = FALSE,
max.iter = 500, tol = 1e-09)tune.pca to choose a final
ncomp for pca. If NULL,
function sets ncomp = min(nrow(X), ncol(X))X can be supplied.
The value is passed to scaFALSE for consistency with prcomp
function, but in general scaling is advisable. Altune.pca returns a list with class "tune.pca" containing the following components:princomp, the print method for these objects prints the results in a nice format and the
plot method produces a bar plot of the percentage of variance explained by the principal
components (PCs).When using NIPALS (missing values), we make the assumption that the first (min(ncol(X), nrow(X))
principal components will account for 100 % of the explained variance.
Note that scale= TRUE cannot be used if there are zero or constant (for center = TRUE) variables.
nipals, biplot,
plotIndiv, plotVar
and http://www.mixOmics.org for more details.data(liver.toxicity)
tune <- tune.pca(liver.toxicity$gene, center = TRUE, scale = TRUE)Run the code above in your browser using DataLab