rotate.pca: Rotate PCA Loadings

View source: R/pca.R

rotate.pcaR Documentation

Rotate PCA Loadings

Description

Apply a specified rotation to the component loadings of a PCA model. This function leverages the GPArotation package to apply orthogonal or oblique rotations.

Usage

## S3 method for class 'pca'
rotate(
  x,
  ncomp,
  type = c("varimax", "quartimax", "promax"),
  loadings_type = c("pattern", "structure"),
  score_method = c("auto", "recompute", "original"),
  ...
)

Arguments

x

A PCA model object, typically created using the pca() function.

ncomp

The number of components to rotate. Must be <= ncomp(x).

type

The type of rotation to apply. Supported rotation types:

"varimax"

Orthogonal Varimax rotation

"quartimax"

Orthogonal Quartimax rotation

"promax"

Oblique Promax rotation

...

Additional arguments passed to GPArotation functions.

Value

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

Examples

# 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")

bbuchsbaum/multivarious documentation built on Dec. 23, 2024, 7:47 a.m.