pcatune
can be used to quickly visualise the proportion of explained variance
for a large number of principal components in PCA.pcatune(X, ncomp = NULL, center = TRUE, scale. = FALSE,
max.iter = 500, tol = 1e-09)
pcatune
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 s
FALSE
for consistency with prcomp
function, but in general scaling is advisable. pcatune
returns a list with class "pcatune"
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
,
plot3dIndiv
, plot3dVar
.data(liver.toxicity)
tune <- pcatune(liver.toxicity$gene, center = TRUE, scale. = TRUE)
Run the code above in your browser using DataLab