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_factor (g03ca)

## Purpose

nag_mv_factor (g03ca) computes the maximum likelihood estimates of the parameters of a factor analysis model. Either the data matrix or a correlation/covariance matrix may be input. Factor loadings, communalities and residual correlations are returned.

## Syntax

[e, stat, com, psi, res, fl, ifail] = g03ca(matrix, n, x, nvar, isx, nfac, iop, 'm', m, 'wt', wt)
[e, stat, com, psi, res, fl, ifail] = nag_mv_factor(matrix, n, x, nvar, isx, nfac, iop, 'm', m, 'wt', wt)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 24: drop weight, wt optional
.

## Description

Let p$p$ variables, x1,x2,,xp${x}_{1},{x}_{2},\dots ,{x}_{p}$, with variance-covariance matrix Σ$\Sigma$ be observed. The aim of factor analysis is to account for the covariances in these p$p$ variables in terms of a smaller number, k$k$, of hypothetical variables, or factors, f1,f2,,fk${f}_{1},{f}_{2},\dots ,{f}_{k}$. These are assumed to be independent and to have unit variance. The relationship between the observed variables and the factors is given by the model:
 k xi = ∑ λijfj + ei,  i = 1,2, … ,p j = 1
$xi=∑j=1kλijfj+ei, i=1,2,…,p$
where λij${\lambda }_{\mathit{i}\mathit{j}}$, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$ and j = 1,2,,k$\mathit{j}=1,2,\dots ,k$, are the factor loadings and ei${e}_{\mathit{i}}$, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$, are independent random variables with variances ψi${\psi }_{\mathit{i}}$, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$. The ψi${\psi }_{i}$ represent the unique component of the variation of each observed variable. The proportion of variation for each variable accounted for by the factors is known as the communality. For this function it is assumed that both the k$k$ factors and the ei${e}_{i}$'s follow independent Normal distributions.
The model for the variance-covariance matrix, Σ$\Sigma$, can be written as:
 Σ = ΛΛT + Ψ $Σ=ΛΛT+Ψ$ (1)
where Λ$\Lambda$ is the matrix of the factor loadings, λij${\lambda }_{ij}$, and Ψ$\Psi$ is a diagonal matrix of unique variances, ψi${\psi }_{\mathit{i}}$, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$.
The estimation of the parameters of the model, Λ$\Lambda$ and Ψ$\Psi$, by maximum likelihood is described by Lawley and Maxwell (1971). The log-likelihood is:
 − (1/2)(n − 1)log(|Σ|) − (1/2)(n − 1)trace(S,Σ − 1) + constant, $-12(n-1)log(|Σ|)-12(n-1)trace(S,Σ-1)+constant,$
where n$n$ is the number of observations, S$S$ is the sample variance-covariance matrix or, if weights are used, S$S$ is the weighted sample variance-covariance matrix and n$n$ is the effective number of observations, that is, the sum of the weights. The constant is independent of the parameters of the model. A two stage maximization is employed. It makes use of the function F(Ψ)$F\left(\Psi \right)$, which is, up to a constant, 2 / (n1)$-2/\left(n-1\right)$ times the log-likelihood maximized over Λ$\Lambda$. This is then minimized with respect to Ψ$\Psi$ to give the estimates, Ψ̂$\stackrel{^}{\Psi }$, of Ψ$\Psi$. The function F(Ψ)$F\left(\Psi \right)$ can be written as:
 p F(Ψ) = ∑ (θj − logθj) − (p − k) j = k + 1
$F(Ψ)=∑j=k+1p(θj-log⁡θj)-(p-k)$
where values θj${\theta }_{\mathit{j}}$, for j = 1,2,,p$\mathit{j}=1,2,\dots ,p$ are the eigenvalues of the matrix:
 S* = Ψ − 1 / 2SΨ − 1 / 2. $S*=Ψ-1/2SΨ-1/2.$
The estimates Λ̂$\stackrel{^}{\Lambda }$, of Λ$\Lambda$, are then given by scaling the eigenvectors of S*${S}^{*}$, which are denoted by V$V$:
 Λ̂ = Ψ1 / 2V(Θ − I)1 / 2. $Λ^=Ψ1/2V(Θ-I)1/2.$
