# NAG Library Routine Document

## 1Purpose

g03bdf calculates a ProMax rotation, given information following an orthogonal rotation.

## 2Specification

Fortran Interface
 Subroutine g03bdf ( n, m, x, ldx, ro, ldro, fp, ldfp, r, ldr, phi, fs, ldfs,
 Integer, Intent (In) :: n, m, ldx, ldro, ldfp, ldr, ldphi, ldfs Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: x(ldx,m), ro(ldro,m), power Real (Kind=nag_wp), Intent (Inout) :: fp(ldfp,m), r(ldr,m), phi(ldphi,m), fs(ldfs,m) Character (1), Intent (In) :: stand
#include nagmk26.h
 void g03bdf_ (const char *stand, const Integer *n, const Integer *m, const double x[], const Integer *ldx, const double ro[], const Integer *ldro, const double *power, double fp[], const Integer *ldfp, double r[], const Integer *ldr, double phi[], const Integer *ldphi, double fs[], const Integer *ldfs, Integer *ifail, const Charlen length_stand)

## 3Description

Let $X$ and $Y$ denote $n$ by $m$ matrices each representing a set of $n$ points in an $m$-dimensional space. The $X$ matrix is a matrix of loadings as returned by g03baf, that is following an orthogonal rotation of a loadings matrix $Z$. The target matrix $Y$ is calculated as a power transformation of $X$ that preserves the sign of the loadings. Let ${X}_{ij}$ and ${Y}_{ij}$ denote the $\left(i,j\right)$th element of matrices $X$ and $Y$. Given a value greater than one for the exponent $p$:
 $Yij = δij Xij p ,$
for
• $i=1,2,\dots ,n$;
• $j=1,2,\dots ,m$;
• ${\delta }_{ij}=\left\{\begin{array}{c}-1\text{, if ​}{X}_{ij}<0\text{; ​}\\ 1\text{, otherwise.}\end{array}\right\$
The above power transformation tends to increase the difference between high and low values of loadings and is intended to increase the interpretability of a solution.
In the second step a solution of:
 $XW=Y , X,Y ∈ ℝn×m , ​ W ∈ ℝm×m ,$
is found for $W$ in the least squares sense by use of singular value decomposition of the orthogonal loadings $X$. The ProMax rotation matrix $R$ is then given by
 $R=OW W~ , O, ​ W~ ∈ ℝm×m ,$
where $O$ is the rotation matrix from an orthogonal transformation, and $\stackrel{~}{W}$ is a matrix with the square root of diagonal elements of ${\left({W}^{\mathrm{T}}W\right)}^{-1}$ on its diagonal and zeros elsewhere.
The ProMax factor pattern matrix $P$ is given by
 $P = X W W~ , P ∈ ℝn×m ;$
the inter-factor correlations $\Phi$ are given by
 $Φ= QT Q-1 , Φ ∈ ℝm×m ;$
where $Q=W\stackrel{~}{W}$; and the factor structure $S$ is given by
 $S=PΦ , S ∈ ℝn×m .$
Optionally, the rows of target matrix $Y$ can be scaled by the communalities of loadings.
None.

## 5Arguments

1:     $\mathbf{stand}$ – Character(1)Input
${\mathbf{stand}}=\text{'S'}$
Rows of $Y$ are (Kaiser) normalized by the communalities of the loadings.
${\mathbf{stand}}=\text{'U'}$
Rows are not normalized.
Constraint: ${\mathbf{stand}}=\text{'U'}$ or $\text{'S'}$.
2:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of points.
Constraint: ${\mathbf{n}}\ge {\mathbf{m}}$.
3:     $\mathbf{m}$ – IntegerInput
On entry: $m$, the number of dimensions.
Constraint: ${\mathbf{m}}\ge 1$.
4:     $\mathbf{x}\left({\mathbf{ldx}},{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the loadings matrix following an orthogonal rotation, $X$.
5:     $\mathbf{ldx}$ – IntegerInput
On entry: the first dimension of the array x as declared in the (sub)program from which g03bdf is called.
Constraint: ${\mathbf{ldx}}\ge {\mathbf{n}}$.
6:     $\mathbf{ro}\left({\mathbf{ldro}},{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the orthogonal rotation matrix, $O$.
7:     $\mathbf{ldro}$ – IntegerInput
On entry: the first dimension of the array ro as declared in the (sub)program from which g03bdf is called.
Constraint: ${\mathbf{ldro}}\ge {\mathbf{m}}$.
8:     $\mathbf{power}$ – Real (Kind=nag_wp)Input
On entry: $p$, the value of exponent.
Constraint: ${\mathbf{power}}>1.0$.
9:     $\mathbf{fp}\left({\mathbf{ldfp}},{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the factor pattern matrix, $P$.
10:   $\mathbf{ldfp}$ – IntegerInput
On entry: the first dimension of the array fp as declared in the (sub)program from which g03bdf is called.
Constraint: ${\mathbf{ldfp}}\ge {\mathbf{n}}$.
11:   $\mathbf{r}\left({\mathbf{ldr}},{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the ProMax rotation matrix, $R$.
12:   $\mathbf{ldr}$ – IntegerInput
On entry: the first dimension of the array r as declared in the (sub)program from which g03bdf is called.
Constraint: ${\mathbf{ldr}}\ge {\mathbf{m}}$.
13:   $\mathbf{phi}\left({\mathbf{ldphi}},{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the matrix of inter-factor correlations, $\Phi$.
14:   $\mathbf{ldphi}$ – IntegerInput
On entry: the first dimension of the array phi as declared in the (sub)program from which g03bdf is called.
Constraint: ${\mathbf{ldphi}}\ge {\mathbf{m}}$.
15:   $\mathbf{fs}\left({\mathbf{ldfs}},{\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the factor structure matrix, $S$.
16:   $\mathbf{ldfs}$ – IntegerInput
On entry: the first dimension of the array fs as declared in the (sub)program from which g03bdf is called.
Constraint: ${\mathbf{ldfs}}\ge {\mathbf{n}}$.
17:   $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}\ge 1$.
On entry, ${\mathbf{power}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{power}}>1.0$.
On entry, ${\mathbf{stand}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{stand}}=\text{'U'}$ or $\text{'S'}$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{ldfp}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldfp}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{ldfs}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldfs}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{ldphi}}=〈\mathit{\text{value}}〉$ and ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldphi}}\ge {\mathbf{m}}$.
On entry, ${\mathbf{ldr}}=〈\mathit{\text{value}}〉$ and ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldr}}\ge {\mathbf{m}}$.
On entry, ${\mathbf{ldro}}=〈\mathit{\text{value}}〉$ and ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldro}}\ge {\mathbf{m}}$.
On entry, ${\mathbf{ldx}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ldx}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$ and ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge {\mathbf{m}}$.
${\mathbf{ifail}}=20$
SVD failed to converge.
${\mathbf{ifail}}=100$
An internal error has occurred in this routine. Check the routine call and any array sizes. If the call is correct then please contact NAG for assistance.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

## 7Accuracy

The calculations are believed to be stable.

## 8Parallelism and Performance

g03bdf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g03bdf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

None.

## 10Example

This example reads a loadings matrix and calculates a varimax transformation before calculating $P$, $R$ and $\sigma$ for a ProMax rotation.

### 10.1Program Text

Program Text (g03bdfe.f90)

### 10.2Program Data

Program Data (g03bdfe.d)

### 10.3Program Results

Program Results (g03bdfe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017