varimax2: Varimax rotation

View source: R/varimax.R

varimax2R Documentation

Varimax rotation

Description

Varimax rotation

Usage

varimax2(X, normalize = FALSE, reorder = TRUE, rotmat = FALSE)

Arguments

X

A matrix with more rows than columns.

normalize

Whether to apply Kaiser normalization? See stats::varimax. Default is FALSE.

reorder

Whether to permute rotation vectors to maximize the conservation of the order of the initial columns of X. Default is TRUE.

rotmat

Whether to return the rotation matrix rot, or the rotated matrix X %*% rot (the default, FALSE).

Value

Either the rotation matrix rot, or the rotated matrix X %*% rot, depending on rotmat.

Examples

X <- as.matrix(iris[1:4])
X_rot <- varimax2(X)
X_rot2 <- varimax(X, normalize = FALSE)$loadings[]
all.equal(X_rot2, X_rot[, c(3, 2, 1, 4)], check.attributes = FALSE)
varimax2(X, rotmat = TRUE)

X2 <- prcomp(X)$x
X2_rot <- varimax2(X2)
X2_rot2 <- varimax(X2, normalize = FALSE)$loadings[]
all.equal(X2_rot, X2_rot2, check.attributes = FALSE)

bigutilsr documentation built on Aug. 8, 2025, 7:24 p.m.