where Θ$\Theta$ is the diagonal matrix with elements θi${\theta }_{i}$, and I$I$ is the identity matrix.
The minimization of F(Ψ)$F\left(\Psi \right)$ is performed using nag_opt_bounds_mod_deriv2_comp (e04lb) which uses a modified Newton algorithm. The computation of the Hessian matrix is described by Clark (1970). However, instead of using the eigenvalue decomposition of the matrix S*${S}^{*}$ as described above, the singular value decomposition of the matrix RΨ1 / 2$R{\Psi }^{-1/2}$ is used, where R$R$ is obtained either from the QR$QR$ decomposition of the (scaled) mean centred data matrix or from the Cholesky decomposition of the correlation/covariance matrix. The function nag_opt_bounds_mod_deriv2_comp (e04lb) ensures that the values of ψi${\psi }_{i}$ are greater than a given small positive quantity, δ$\delta$, so that the communality is always less than one. This avoids the so called Heywood cases.
In addition to the values of Λ$\Lambda$, Ψ$\Psi$ and the communalities, nag_mv_factor (g03ca) returns the residual correlations, i.e., the off-diagonal elements of C(ΛΛT + Ψ)$C-\left(\Lambda {\Lambda }^{\mathrm{T}}+\Psi \right)$ where C$C$ is the sample correlation matrix. nag_mv_factor (g03ca) also returns the test statistic:
 χ2 = [n − 1 − (2p + 5) / 6 − 2k / 3]F(Ψ̂) $χ2=[n-1-(2p+5)/6-2k/3]F(Ψ^)$
which can be used to test the goodness-of-fit of the model (1), see Lawley and Maxwell (1971) and Morrison (1967).

## References

Clark M R B (1970) A rapidly convergent method for maximum likelihood factor analysis British J. Math. Statist. Psych.
Hammarling S (1985) The singular value decomposition in multivariate statistics SIGNUM Newsl. 20(3) 2–25
Lawley D N and Maxwell A E (1971) Factor Analysis as a Statistical Method (2nd Edition) Butterworths
Morrison D F (1967) Multivariate Statistical Methods McGraw–Hill

## Parameters

### Compulsory Input Parameters

1:     matrix – string (length ≥ 1)
Selects the type of matrix on which factor analysis is to be performed.
matrix = 'D'${\mathbf{matrix}}=\text{'D'}$
The data matrix will be input in x and factor analysis will be computed for the correlation matrix.
matrix = 'S'${\mathbf{matrix}}=\text{'S'}$
The data matrix will be input in x and factor analysis will be computed for the covariance matrix, i.e., the results are scaled as described in Section [Further Comments].
matrix = 'C'${\mathbf{matrix}}=\text{'C'}$
The correlation/variance-covariance matrix will be input in x and factor analysis computed for this matrix.
Constraint: matrix = 'D'${\mathbf{matrix}}=\text{'D'}$, 'S'$\text{'S'}$ or 'C'$\text{'C'}$.
2:     n – int64int32nag_int scalar
If matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$ the number of observations in the data array x.
If matrix = 'C'${\mathbf{matrix}}=\text{'C'}$ the (effective) number of observations used in computing the (possibly weighted) correlation/variance-covariance matrix input in x.
Constraint: ${\mathbf{n}}>{\mathbf{nvar}}$.
3:     x(ldx,m) – double array
ldx, the first dimension of the array, must satisfy the constraint
• if matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$, ldxn$\mathit{ldx}\ge {\mathbf{n}}$;
• if matrix = 'C'${\mathbf{matrix}}=\text{'C'}$, ldxm$\mathit{ldx}\ge {\mathbf{m}}$.
The input matrix.
If matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$, x must contain the data matrix, i.e., x(i,j)${\mathbf{x}}\left(\mathit{i},\mathit{j}\right)$ must contain the i$\mathit{i}$th observation for the j$\mathit{j}$th variable, for i = 1,2,,n$\mathit{i}=1,2,\dots ,n$ and j = 1,2,,m$\mathit{j}=1,2,\dots ,{\mathbf{m}}$.
If matrix = 'C'${\mathbf{matrix}}=\text{'C'}$, x must contain the correlation or variance-covariance matrix. Only the upper triangular part is required.
4:     nvar – int64int32nag_int scalar
p$p$, the number of variables in the factor analysis.
Constraint: nvar2${\mathbf{nvar}}\ge 2$.
5:     isx(m) – int64int32nag_int array
m, the dimension of the array, must satisfy the constraint ${\mathbf{m}}\ge {\mathbf{nvar}}$.
isx(j)${\mathbf{isx}}\left(\mathit{j}\right)$ indicates whether or not the j$\mathit{j}$th variable is included in the factor analysis. If isx(j)1${\mathbf{isx}}\left(\mathit{j}\right)\ge 1$, the variable represented by the j$\mathit{j}$th column of x is included in the analysis; otherwise it is excluded, for j = 1,2,,m$\mathit{j}=1,2,\dots ,{\mathbf{m}}$.
Constraint: isx(j) > 0${\mathbf{isx}}\left(j\right)>0$ for nvar values of j$j$.
6:     nfac – int64int32nag_int scalar
k$k$, the number of factors.
Constraint: 1nfacnvar$1\le {\mathbf{nfac}}\le {\mathbf{nvar}}$.
7:     iop(5$5$) – int64int32nag_int array
Options for the optimization. There are four options to be set:
 iprint$\mathit{iprint}$ controls iteration monitoring; if iprint ≤ 0$\mathit{iprint}\le 0$, then there is no printing of information else if iprint > 0$\mathit{iprint}>0$, then information is printed at every iprint iterations. The information printed consists of the value of F(Ψ)$F\left(\Psi \right)$ at that iteration, the number of evaluations of F(Ψ)$F\left(\Psi \right)$, the current estimates of the communalities and an indication of whether or not they are at the boundary. maxfun$\mathit{maxfun}$ the maximum number of function evaluations. acc$\mathit{acc}$ the required accuracy for the estimates of ψi${\psi }_{i}$. eps$\mathit{eps}$ a lower bound for the values of ψ$\psi$, see Section [Description].
