g03 Chapter Contents
g03 Chapter Introduction
NAG C Library Manual

NAG Library Function Documentnag_mv_fac_score (g03ccc)

1  Purpose

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

2  Specification

 #include #include
 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)

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. nag_mv_factor (g03cac) fits the factor analysis model by maximum likelihood and returns the estimated factor loading matrix, $\Lambda$, and the diagonal matrix of variances of the unique components, $\Psi$. To obtain estimates of the factors, a $p$ by $k$ matrix of factor score coefficients, $\Phi$, is formed. The estimated vector of factor scores, $\stackrel{^}{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 $\Theta$ 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 $\Lambda R$.

4  References

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

5  Arguments

1:     methodNag_FacScoreMethodInput
On entry: indicates which method is to be used to compute the factor score coefficients.
${\mathbf{method}}=\mathrm{Nag_FacScoreRegsn}$
The regression method is used.
${\mathbf{method}}=\mathrm{Nag_FacScoreBart}$
Bartlett's method is used.
Constraint: ${\mathbf{method}}=\mathrm{Nag_FacScoreRegsn}$ or $\mathrm{Nag_FacScoreBart}$.
2:     rotateNag_FacRotationInput
On entry: indicates whether a rotation is to be applied.
${\mathbf{rotate}}=\mathrm{Nag_FacRotate}$
A rotation will be applied to the coefficients and the rotation matrix, $R$, must be given in r.
${\mathbf{rotate}}=\mathrm{Nag_FacNoRotate}$
No rotation is applied.
Constraint: ${\mathbf{rotate}}=\mathrm{Nag_FacRotate}$ or $\mathrm{Nag_FacNoRotate}$.
3:     nvarIntegerInput
On entry: the number of observed variables in the factor analysis, $p$.
Constraint: ${\mathbf{nvar}}\ge {\mathbf{nfac}}$.
4:     nfacIntegerInput
On entry: the number of factors in the factor analysis, $k$.
Constraint: ${\mathbf{nfac}}\ge 1$.
5:     fl[${\mathbf{nvar}}×{\mathbf{tdfl}}$]const doubleInput
Note: the $\left(i,j\right)$th element of the matrix is stored in ${\mathbf{fl}}\left[\left(i-1\right)×{\mathbf{tdfl}}+j-1\right]$.
On entry: the matrix of unrotated factor loadings, $\Lambda$, as returned by nag_mv_factor (g03cac).
6:     tdflIntegerInput
On entry: the stride separating matrix column elements in the array fl.
Constraint: ${\mathbf{tdfl}}\ge {\mathbf{nfac}}$.
7:     psi[nvar]const doubleInput
On entry: the diagonal elements of $\Psi$, as returned by nag_mv_factor (g03cac).
Constraint: ${\mathbf{psi}}\left[\mathit{i}-1\right]>0.0$, for $\mathit{i}=1,2,\dots ,p$.
8:     e[nvar]const doubleInput
On entry: the eigenvalues of the matrix ${S}^{*}$, as returned by nag_mv_factor (g03cac).
Constraint: ${\mathbf{e}}\left[\mathit{i}-1\right]>1.0$, for $\mathit{i}=1,2,\dots ,p$.
9:     r[${\mathbf{nfac}}×{\mathbf{tdr}}$]const doubleInput
Note: the $\left(i,j\right)$th element of the matrix $R$ is stored in ${\mathbf{r}}\left[\left(i-1\right)×{\mathbf{tdr}}+j-1\right]$.
On entry: if ${\mathbf{rotate}}=\mathrm{Nag_FacRotate}$, then r must contain the orthogonal rotation matrix, $R$, as returned by nag_mv_orthomax (g03bac).
If ${\mathbf{rotate}}=\mathrm{Nag_FacNoRotate}$ then r need not be set.
10:   tdrIntegerInput
On entry: the stride separating matrix column elements in the array r.
Constraint: if ${\mathbf{rotate}}=\mathrm{Nag_FacRotate}$ then ${\mathbf{tdr}}\ge {\mathbf{nfac}}$.
11:   fs[${\mathbf{nvar}}×{\mathbf{tdfs}}$]doubleOutput
On exit: the matrix of factor score coefficients, $\Phi$. ${\mathbf{fs}}\left[\left(\mathit{i}-1\right)×{\mathbf{tdfs}}+\mathit{j}-1\right]$ contains the factor score coefficient for the $\mathit{j}$th factor and the $\mathit{i}$th observed variable, for $\mathit{i}=1,2,\dots ,p$ and $\mathit{j}=1,2,\dots ,k$.
12:   tdfsIntegerInput
On entry: the stride separating matrix column elements in the array fs.
Constraint: ${\mathbf{tdfs}}\ge {\mathbf{nfac}}$.
13:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_2_INT_ARG_ENUM_CONS
On entry, ${\mathbf{tdr}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nfac}}=〈\mathit{\text{value}}〉$ and ${\mathbf{rotate}}=\mathrm{Nag_FacRotate}$. These arguments must satisfy ${\mathbf{tdr}}\ge {\mathbf{nfac}}$ when ${\mathbf{rotate}}=\mathrm{Nag_FacRotate}$.
NE_2_INT_ARG_LT
On entry, ${\mathbf{nvar}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nfac}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{nvar}}\ge {\mathbf{nfac}}$.
On entry, ${\mathbf{tdfl}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nfac}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{tdfl}}\ge {\mathbf{nfac}}$.
On entry, ${\mathbf{tdfs}}=〈\mathit{\text{value}}〉$ while ${\mathbf{nfac}}=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{tdfs}}\ge {\mathbf{nfac}}$.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
On entry, argument method had an illegal value.
On entry, argument rotate had an illegal value.
NE_INT_ARG_LT
On entry, ${\mathbf{nfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nfac}}\ge 1$.
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, ${\mathbf{e}}\left[〈\mathit{\text{value}}〉\right]=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{e}}\left[〈\mathit{\text{value}}〉\right]>1.0$.
On entry, ${\mathbf{psi}}\left[〈\mathit{\text{value}}〉\right]=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{psi}}\left[〈\mathit{\text{value}}〉\right]>0.0$.

7  Accuracy

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

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.

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

9.1  Program Text

Program Text (g03ccce.c)

9.2  Program Data

Program Data (g03ccce.d)

9.3  Program Results

Program Results (g03ccce.r)