reflect {ggbiplot} | R Documentation |
Reflect Columns in a Principal Component-like Object
Description
Principle component-like objects have variable loadings (the eigenvectors of the covariance/correlation matrix) whose signs are arbitrary, in the sense that a given column can be reflected (multiplied by -1) without changing the fit.
Usage
reflect(pcobj, columns = 1:2)
Arguments
pcobj |
|
columns |
a vector of indices of the columns to reflect |
Details
This function allows one to reflect any columns of the variable loadings (and corresponding observation scores). Coordinates for quantitative supplementary variables are also reflected if present. This is often useful for interpreting a biplot, for example when a component (often the first) has all negative signs.
Value
The pca-like object with specified columns of the variable loadings and observation scores multiplied by -1.
Author(s)
Michael Friendly
See Also
Examples
data(crime)
crime.pca <-
crime |>
dplyr::select(where(is.numeric)) |>
prcomp(scale. = TRUE)
biplot(crime.pca)
crime.pca <- reflect(crime.pca) # reflect columns 1:2
biplot(crime.pca)
[Package ggbiplot version 0.6.2 Index]