Let ε = machine precision then if iop(1) = 0${\mathbf{iop}}\left(1\right)=0$, then the following default values are used:
• iprint = 1$\mathit{iprint}=-1$
• maxfun = 100p$\mathit{maxfun}=100p$
• acc = 10sqrt(ε)$\mathit{acc}=10\sqrt{\epsilon }$
• eps = ε$\mathit{eps}=\epsilon$
If iop(1)0${\mathbf{iop}}\left(1\right)\ne 0$, then
• iprint = iop(2)$\mathit{iprint}={\mathbf{iop}}\left(2\right)$
• maxfun = iop(3)$\mathit{maxfun}={\mathbf{iop}}\left(3\right)$
• acc = 10l$\mathit{acc}={10}^{-l}$ where l = iop(4)$l={\mathbf{iop}}\left(4\right)$
• eps = 10l$\mathit{eps}={10}^{-l}$ where l = iop(5)$l={\mathbf{iop}}\left(5\right)$
Constraint: if iop(1)0${\mathbf{iop}}\left(1\right)\ne 0$, iop(i)${\mathbf{iop}}\left(\mathit{i}\right)$ must be such that maxfun1$\mathit{maxfun}\ge 1$, εacc < 1$\epsilon \le \mathit{acc}<1$ and εeps < 1$\epsilon \le \mathit{eps}<1$, for i = 3,4,5$\mathit{i}=3,4,5$.

### Optional Input Parameters

1:     m – int64int32nag_int scalar
Default: The dimension of the array isx and the second dimension of the array x. (An error is raised if these dimensions are not equal.)
The number of variables in the data/correlation/variance-covariance matrix.
Constraint: ${\mathbf{m}}\ge {\mathbf{nvar}}$.
2:     wt( : $:$) – double array
Note: the dimension of the array wt must be at least n${\mathbf{n}}$ if weight = 'W'$\mathit{weight}=\text{'W'}$ and matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$, and at least 1$1$ otherwise.
If weight = 'W'$\mathit{weight}=\text{'W'}$ and matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$, wt must contain the weights to be used in the factor analysis. The effective number of observations in the analysis will then be the sum of weights. If wt(i) = 0.0${\mathbf{wt}}\left(i\right)=0.0$, the i$i$th observation is not included in the analysis.
If weight = 'U'$\mathit{weight}=\text{'U'}$ or matrix = 'C'${\mathbf{matrix}}=\text{'C'}$, wt is not referenced and the effective number of observations is n$n$.
Constraint: if weight = 'W'$\mathit{weight}=\text{'W'}$, the sum of weights > nvar$\text{the sum of weights}>{\mathbf{nvar}}$, wt(i)0.0${\mathbf{wt}}\left(\mathit{i}\right)\ge 0.0$, for i = 1,2,,n$\mathit{i}=1,2,\dots ,n$.

