NAG Library Function Document

nag_mv_fac_score (g03ccc)


    1  Purpose
    7  Accuracy


nag_mv_fac_score (g03ccc) computes factor score coefficients from the result of fitting a factor analysis model by maximum likelihood as performed by nag_mv_factor (g03cac).


#include <nag.h>
#include <nagg03.h>
void  nag_mv_fac_score (Nag_FacScoreMethod method, Nag_FacRotation rotate, Integer nvar, Integer nfac, const double fl[], Integer tdfl, const double psi[], const double e[], const double r[], Integer tdr, double fs[], Integer tdfs, NagError *fail)


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 (g03cac) 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:
f ^ = xT Φ ,  
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 (g03cac). Further, for models fitted by nag_mv_factor (g03cac),
ΛT Ψ -1 Λ = Θ - I ,  
where Θ  is the diagonal matrix of eigenvalues of the matrix S * , as described in nag_mv_factor (g03cac).
The factors may be orthogonally rotated using an orthogonal rotation matrix, R , as computed by nag_mv_orthomax (g03bac). 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


1:     method Nag_FacScoreMethodInput
On entry: 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=Nag_FacScoreRegsn or Nag_FacScoreBart.
2:     rotate Nag_FacRotationInput
On entry: 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=Nag_FacRotate or Nag_FacNoRotate.
3:     nvar IntegerInput
On entry: the number of observed variables in the factor analysis, p .
Constraint: nvarnfac .
4:     nfac IntegerInput
On entry: the number of factors in the factor analysis, k .
Constraint: nfac1 .
5:     fl[nvar×tdfl] const doubleInput
Note: the i,jth element of the matrix is stored in fl[i-1×tdfl+j-1].
On entry: the matrix of unrotated factor loadings, Λ , as returned by nag_mv_factor (g03cac).
6:     tdfl IntegerInput
On entry: the stride separating matrix column elements in the array fl.
Constraint: tdflnfac .
7:     psi[nvar] const doubleInput
On entry: the diagonal elements of Ψ , as returned by nag_mv_factor (g03cac).
Constraint: psi[i-1] > 0.0 , for i=1,2,,p.
8:     e[nvar] const doubleInput
On entry: the eigenvalues of the matrix S * , as returned by nag_mv_factor (g03cac).
Constraint: e[i-1] > 1.0 , for i=1,2,,p.
9:     r[nfac×tdr] const doubleInput
Note: the i,jth element of the matrix R is stored in r[i-1×tdr+j-1].
On entry: if rotate=Nag_FacRotate, then r must contain the orthogonal rotation matrix, R , as returned by nag_mv_orthomax (g03bac).
If rotate=Nag_FacNoRotate then r need not be set.
10:   tdr IntegerInput
On entry: the stride separating matrix column elements in the array r.
Constraint: if rotate=Nag_FacRotate then tdrnfac .
11:   fs[nvar×tdfs] doubleOutput
On exit: the matrix of factor score coefficients, Φ . fs[i-1×tdfs+j-1]  contains the factor score coefficient for the j th factor and the i th observed variable, for i=1,2,,p and j=1,2,,k.
12:   tdfs IntegerInput
On entry: the stride separating matrix column elements in the array fs.
Constraint: tdfsnfac .
13:   fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

Error Indicators and Warnings

On entry, tdr=value  while nfac=value  and rotate=Nag_FacRotate. These arguments must satisfy tdrnfac  when rotate=Nag_FacRotate.
On entry, nvar=value  while nfac=value . These arguments must satisfy nvarnfac .
On entry, tdfl=value  while nfac=value . These arguments must satisfy tdflnfac .
On entry, tdfs=value  while nfac=value . These arguments must satisfy tdfsnfac .
Dynamic memory allocation failed.
On entry, argument method had an illegal value.
On entry, argument rotate had an illegal value.
On entry, nfac=value.
Constraint: nfac1.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
On entry, e[value] = value.
Constraint: e[value] > 1.0 .
On entry, psi[value] = value.
Constraint: psi[value] > 0.0 .


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

Parallelism and Performance

nag_mv_fac_score (g03ccc) is not threaded in any implementation.

Further Comments

To compute the factor scores using the factor score coefficients, the values for the observed variables first need to be standardized by subtracting the sample means and, if the factor analysis is based upon a correlation matrix, dividing by the sample standard deviations. This may be performed using nag_mv_z_scores (g03zac). The standardized variables are then post-multiplied by the factor score coefficients. This may be performed using functions from the f16 Chapter Introduction, for example nag_dgemm (f16yac).
If principal component analysis is required, the function nag_mv_prin_comp (g03aac) computes the principal component scores directly. Hence, the factor score coefficients are not needed.


The 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 (g03cac). The factor score coefficients are computed using the regression method.

Program Text

Program Text (g03ccce.c)

Program Data

Program Data (g03ccce.d)

Program Results

Program Results (g03ccce.r)

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