# NAG CL Interfaceg03bac (rot_​orthomax)

Settings help

CL Name Style:

## 1Purpose

g03bac computes orthogonal rotations for a matrix of loadings using a generalized orthomax criterion.

## 2Specification

 #include
 void g03bac (Nag_RotationLoading stand, double g, Integer nvar, Integer k, double fl[], Integer tdf, double flr[], double r[], Integer tdr, double acc, Integer maxit, Integer *iter, NagError *fail)
The function may be called by the names: g03bac, nag_mv_rot_orthomax or nag_mv_orthomax.

## 3Description

Let $\Lambda$ be the $p×k$ matrix of loadings from a variable-directed multivariate method, e.g., canonical variate analysis or factor analysis. This matrix represents the relationship between the original $p$ variables and the $k$ orthogonal linear combinations of these variables, the canonical variates or factors. The latter are only unique up to a rotation in the $k$-dimensional space they define. A rotation can then be found that simplifies the structure of the matrix of loadings, and hence the relationship between the original and the derived variables. That is, the elements, ${\lambda }_{ij}^{*}$, of the rotated matrix, ${\Lambda }^{*}$, are either relatively large or small. The rotations may be found by minimizing the criterion:
 $V = ∑ j=1 k ∑ i=1 p ( λ ij * ) 4 - γ p ∑ j=1 k [ ∑ i=1 p ( λ ij * ) 2 ] 2$
where the constant $\gamma$ gives a family of rotations with $\gamma =1$ giving varimax rotations and $\gamma =0$ giving quartimax rotations.
It is generally advised that factor loadings should be standardized, so that the sum of squared elements for each row is one, before computing the rotations.
The matrix of rotations, $R$, such that ${\Lambda }^{*}=\Lambda R$, is computed using first an algorithm based on that described by Cooley and Lohnes (1971), which involves the pairwise rotation of the factors. Then a final refinement is made using a method similar to that described by Lawley and Maxwell (1971), but instead of the eigenvalue decomposition, the algorithm has been adapted to incorporate a singular value decomposition.

## 4References

Cooley W C and Lohnes P R (1971) Multivariate Data Analysis Wiley
Lawley D N and Maxwell A E (1971) Factor Analysis as a Statistical Method (2nd Edition) Butterworths

## 5Arguments

