hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_mv_factor_score (g03cc)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_mv_factor_score (g03cc) computes factor score coefficients from the result of fitting a factor analysis model by maximum likelihood as performed by nag_mv_factor (g03ca).


[fs, ifail] = g03cc(method, rotate, fl, psi, e, r, 'nvar', nvar, 'nfac', nfac)
[fs, ifail] = nag_mv_factor_score(method, rotate, fl, psi, e, r, 'nvar', nvar, 'nfac', nfac)


A factor analysis model aims to account for the covariances among p variables, observed on n individuals, in terms of a smaller number, k, of unobserved variables or factors. The values of the factors for an individual are known as factor scores. nag_mv_factor (g03ca) fits the factor analysis model by maximum likelihood and returns the estimated factor loading matrix, Λ, and the diagonal matrix of variances of the unique components, Ψ. To obtain estimates of the factors, a p by k matrix of factor score coefficients, Φ, is formed. The estimated vector of factor scores, f^, is then given by:
where x is the vector of observed variables for an individual.
There are two commonly used methods of obtaining factor score coefficients.
The regression method:
Φ=Ψ-1ΛI+ΛTΨ-1Λ -1,  
and Bartlett's method:
Φ=Ψ-1ΛΛTΨ-1Λ -1.  
See Lawley and Maxwell (1971) for details of both methods. In the regression method as given above, it is assumed that the factors are not correlated and have unit variance; this is true for models fitted by nag_mv_factor (g03ca). Further, for models fitted by nag_mv_factor (g03ca),
where Θ is the diagonal matrix of eigenvalues of the matrix S*, as described in nag_mv_factor (g03ca).
The factors may be orthogonally rotated using an orthogonal rotation matrix, R, as computed by nag_mv_rot_orthomax (g03ba). The factor scores for the rotated matrix are then given by ΛR.


Lawley D N and Maxwell A E (1971) Factor Analysis as a Statistical Method (2nd Edition) Butterworths


Compulsory Input Parameters

1:     method – string (length ≥ 1)
Indicates which method is to be used to compute the factor score coefficients.
The regression method is used.
Bartlett's method is used.
Constraint: method='B' or 'R'.
2:     rotate – string (length ≥ 1)
Indicates whether a rotation is to be applied.
A rotation will be applied to the coefficients and the rotation matrix, R, must be given in r.
No rotation is applied.
Constraint: rotate='R' or 'U'.
3:     flldflnfac – double array
ldfl, the first dimension of the array, must satisfy the constraint ldflnvar.
Λ, the matrix of unrotated factor loadings as returned by nag_mv_factor (g03ca).
4:     psinvar – double array
The diagonal elements of Ψ, as returned by nag_mv_factor (g03ca).
Constraint: psii>0.0, for i=1,2,,p.
5:     envar – double array
The eigenvalues of the matrix S*, as returned by nag_mv_factor (g03ca).
Constraint: ei>1.0, for i=1,2,,p.
6:     rldr: – double array
The first dimension, ldr, of the array r must satisfy
  • if rotate='R', ldrnfac;
  • otherwise 1.
The second dimension of the array r must be at least 1 if rotate='U' and at least nfac if rotate='R'.
If rotate='R', r must contain the orthogonal rotation matrix, R, as returned by nag_mv_rot_orthomax (g03ba).
If rotate='U', r need not be set.

Optional Input Parameters

1:     nvar int64int32nag_int scalar
Default: the dimension of the arrays psi, e and the first dimension of the array fl. (An error is raised if these dimensions are not equal.)
p, the number of observed variables in the factor analysis.
Constraint: nvarnfac.
2:     nfac int64int32nag_int scalar
Default: the second dimension of the array fl.
k, the number of factors in the factor analysis.
Constraint: nfac1.

Output Parameters

1:     fsldfsnfac – double array
The matrix of factor score coefficients, Φ. fsij contains the factor score coefficient for the jth factor and the ith observed variable, for i=1,2,,p and j=1,2,,k.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
On entry,nfac<1,
orrotate='R' and ldr<nfac,
ormethod'R' or 'B',
orrotate'R' or 'U'.
On entry,a value of psi0.0,
ora value of e1.0.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


Accuracy will depend on the accuracy requested when computing the estimated factor loadings using nag_mv_factor (g03ca).

Further Comments

If principal component analysis is required the function nag_mv_prin_comp (g03aa) computes the principal component scores directly. Hence, the factor score coefficients are not needed.


This example is taken from Lawley and Maxwell (1971). The correlation matrix for 220 observations on six school subjects is input and a factor analysis model with two factors fitted using nag_mv_factor (g03ca). The factor score coefficients are computed using the regression method.
function g03cc_example

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

matrix = 'C';
n = int64(220);
x = [1.000 0.439 0.410 0.288 0.329 0.248;
     0.439 1.000 0.351 0.354 0.320 0.329;
     0.410 0.351 1.000 0.164 0.190 0.181;
     0.288 0.354 0.164 1.000 0.595 0.470;
     0.329 0.320 0.190 0.595 1.000 0.464;
     0.248 0.329 0.181 0.470 0.464 1.000];

nvar = int64(size(x,1));
isx  = ones(nvar,1,'int64');
nfac = int64(2);
iop  = [int64(1); -1;  500;  3;  5];

% Fit factor analysis model
[e, stat, com, psi, res, fl, ifail] = ...
  g03ca( ...
	 matrix, n, x, nvar, isx, nfac, iop);

fprintf(' Loadings, Communalities and Psi\n\n');
for i = 1:nvar
  fprintf('%8.3f', fl(i,1:nfac), com(i), psi(i));

% Compute factor scores
method = 'R';
rotate = 'U';
r      = [0];
[fs, ifail] = g03cc( ...
		     method, rotate, fl, psi, e, r);

mtitle = 'Factor score coefficients';
matrix = 'General';
diag   = ' ';

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

g03cc example results

 Loadings, Communalities and Psi

   0.553  -0.429   0.490   0.510
   0.568  -0.288   0.406   0.594
   0.392  -0.450   0.356   0.644
   0.740   0.273   0.623   0.377
   0.724   0.211   0.569   0.431
   0.595   0.132   0.372   0.628

 Factor score coefficients
          1       2
 1   0.1932 -0.3920
 2   0.1703 -0.2265
 3   0.1085 -0.3262
 4   0.3495  0.3374
 5   0.2989  0.2286
 6   0.1688  0.0978

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015