Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_mv_rot_orthomax (g03ba)

## Purpose

nag_mv_rot_orthomax (g03ba) computes orthogonal rotations for a matrix of loadings using a generalized orthomax criterion.

## Syntax

[fl, flr, r, iter, ifail] = g03ba(stand, g, nvar, fl, 'k', k, 'acc', acc, 'maxit', maxit)
[fl, flr, r, iter, ifail] = nag_mv_rot_orthomax(stand, g, nvar, fl, 'k', k, 'acc', acc, 'maxit', maxit)

## Description

Let $\Lambda$ be the $p$ by $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=1k∑i=1p λij* 4-γp∑j=1k ∑i=1p λ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.

## References

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

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{stand}$ – string (length ≥ 1)
Indicates if the matrix of loadings is to be row standardized before rotation.
${\mathbf{stand}}=\text{'S'}$
${\mathbf{stand}}=\text{'U'}$
Constraint: ${\mathbf{stand}}=\text{'S'}$ or $\text{'U'}$.
2:     $\mathrm{g}$ – double scalar
$\gamma$, the criterion constant with $\gamma =1.0$ giving varimax rotations and $\gamma =0.0$ giving quartimax rotations.
Constraint: ${\mathbf{g}}\ge 0.0$.
3:     $\mathrm{nvar}$int64int32nag_int scalar
$p$, the number of original variables.
Constraint: ${\mathbf{nvar}}\ge {\mathbf{k}}$.
4:     $\mathrm{fl}\left(\mathit{ldfl},{\mathbf{k}}\right)$ – double array
ldfl, the first dimension of the array, must satisfy the constraint $\mathit{ldfl}\ge {\mathbf{nvar}}$.
$\Lambda$, the matrix of loadings. ${\mathbf{fl}}\left(\mathit{i},\mathit{j}\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$.

### Optional Input Parameters

1:     $\mathrm{k}$int64int32nag_int scalar
Default: the second dimension of the array fl.
$k$, the number of derived variates or factors.
Constraint: ${\mathbf{k}}\ge 2$.
2:     $\mathrm{acc}$ – double scalar
Default: $0.00001$.
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.
Constraint: ${\mathbf{acc}}\ge 0.0$.
3:     $\mathrm{maxit}$int64int32nag_int scalar
Default: $30$.
The maximum number of iterations.
Constraint: ${\mathbf{maxit}}\ge 1$.

### Output Parameters

1:     $\mathrm{fl}\left(\mathit{ldfl},{\mathbf{k}}\right)$ – double array
If ${\mathbf{stand}}=\text{'S'}$, 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}}=\text{'U'}$, fl will be unchanged on exit.
2:     $\mathrm{flr}\left(\mathit{ldfl},{\mathbf{k}}\right)$ – double array
The rotated matrix of loadings, ${\Lambda }^{*}$. ${\mathbf{flr}}\left(\mathit{i},\mathit{j}\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$.
3:     $\mathrm{r}\left(\mathit{ldr},{\mathbf{k}}\right)$ – double array
The matrix of rotations, $R$.
4:     $\mathrm{iter}$int64int32nag_int scalar
The number of iterations performed.
5:     $\mathrm{ifail}$int64int32nag_int scalar
${\mathbf{ifail}}={\mathbf{0}}$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

Errors or warnings detected by the function:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{k}}<2$, or ${\mathbf{nvar}}<{\mathbf{k}}$, or ${\mathbf{g}}<0.0$, or $\mathit{ldfl}<{\mathbf{nvar}}$, or $\mathit{ldr}<{\mathbf{k}}$, or ${\mathbf{acc}}<0.0$, or ${\mathbf{maxit}}\le 0$, or ${\mathbf{stand}}\ne \text{'S'}$ or $\text{'U'}$.
${\mathbf{ifail}}=2$
The singular value decomposition has failed to converge. This is an unlikely error exit.
${\mathbf{ifail}}=3$
The algorithm to find $R$ has failed to reach the required accuracy in the given number of iterations. You should try increasing acc or increasing maxit. The returned solution should be a reasonable approximation.
${\mathbf{ifail}}=-99$
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.

## Accuracy

The accuracy is determined by the value of acc.

None.

## Example

This 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.
```function g03ba_example

fprintf('g03ba example results\n\n');

fl = [0.788, -0.152, -0.352;
0.874,  0.381,  0.041;
0.814, -0.043, -0.213;
0.798, -0.170, -0.204;
0.641,  0.070, -0.042;
0.755, -0.298,  0.067;
0.782, -0.221,  0.028;
0.767, -0.091,  0.358;
0.733, -0.384,  0.229;
0.771, -0.101,  0.071];
[n,k] = size(fl);
nvar  = int64(n);

stand = 'U';
g     = 1;

[fl, flr, r, iter, ifail] = g03ba( ...
stand, g, nvar, fl);

matrix = 'General';
diag   = ' ';

[ifail] = x04ca( ...
matrix, diag, flr, mtitle);

fprintf('\n');
mtitle = 'Rotated matrix';
[ifail] = x04ca( ...
matrix, diag, r, mtitle);

```
```g03ba example results

1       2       3
1   0.3293 -0.2888 -0.7590
2   0.8488 -0.2735 -0.3397
3   0.4500 -0.3266 -0.6330
4   0.3450 -0.3965 -0.6566
5   0.4526 -0.2758 -0.3696
6   0.2628 -0.6154 -0.4642
7   0.3322 -0.5614 -0.4854
8   0.4725 -0.6841 -0.1832
9   0.2088 -0.7537 -0.3543
10   0.4229 -0.5135 -0.4089

Rotated matrix
1       2       3
1   0.6335 -0.5337 -0.5603
2   0.7580  0.5733  0.3109
3   0.1553 -0.6217  0.7677
```