reflect | R Documentation |
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.
reflect(pcobj, columns = 1:2)
pcobj |
an object returned by |
columns |
a vector of indices of the columns to reflect |
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.
The pca-like object with specified columns of the variable loadings and observation scores multiplied by -1.
Michael Friendly
prcomp
, princomp
,
PCA
, lda
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.