1: $\mathbf{stand}$Nag_RotationLoading Input
On entry: indicates if the matrix of loadings is to be row standardized before rotation.
${\mathbf{stand}}=\mathrm{Nag_RoLoadStand}$
${\mathbf{stand}}=\mathrm{Nag_RoLoadNotStand}$
Constraint: ${\mathbf{stand}}=\mathrm{Nag_RoLoadStand}$ or $\mathrm{Nag_RoLoadNotStand}$.
2: $\mathbf{g}$double Input
On entry: the criterion constant, $\gamma$, with $\gamma =1.0$ giving varimax rotations and $\gamma =0.0$ giving quartimax rotations.
Constraint: ${\mathbf{g}}\ge 0.0$.
3: $\mathbf{nvar}$Integer Input
On entry: the number of original variables, $p$.
Constraint: ${\mathbf{nvar}}\ge {\mathbf{k}}$.
4: $\mathbf{k}$Integer Input
On entry: the number of derived variates or factors, $k$.
Constraint: ${\mathbf{k}}\ge 2$.
5: $\mathbf{fl}\left[{\mathbf{nvar}}×{\mathbf{tdf}}\right]$double Input/Output
On entry: the matrix of loadings, $\Lambda$. ${\mathbf{fl}}\left[\left(\mathit{i}-1\right)×{\mathbf{tdf}}+\mathit{j}-1\right]$ must contain the loading for the $\mathit{i}$th variable on the $\mathit{j}$th factor, for $\mathit{i}=1,2,\dots ,p$ and $\mathit{j}=1,2,\dots ,k$.
On exit: if ${\mathbf{stand}}=\mathrm{Nag_RoLoadStand}$ the elements of fl are standardized so that the sum of squared elements for each row is $1.0$ and then after, the computation of the rotations are rescaled; this may lead to slight differences between the input and output values of fl. If ${\mathbf{stand}}=\mathrm{Nag_RoLoadNotStand}$, fl will be unchanged on exit.
6: $\mathbf{tdf}$Integer Input
On entry: the stride separating matrix column elements in the arrays fl, flr.
Constraint: ${\mathbf{tdf}}\ge {\mathbf{k}}$.
7: $\mathbf{flr}\left[{\mathbf{nvar}}×{\mathbf{tdf}}\right]$double Output
On exit: the rotated matrix of loadings, ${\Lambda }^{*}$. ${\mathbf{flr}}\left[\left(\mathit{i}-1\right)×{\mathbf{tdf}}+\mathit{j}-1\right]$ will contain the rotated loading for the $\mathit{i}$th variable on the $\mathit{j}$th factor, for $\mathit{i}=1,2,\dots ,p$ and $\mathit{j}=1,2,\dots ,k$.
8: $\mathbf{r}\left[{\mathbf{k}}×{\mathbf{tdr}}\right]$double Output
Note: the $\left(i,j\right)$th element of the matrix $R$ is stored in ${\mathbf{r}}\left[\left(i-1\right)×{\mathbf{tdr}}+j-1\right]$.
On exit: the matrix of rotations, $R$.
9: $\mathbf{tdr}$Integer Input
On entry: the stride separating matrix column elements in the array r.
Constraint: ${\mathbf{tdr}}\ge {\mathbf{k}}$.
10: $\mathbf{acc}$double Input
On entry: indicates the accuracy required. The iterative procedure of Cooley and Lohnes (1971) will be stopped and the final refinement computed when the change in $V$ is less than ${\mathbf{acc}}×\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1.0,V\right)$. If acc is greater than or equal to $0.0$ but less than machine precision, or if acc is greater than $1.0$, then machine precision will be used instead.
It is suggested that acc be set to 0.00001.
Constraint: ${\mathbf{acc}}\ge 0.0$.
11: $\mathbf{maxit}$Integer Input
On entry: the maximum number of iterations. It is suggested that maxit be set to 30.
Constraint: ${\mathbf{maxit}}\ge 1$.
12: $\mathbf{iter}$Integer * Output
On exit: the number of iterations performed.
13: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_2_INT_ARG_LT
On entry, ${\mathbf{nvar}}=⟨\mathit{\text{value}}⟩$ while ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$. These arguments must satisfy ${\mathbf{nvar}}\ge {\mathbf{k}}$.
On entry, ${\mathbf{tdf}}=⟨\mathit{\text{value}}⟩$ while ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$. These arguments must satisfy ${\mathbf{tdf}}\ge {\mathbf{k}}$.
On entry, ${\mathbf{tdr}}=⟨\mathit{\text{value}}⟩$ while ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$. These arguments must satisfy ${\mathbf{tdr}}\ge {\mathbf{k}}$.
NE_ACC_ITER
The algorithm to find R has failed to reach the required accuracy in the given number of iterations, $⟨\mathit{\text{value}}⟩$. Try increasing acc or increasing maxit. The returned solution should be a reasonable approximation.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
On entry, argument stand had an illegal value.
NE_INT_ARG_LE
On entry, ${\mathbf{maxit}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{maxit}}>0$.
NE_INT_ARG_LT
On entry, ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{k}}\ge 2$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_REAL_ARG_LT
On entry, acc must not be less than $0.0$: ${\mathbf{acc}}=⟨\mathit{\text{value}}⟩$.
On entry, g must not be less than $0.0$: ${\mathbf{g}}=⟨\mathit{\text{value}}⟩$.
NE_SVD_NOT_CONV
The singular value decomposition has failed to converge. This is an unlikely error exit.

## 7Accuracy

The accuracy is determined by the value of acc.

## 8Parallelism and Performance

g03bac is not threaded in any implementation.

If the results of a principal component analysis as carried out by g03aac are to be rotated, the loadings as returned in the array $p$ by g03aac can be supplied via the argument fl to g03bac. The resulting rotation matrix can then be used to rotate the principal component scores as returned in the array $v$ by g03aac. The function f16yac may be used for this matrix multiplication.

## 10Example

The example is taken from page 75 of Lawley and Maxwell (1971). The results from a factor analysis of ten variables using three factors are input and rotated using varimax rotations without standardizing rows.

### 10.1Program Text

Program Text (g03bace.c)

### 10.2Program Data

Program Data (g03bace.d)

### 10.3Program Results

Program Results (g03bace.r)