### Input Parameters Omitted from the MATLAB Interface

weight ldx ldfl iwk wk lwk

### Output Parameters

1:     e(nvar) – double array
The eigenvalues θi${\theta }_{\mathit{i}}$, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$.
2:     stat(4$4$) – double array
The test statistics.
stat(1)${\mathbf{stat}}\left(1\right)$
Contains the value F(Ψ̂)$F\left(\stackrel{^}{\Psi }\right)$.
stat(2)${\mathbf{stat}}\left(2\right)$
Contains the test statistic, χ2${\chi }^{2}$.
stat(3)${\mathbf{stat}}\left(3\right)$
Contains the degrees of freedom associated with the test statistic.
stat(4)${\mathbf{stat}}\left(4\right)$
Contains the significance level.
3:     com(nvar) – double array
The communalities.
4:     psi(nvar) – double array
The estimates of ψi${\psi }_{\mathit{i}}$, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$.
5:     res(nvar × (nvar1) / 2${\mathbf{nvar}}×\left({\mathbf{nvar}}-1\right)/2$) – double array
The residual correlations. The residual correlation for the i$i$th and j$j$th variables is stored in res((j1)(j2) / 2 + i)${\mathbf{res}}\left(\left(j-1\right)\left(j-2\right)/2+i\right)$, i < j$i.
6:     fl(ldfl,nfac) – double array
ldflnvar$\mathit{ldfl}\ge {\mathbf{nvar}}$.
The factor loadings. fl(i,j)${\mathbf{fl}}\left(\mathit{i},\mathit{j}\right)$ contains λij${\lambda }_{\mathit{i}\mathit{j}}$, for i = 1,2,,p$\mathit{i}=1,2,\dots ,p$ and j = 1,2,,k$\mathit{j}=1,2,\dots ,k$.
7:     ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).

## Error Indicators and Warnings

Note: nag_mv_factor (g03ca) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

ifail = 1${\mathbf{ifail}}=1$
 On entry, ldfl < nvar$\mathit{ldfl}<{\mathbf{nvar}}$, or nvar < 2${\mathbf{nvar}}<2$, or ${\mathbf{n}}\le {\mathbf{nvar}}$, or nfac < 1${\mathbf{nfac}}<1$, or ${\mathbf{nvar}}<{\mathbf{nfac}}$, or ${\mathbf{m}}<{\mathbf{nvar}}$, or matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$ and ldx < n$\mathit{ldx}<{\mathbf{n}}$, or matrix = 'C'${\mathbf{matrix}}=\text{'C'}$ and ldx < m$\mathit{ldx}<{\mathbf{m}}$, or matrix ≠ 'D'${\mathbf{matrix}}\ne \text{'D'}$, 'S'$\text{'S'}$ or 'C'$\text{'C'}$, or matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$ and weight ≠ 'U'$\mathit{weight}\ne \text{'U'}$ or 'W'$\text{'W'}$, or iop(1) ≠ 0${\mathbf{iop}}\left(1\right)\ne 0$ and iop(3)${\mathbf{iop}}\left(3\right)$ is such that maxfun < 1$\mathit{maxfun}<1$, or iop(1) ≠ 0${\mathbf{iop}}\left(1\right)\ne 0$ and iop(4)${\mathbf{iop}}\left(4\right)$ is such that acc ≥ 1.0$\mathit{acc}\ge 1.0$, or iop(1) ≠ 0${\mathbf{iop}}\left(1\right)\ne 0$ and iop(4)${\mathbf{iop}}\left(4\right)$ is such that acc < machine precision, or iop(1) ≠ 0${\mathbf{iop}}\left(1\right)\ne 0$ and iop(5)${\mathbf{iop}}\left(5\right)$ is such that eps ≥ 1.0$\mathit{eps}\ge 1.0$, or iop(1) ≠ 0${\mathbf{iop}}\left(1\right)\ne 0$ and iop(5)${\mathbf{iop}}\left(5\right)$ is such that eps < machine precision, or matrix = 'C'${\mathbf{matrix}}=\text{'C'}$ and lwk < (5 × nvar × nvar + 33 × nvar − 4) / 2$\mathit{lwk}<\left(5×{\mathbf{nvar}}×{\mathbf{nvar}}+33×{\mathbf{nvar}}-4\right)/2$, or matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$ and lwk < max ((5 × nvar × nvar + 33 × nvar − 4) / 2,n × nvar + 7 × nvar + nvar × (nvar − 1) / 2)$\mathit{lwk}<\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\left(5×{\mathbf{nvar}}×{\mathbf{nvar}}+33×{\mathbf{nvar}}-4\right)/2,{\mathbf{n}}×{\mathbf{nvar}}+7×{\mathbf{nvar}}+{\mathbf{nvar}}×\left({\mathbf{nvar}}-1\right)/2\right)$.
