# rotatefactors

## Syntax

```B = rotatefactors(A) B = rotatefactors(A,'Method','orthomax','Coeff',gamma) B = rotatefactors(A,'Method','procrustes','Target',target) B = rotatefactors(A,'Method','pattern','Target',target) B = rotatefactors(A,'Method','promax') [B,T] = rotatefactors(A,...) ```

## Description

`B = rotatefactors(A)` rotates the d-by-m loadings matrix `A` to maximize the varimax criterion, and returns the result in `B`. Rows of `A` and `B` correspond to variables and columns correspond to factors, for example, the (i, j)th element of `A` is the coefficient for the i th variable on the j th factor. The matrix `A` usually contains principal component coefficients created with `pca` or `pcacov`, or factor loadings estimated with `factoran`.

`B = rotatefactors(A,'Method','orthomax','Coeff',gamma)` rotates `A` to maximize the orthomax criterion with the coefficient `gamma`, i.e., `B` is the orthogonal rotation of `A` that maximizes

`sum(D*sum(B.^4,1) - GAMMA*sum(B.^2,1).^2)`

The default value of 1 for `gamma` corresponds to varimax rotation. Other possibilities include `gamma` = 0, m/2, and d(m - 1)/(d + m - 2), corresponding to quartimax, equamax, and parsimax. You can also supply `'varimax'`, `'quartimax'`, `'equamax'`, or `'parsimax'` for the `'method'` parameter and omit the `'Coeff'` parameter.

If `'Method'` is `'orthomax'`, `'varimax'`, `'quartimax'`, `'equamax'`, or `'parsimax'`, then additional parameters are

• `'Normalize'` — Flag indicating whether the loadings matrix should be row-normalized for rotation. If `'on'` (the default), rows of `A` are normalized prior to rotation to have unit Euclidean norm, and unnormalized after rotation. If `'off'`, the raw loadings are rotated and returned.

• `'Reltol'` — Relative convergence tolerance in the iterative algorithm used to find `T`. The default is `sqrt(eps)`.

• `'Maxit'` — Iteration limit in the iterative algorithm used to find `T`. The default is `250`.

`B = rotatefactors(A,'Method','procrustes','Target',target)` performs an oblique procrustes rotation of `A` to the d-by-m target loadings matrix `target`.

`B = rotatefactors(A,'Method','pattern','Target',target)` performs an oblique rotation of the loadings matrix `A` to the d-by-m target pattern matrix `target`, and returns the result in `B`. `target` defines the "restricted" elements of `B`, i.e., elements of `B` corresponding to zero elements of `target` are constrained to have small magnitude, while elements of `B` corresponding to nonzero elements of `target` are allowed to take on any magnitude.

If `'Method'` is `'procrustes'` or `'pattern'`, an additional parameter is `'Type'`, the type of rotation. If `'Type'` is `'orthogonal'`, the rotation is orthogonal, and the factors remain uncorrelated. If `'Type'` is `'oblique'` (the default), the rotation is oblique, and the rotated factors might be correlated.

When `'Method'` is `'pattern'`, there are restrictions on `target`. If `A` has m columns, then for orthogonal rotation, the jth column of `target` must contain at least m - j zeros. For oblique rotation, each column of `target` must contain at least m - 1 zeros.

`B = rotatefactors(A,'Method','promax')` rotates A to maximize the promax criterion, equivalent to an oblique Procrustes rotation with a target created by an orthomax rotation. Use the four orthomax parameters to control the orthomax rotation used internally by promax.

An additional parameter for 'promax' is `'Power'`, the exponent for creating promax target matrix. `'Power'` must be `1` or greater. The default is `4`.

`[B,T] = rotatefactors(A,...)` returns the rotation matrix `T` used to create `B`, that is, `B = A*T`. You can find the correlation matrix of the rotated factors by using `inv(T'*T)`. For orthogonal rotation, this is the identity matrix, while for oblique rotation, it has unit diagonal elements but nonzero off-diagonal elements.

## Examples

```rng('default') % for reproducibility X = randn(100,10); % Default (normalized varimax) rotation: % first three principal components. LPC = pca(X); [L1,T] = rotatefactors(LPC(:,1:3)); % Equamax rotation: % first three principal components. [L2,T] = rotatefactors(LPC(:,1:3),... 'method','equamax'); % Promax rotation: % first three factors. LFA = factoran(X,3,'Rotate','none'); [L3,T] = rotatefactors(LFA(:,1:3),... 'method','promax',... 'power',2); % Pattern rotation: % first three factors. Tgt = [1 1 1 1 1 0 1 0 1 1; ... 0 0 0 1 1 1 0 0 0 0; ... 1 0 0 1 0 1 1 1 1 0]'; [L4,T] = rotatefactors(LFA(:,1:3),... 'method','pattern',... 'target',Tgt); inv(T'*T) % Correlation matrix of the rotated factors ans = 1.0000 -0.9593 -0.7098 -0.9593 1.0000 0.5938 -0.7098 0.5938 1.0000 ```

## References

 Harman, H. H. Modern Factor Analysis. 3rd ed. Chicago: University of Chicago Press, 1976.

 Lawley, D. N., and A. E. Maxwell. Factor Analysis as a Statistical Method. 2nd ed. New York: American Elsevier Publishing, 1971.