Skip to contents

The percentages come from the component standard deviations (pca_model$sdev), as in pca_scree_plot, and are shares of the total variance. A fit truncated with rank. or tol still stores every standard deviation, so all components are shown.

Usage

pca_percent_var_explained(pca_model)

Arguments

pca_model

A prcomp object or cbe_pca object from run_pca.

Value

A ggplot object showing per-component and cumulative variance explained.

Examples

pca_model <- prcomp(mtcars, center = TRUE, scale. = TRUE)
pca_percent_var_explained(pca_model)