rotate.pca | R Documentation |
Apply a specified rotation to the component loadings of a PCA model. This function leverages the GPArotation package to apply orthogonal or oblique rotations.
## S3 method for class 'pca'
rotate(
x,
ncomp,
type = c("varimax", "quartimax", "promax"),
loadings_type = c("pattern", "structure"),
score_method = c("auto", "recompute", "original"),
...
)
x |
A PCA model object, typically created using the |
ncomp |
The number of components to rotate. Must be <= ncomp(x). |
type |
The type of rotation to apply. Supported rotation types:
|
loadings_type |
For oblique rotations, which loadings to use:
Ignored for orthogonal rotations. |
score_method |
How to recompute scores after rotation:
For oblique rotations, recompute from the pseudoinverse.
|
... |
Additional arguments passed to GPArotation functions. |
A modified PCA object with class rotated_pca
and additional fields:
Rotated loadings
Rotated scores
Updated standard deviations of rotated components
Proportion of explained variance for each rotated component
A list with rotation details: type
, R
(orth) or Phi
(oblique), and loadings_type
# Perform PCA on the iris dataset
data(iris)
X <- as.matrix(iris[,1:4])
res <- pca(X, ncomp=4)
# Apply varimax rotation to the first 3 components
rotated_res <- rotate(res, ncomp=3, type="varimax")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.