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$p$ by k$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$p$ variables and the k$k$ orthogonal linear combinations of these variables, the canonical variates or factors. The latter are only unique up to a rotation in the k$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, λij * ${\lambda }_{ij}^{*}$, of the rotated matrix, Λ*${\Lambda }^{*}$, are either relatively large or small. The rotations may be found by minimizing the criterion:
kp k
V = (λij * )4γ/p
 ( p ) ∑ (λij * )2 i = 1
2
j = 1i = 1 j = 1
$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 γ = 1$\gamma =1$ giving varimax rotations and γ = 0$\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$R$, such that Λ* = Λ R${\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:     stand – string (length ≥ 1)
Indicates if the matrix of loadings is to be row standardized before rotation.
stand = 'S'${\mathbf{stand}}=\text{'S'}$
stand = 'U'${\mathbf{stand}}=\text{'U'}$
Constraint: stand = 'S'${\mathbf{stand}}=\text{'S'}$ or 'U'$\text{'U'}$.
2:     g – double scalar
γ$\gamma$, the criterion constant with γ = 1.0$\gamma =1.0$ giving varimax rotations and γ = 0.0$\gamma =0.0$ giving quartimax rotations.
Constraint: g0.0${\mathbf{g}}\ge 0.0$.
3:     nvar – int64int32nag_int scalar
p$p$, the number of original variables.
Constraint: ${\mathbf{nvar}}\ge {\mathbf{k}}$.
4:     fl(ldfl,k) – double array
ldfl, the first dimension of the array, must satisfy the constraint ldflnvar$\mathit{ldfl}\ge {\mathbf{nvar}}$.
Λ$\Lambda$, the matrix of loadings. fl(i,j)${\mathbf{fl}}\left(\mathit{i},\mathit{j}\right)$ must contain the loading for the i$\mathit{i}$th variable on the j$\mathit{j}$th factor, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$ and j = 1,2,,k$\mathit{j}=1,2,\dots ,k$.

### Optional Input Parameters

1:     k – int64int32nag_int scalar
Default: The second dimension of the array fl.
k$k$, the number of derived variates or factors.
Constraint: k2${\mathbf{k}}\ge 2$.
2:     acc – double scalar
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$V$ is less than acc × max (1.0,V)${\mathbf{acc}}×\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1.0,V\right)$. If acc is greater than or equal to 0.0$0.0$ but less than machine precision or if acc is greater than 1.0$1.0$, then machine precision will be used instead.
Default: 0.00001$0.00001$.
Constraint: acc0.0${\mathbf{acc}}\ge 0.0$.
3:     maxit – int64int32nag_int scalar
The maximum number of iterations.
Default: 30$30$
Constraint: maxit1${\mathbf{maxit}}\ge 1$.

ldfl ldr wk

### Output Parameters

