NAG Library Routine Document

g03ccf  (factor_score)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

g03ccf computes factor score coefficients from the result of fitting a factor analysis model by maximum likelihood as performed by g03caf.

2
Specification

Fortran Interface
Subroutine g03ccf ( method, rotate, nvar, nfac, fl, ldfl, psi, e, r, ldr, fs, ldfs, wk, ifail)
Integer, Intent (In):: nvar, nfac, ldfl, ldr, ldfs
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: fl(ldfl,nfac), psi(nvar), e(nvar), r(ldr,*)
Real (Kind=nag_wp), Intent (Inout):: fs(ldfs,nfac)
Real (Kind=nag_wp), Intent (Out):: wk(nvar)
Character (1), Intent (In):: method, rotate
C Header Interface
#include nagmk26.h
void  g03ccf_ ( const char *method, const char *rotate, const Integer *nvar, const Integer *nfac, const double fl[], const Integer *ldfl, const double psi[], const double e[], const double r[], const Integer *ldr, double fs[], const Integer *ldfs, double wk[], Integer *ifail, const Charlen length_method, const Charlen length_rotate)

3
Description

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. g03caf 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 g03caf. Further, for models fitted by g03caf,
ΛTΨ-1Λ=Θ-I,  
where Θ is the diagonal matrix of eigenvalues of the matrix S*, as described in g03caf.
The factors may be orthogonally rotated using an orthogonal rotation matrix, R, as computed by g03baf. The factor scores for the rotated matrix are then given by ΛR.

4
References

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

5
Arguments

1:     method – Character(1)Input
On entry: indicates which method is to be used to compute the factor score coefficients.
method='R'
The regression method is used.
method='B'
Bartlett's method is used.
Constraint: method='B' or 'R'.
2:     rotate – Character(1)Input
On entry: indicates whether a rotation is to be applied.
rotate='R'
A rotation will be applied to the coefficients and the rotation matrix, R, must be given in r.
rotate='U'
No rotation is applied.
Constraint: rotate='R' or 'U'.
3:     nvar – IntegerInput
On entry: p, the number of observed variables in the factor analysis.
Constraint: nvarnfac.
4:     nfac – IntegerInput
On entry: k, the number of factors in the factor analysis.
Constraint: nfac1.
5:     flldflnfac – Real (Kind=nag_wp) arrayInput
On entry: Λ, the matrix of unrotated factor loadings as returned by g03caf.
6:     ldfl – IntegerInput
On entry: the first dimension of the array fl as declared in the (sub)program from which g03ccf is called.
Constraint: ldflnvar.
7:     psinvar – Real (Kind=nag_wp) arrayInput
On entry: the diagonal elements of Ψ, as returned by g03caf.
Constraint: psii>0.0, for i=1,2,,p.
8:     envar – Real (Kind=nag_wp) arrayInput
On entry: the eigenvalues of the matrix S*, as returned by g03caf.
Constraint: ei>1.0, for i=1,2,,p.
9:     rldr* – Real (Kind=nag_wp) arrayInput
Note: the second dimension of the array r must be at least 1 if rotate='U' and at least nfac if rotate='R'.
On entry: if rotate='R', r must contain the orthogonal rotation matrix, R, as returned by g03baf.
If rotate='U', r need not be set.
10:   ldr – IntegerInput
On entry: the first dimension of the array r as declared in the (sub)program from which g03ccf is called.
Constraints:
  • if rotate='R', ldrnfac;
  • otherwise ldr1.
11:   fsldfsnfac – Real (Kind=nag_wp) arrayOutput
On exit: 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.
12:   ldfs – IntegerInput
On entry: the first dimension of the array fs as declared in the (sub)program from which g03ccf is called.
Constraint: ldfsnvar.
13:   wknvar – Real (Kind=nag_wp) arrayWorkspace
14:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ 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​ 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 -1​ or ​1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry 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:
ifail=1
On entry,nfac<1,
ornvar<nfac,
orldfl<nvar,
orldfs<nvar,
orrotate='R' and ldr<nfac,
ormethod'R' or 'B',
orrotate'R' or 'U'.
ifail=2
On entry,a value of psi0.0,
ora value of e1.0.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Accuracy will depend on the accuracy requested when computing the estimated factor loadings using g03caf.

8
Parallelism and Performance

g03ccf 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.

9
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 g03zaf. The standardized variables are then post-multiplied by the factor score coefficients. This may be performed using routines from Chapter F06, for example f06yaf (dgemm).
If principal component analysis is required the routine g03aaf computes the principal component scores directly. Hence, the factor score coefficients are not needed.

10
Example

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

10.1
Program Text

Program Text (g03ccfe.f90)

10.2
Program Data

Program Data (g03ccfe.d)

10.3
Program Results

Program Results (g03ccfe.r)

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