ifail = 2${\mathbf{ifail}}=2$
 On entry, weight = 'W'$\mathit{weight}=\text{'W'}$ and a value of wt < 0.0${\mathbf{wt}}<0.0$.
ifail = 3${\mathbf{ifail}}=3$
On entry, there are not exactly nvar elements of isx > 0${\mathbf{isx}}>0$, or the effective number of observations nvar$\text{}\le {\mathbf{nvar}}$.
ifail = 4${\mathbf{ifail}}=4$
On entry, matrix = 'D'${\mathbf{matrix}}=\text{'D'}$ or 'S'$\text{'S'}$ and the data matrix is not of full column rank, or matrix = 'C'${\mathbf{matrix}}=\text{'C'}$ and the input correlation/variance-covariance matrix is not positive definite.
This exit may also be caused by two of the eigenvalues of S*${S}^{*}$ being equal; this is rare (see Lawley and Maxwell (1971)), and may be due to the data/correlation matrix being almost singular.
ifail = 5${\mathbf{ifail}}=5$
A singular value decomposition has failed to converge. This is a very unlikely error exit.
ifail = 6${\mathbf{ifail}}=6$
The estimation procedure has failed to converge in the given number of iterations. Change iop to either increase number of iterations maxfun$\mathit{maxfun}$ or increase the value of acc$\mathit{acc}$.
W ifail = 7${\mathbf{ifail}}=7$
The convergence is not certain but a lower point could not be found. See nag_opt_bounds_mod_deriv2_comp (e04lb) for further details. In this case all results are computed.

## Accuracy

The accuracy achieved is discussed in nag_opt_bounds_mod_deriv2_comp (e04lb) with the value of the parameter xtol given by acc$\mathit{acc}$ as described in parameter iop.

The factor loadings may be orthogonally rotated by using nag_mv_rot_orthomax (g03ba) and factor score coefficients can be computed using nag_mv_factor_score (g03cc). The maximum likelihood estimators are invariant to a change in scale. This means that the results obtained will be the same (up to a scaling factor) if either the correlation matrix or the variance-covariance matrix is used. As the correlation matrix ensures that all values of ψi${\psi }_{i}$ are between 0$0$ and 1$1$ it will lead to a more efficient optimization. In the situation when the data matrix is input the results are always computed for the correlation matrix and then scaled if the results for the covariance matrix are required. When you input the covariance/correlation matrix the input matrix itself is used and you are advised to input the correlation matrix rather than the covariance matrix.

## Example