1:     fl(ldfl,k) – double array
ldflnvar$\mathit{ldfl}\ge {\mathbf{nvar}}$.
If stand = 'S'${\mathbf{stand}}=\text{'S'}$, the elements of fl are standardized so that the sum of squared elements for each row is 1.0$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 stand = 'U'${\mathbf{stand}}=\text{'U'}$, fl will be unchanged on exit.
2:     flr(ldfl,k) – double array
ldflnvar$\mathit{ldfl}\ge {\mathbf{nvar}}$.
The rotated matrix of loadings, Λ*${\Lambda }^{*}$. flr(i,j)${\mathbf{flr}}\left(\mathit{i},\mathit{j}\right)$ will contain the rotated loading for the i$\mathit{i}$th variable on the j$\mathit{j}$th factor, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$ and j = 1,2,,k$\mathit{j}=1,2,\dots ,k$.
3:     r(ldr,k) – double array
ldrk$\mathit{ldr}\ge {\mathbf{k}}$.
The matrix of rotations, R$R$.
4:     iter – int64int32nag_int scalar
The number of iterations performed.
5:     ifail – int64int32nag_int scalar
${\mathrm{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:
ifail = 1${\mathbf{ifail}}=1$
 On entry, k < 2${\mathbf{k}}<2$, or ${\mathbf{nvar}}<{\mathbf{k}}$, or g < 0.0${\mathbf{g}}<0.0$, or ldfl < nvar$\mathit{ldfl}<{\mathbf{nvar}}$, or ldr < k$\mathit{ldr}<{\mathbf{k}}$, or acc < 0.0${\mathbf{acc}}<0.0$, or maxit ≤ 0${\mathbf{maxit}}\le 0$, or stand ≠ 'S'${\mathbf{stand}}\ne \text{'S'}$ or 'U'$\text{'U'}$.
ifail = 2${\mathbf{ifail}}=2$
The singular value decomposition has failed to converge. This is an unlikely error exit.
ifail = 3${\mathbf{ifail}}=3$
The algorithm to find R$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.

## Accuracy

The accuracy is determined by the value of acc.

None.

## Example

```function nag_mv_rot_orthomax_example
stand = 'U';
g = 1;
nvar = int64(10);
fl = [0.788, -0.152, -0.352;
0.874, 0.381, 0.041;
0.814, -0.043, -0.213;
0.798, -0.17, -0.204;
0.641, 0.07, -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];
[flOut, flr, r, iter, ifail] = nag_mv_rot_orthomax(stand, g, nvar, fl)
```
```

flOut =

0.7880   -0.1520   -0.3520
0.8740    0.3810    0.0410
0.8140   -0.0430   -0.2130
0.7980   -0.1700   -0.2040
0.6410    0.0700   -0.0420
0.7550   -0.2980    0.0670
0.7820   -0.2210    0.0280
0.7670   -0.0910    0.3580
0.7330   -0.3840    0.2290
0.7710   -0.1010    0.0710

flr =

0.3293   -0.2888   -0.7590
0.8488   -0.2735   -0.3397
0.4500   -0.3266   -0.6330
0.3450   -0.3965   -0.6566
0.4526   -0.2758   -0.3696
0.2628   -0.6154   -0.4642
0.3322   -0.5614   -0.4854
0.4725   -0.6841   -0.1832
0.2088   -0.7537   -0.3543
0.4229   -0.5135   -0.4089

r =

0.6335   -0.5337   -0.5603
0.7580    0.5733    0.3109
0.1553   -0.6217    0.7677

iter =

7

ifail =

0

```
```function g03ba_example
stand = 'U';
g = 1;
nvar = int64(10);
fl = [0.788, -0.152, -0.352;
0.874, 0.381, 0.041;
0.814, -0.043, -0.213;
0.798, -0.17, -0.204;
0.641, 0.07, -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];
[flOut, flr, r, iter, ifail] = g03ba(stand, g, nvar, fl)
```
```

flOut =

0.7880   -0.1520   -0.3520
0.8740    0.3810    0.0410
0.8140   -0.0430   -0.2130
0.7980   -0.1700   -0.2040
0.6410    0.0700   -0.0420
0.7550   -0.2980    0.0670
0.7820   -0.2210    0.0280
0.7670   -0.0910    0.3580
0.7330   -0.3840    0.2290
0.7710   -0.1010    0.0710

flr =

0.3293   -0.2888   -0.7590
0.8488   -0.2735   -0.3397
0.4500   -0.3266   -0.6330
0.3450   -0.3965   -0.6566
0.4526   -0.2758   -0.3696
0.2628   -0.6154   -0.4642
0.3322   -0.5614   -0.4854
0.4725   -0.6841   -0.1832
0.2088   -0.7537   -0.3543
0.4229   -0.5135   -0.4089

r =

0.6335   -0.5337   -0.5603
0.7580    0.5733    0.3109
0.1553   -0.6217    0.7677

iter =

7

ifail =

0

```