NAG CL Interface
g03ccc (factor_​score)

1 Purpose

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

2 Specification

#include <nag.h>
void  g03ccc (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)
The function may be called by the names: g03ccc, nag_mv_factor_score or nag_mv_fac_score.

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. 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 g03cac. Further, for models fitted by g03cac,
Λ T Ψ -1 Λ = Θ - I ,  
where Θ is the diagonal matrix of eigenvalues of the matrix S * , as described in g03cac.
The factors may be orthogonally rotated using an orthogonal rotation matrix, R , as computed by g03bac. 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 Nag_FacScoreMethod Input
On entry: indicates which method is to be used to compute the factor score coefficients.
method=Nag_FacScoreRegsn
The regression method is used.
method=Nag_FacScoreBart
Bartlett's method is used.
Constraint: method=Nag_FacScoreRegsn or Nag_FacScoreBart.
2: rotate Nag_FacRotation Input
On entry: indicates whether a rotation is to be applied.
rotate=Nag_FacRotate
A rotation will be applied to the coefficients and the rotation matrix, R , must be given in r.
rotate=Nag_FacNoRotate
No rotation is applied.
Constraint: rotate=Nag_FacRotate or Nag_FacNoRotate.
3: nvar Integer Input
On entry: the number of observed variables in the factor analysis, p .
Constraint: nvarnfac .
4: nfac Integer Input
On entry: the number of factors in the factor analysis, k .
Constraint: nfac1 .
5: fl[nvar×tdfl] const double Input
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 g03cac.
6: tdfl Integer Input
On entry: the stride separating matrix column elements in the array fl.
Constraint: tdflnfac .
7: psi[nvar] const double Input
On entry: the diagonal elements of Ψ , as returned by g03cac.
Constraint: psi[i-1] > 0.0 , for i=1,2,,p.
8: e[nvar] const double Input
On entry: the eigenvalues of the matrix S * , as returned by g03cac.
Constraint: e[i-1] > 1.0 , for i=1,2,,p.
9: r[nfac×tdr] const double Input
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 g03bac.
If rotate=Nag_FacNoRotate then r need not be set.
10: tdr Integer Input
On entry: the stride separating matrix column elements in the array r.
Constraint: if rotate=Nag_FacRotate then tdrnfac .
11: fs[nvar×tdfs] double Output
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 Integer Input
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 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_2_INT_ARG_ENUM_CONS
On entry, tdr=value while nfac=value and rotate=Nag_FacRotate. These arguments must satisfy tdrnfac when rotate=Nag_FacRotate.
NE_2_INT_ARG_LT
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 .
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument method had an illegal value.
On entry, argument rotate had an illegal value.
NE_INT_ARG_LT
On entry, nfac=value.
Constraint: nfac1.
NE_INTERNAL_ERROR
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.
NE_REAL_ARRAY_INPUT
On entry, e[value] = value.
Constraint: e[value] > 1.0 .
On entry, psi[value] = value.
Constraint: psi[value] > 0.0 .

7 Accuracy

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

8 Parallelism and Performance

g03ccc is not threaded in any implementation.

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 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 f16yac.
If principal component analysis is required, the function g03aac computes the principal component scores directly. Hence, the factor score coefficients are not needed.

10 Example

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

10.1 Program Text

Program Text (g03ccce.c)

10.2 Program Data

Program Data (g03ccce.d)

10.3 Program Results

Program Results (g03ccce.r)