```function nag_mv_factor_example
matrix = 'C';
n = int64(211);
x = [1, 0.523, 0.395, 0.471, 0.346, 0.426, 0.576, 0.434, 0.639;
0.523, 1, 0.479, 0.506, 0.418, 0.462, 0.547, 0.283, 0.645;
0.395, 0.479, 1, 0.355, 0.27, 0.254, 0.452, 0.219, 0.504;
0.471, 0.506, 0.355, 1, 0.691, 0.791, 0.443, 0.285, 0.505;
0.346, 0.418, 0.27, 0.691, 1, 0.679, 0.383, 0.149, 0.409;
0.426, 0.462, 0.254, 0.791, 0.679, 1, 0.372, 0.314, 0.472;
0.576, 0.547, 0.452, 0.443, 0.383, 0.372, 1, 0.385, 0.68;
0.434, 0.283, 0.219, 0.285, 0.149, 0.314, 0.385, 1, 0.47;
0.639, 0.645, 0.504, 0.505, 0.409, 0.472, 0.68, 0.47, 1];
nvar = int64(9);
isx = [int64(1);1;1;1;1;1;1;1;1];
nfac = int64(3);
iop = [int64(1);-1;500;2;5];
[e, stat, com, psi, res, fl, ifail] = ...
nag_mv_factor(matrix, n, x, nvar, isx, nfac, iop)
```
```

e =

15.9681
4.3577
1.8474
1.1560
1.1190
1.0271
0.9257
0.8951
0.8771

stat =

0.0350
7.1494
12.0000
0.8476

com =

0.5495
0.5729
0.3835
0.7877
0.6195
0.8231
0.6005
0.5384
0.7691

psi =

0.4505
0.4271
0.6165
0.2123
0.3805
0.1769
0.3995
0.4616
0.2309

res =

0.0004
-0.0128
0.0220
0.0114
-0.0053
0.0231
-0.0100
-0.0194
-0.0162
0.0033
-0.0046
0.0113
-0.0122
-0.0009
-0.0008
0.0153
-0.0216
-0.0108
0.0023
0.0294
-0.0123
-0.0011
-0.0105
0.0134
0.0054
-0.0057
-0.0009
0.0032
-0.0059
0.0097
-0.0049
-0.0114
0.0020
0.0074
0.0033
-0.0012

fl =

0.6642   -0.3209    0.0735
0.6888   -0.2471   -0.1933
0.4926   -0.3022   -0.2224
0.8372    0.2924   -0.0354
0.7050    0.3148   -0.1528
0.8187    0.3767    0.1045
0.6615   -0.3960   -0.0777
0.4579   -0.2955    0.4913
0.7657   -0.4274   -0.0117

ifail =

0

```
```function g03ca_example
matrix = 'C';
n = int64(211);
x = [1, 0.523, 0.395, 0.471, 0.346, 0.426, 0.576, 0.434, 0.639;
0.523, 1, 0.479, 0.506, 0.418, 0.462, 0.547, 0.283, 0.645;
0.395, 0.479, 1, 0.355, 0.27, 0.254, 0.452, 0.219, 0.504;
0.471, 0.506, 0.355, 1, 0.691, 0.791, 0.443, 0.285, 0.505;
0.346, 0.418, 0.27, 0.691, 1, 0.679, 0.383, 0.149, 0.409;
0.426, 0.462, 0.254, 0.791, 0.679, 1, 0.372, 0.314, 0.472;
0.576, 0.547, 0.452, 0.443, 0.383, 0.372, 1, 0.385, 0.68;
0.434, 0.283, 0.219, 0.285, 0.149, 0.314, 0.385, 1, 0.47;
0.639, 0.645, 0.504, 0.505, 0.409, 0.472, 0.68, 0.47, 1];
nvar = int64(9);
isx = [int64(1);1;1;1;1;1;1;1;1];
nfac = int64(3);
iop = [int64(1);-1;500;2;5];
[e, stat, com, psi, res, fl, ifail] = ...
g03ca(matrix, n, x, nvar, isx, nfac, iop)
```
```

e =

15.9681
4.3577
1.8474
1.1560
1.1190
1.0271
0.9257
0.8951
0.8771

stat =

0.0350
7.1494
12.0000
0.8476

com =

0.5495
0.5729
0.3835
0.7877
0.6195
0.8231
0.6005
0.5384
0.7691

psi =

0.4505
0.4271
0.6165
0.2123
0.3805
0.1769
0.3995
0.4616
0.2309

res =

0.0004
-0.0128
0.0220
0.0114
-0.0053
0.0231
-0.0100
-0.0194
-0.0162
0.0033
-0.0046
0.0113
-0.0122
-0.0009
-0.0008
0.0153
-0.0216
-0.0108
0.0023
0.0294
-0.0123
-0.0011
-0.0105
0.0134
0.0054
-0.0057
-0.0009
0.0032
-0.0059
0.0097
-0.0049
-0.0114
0.0020
0.0074
0.0033
-0.0012

fl =

0.6642   -0.3209    0.0735
0.6888   -0.2471   -0.1933
0.4926   -0.3022   -0.2224
0.8372    0.2924   -0.0354
0.7050    0.3148   -0.1528
0.8187    0.3767    0.1045
0.6615   -0.3960   -0.0777
0.4579   -0.2955    0.4913
0.7657   -0.4274   -0.0117

ifail =

0

```