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:
|
... |
Additional arguments passed to GPArotation functions. |
A modified PCA object with class rotated_pca
and additional fields:
v |
Rotated loadings |
s |
Rotated scores |
sdev |
Updated standard deviations of rotated components |
explained_variance |
Proportion of explained variance for each rotated component |
rotation |
A list with rotation details: type, R (orth) or Phi (oblique), and loadings_type |
# Perform PCA on 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.