get_SVD {ggbiplot} | R Documentation |
Extract the SVD components from a PCA-like object
Description
Biplots are based on the Singular Value Decomposition, which for a data matrix is
\mathbf{X} / \sqrt{n} = \mathbf{U} \mathbf{D} \mathbf{V}^T
but these are computed and returned in quite different forms by various PCA-like methods. This function provides a common interface, returning the components with standard names.
Usage
get_SVD(pcobj)
Arguments
pcobj |
an object returned by |
Value
A list of four elements
- n
The sample size on which the analysis was based
- U
Left singular vectors, giving observation scores
- D
vector of singular values, the diagonal elements of the matrix
\mathbf{D}
, which are also the square roots of the eigenvalues of\mathbf{X} \mathbf{X}'
- V
Right singular vectors, giving variable loadings
Examples
data(crime)
crime.pca <-
crime |>
dplyr::select(where(is.numeric)) |>
prcomp(scale. = TRUE)
crime.svd <- get_SVD(crime.pca)
names(crime.svd)
crime.svd$D
[Package ggbiplot version 0.6.2 Index]