g03caf computes the maximum likelihood estimates of the parameters of a factor analysis model. Either the data matrix or a correlation/covariance matrix may be input. Factor loadings, communalities and residual correlations are returned.
The routine may be called by the names g03caf or nagf_mv_factor.
3Description
Let variables, , with variance-covariance matrix be observed. The aim of factor analysis is to account for the covariances in these variables in terms of a smaller number, , of hypothetical variables, or factors, . These are assumed to be independent and to have unit variance. The relationship between the observed variables and the factors is given by the model:
where , for and , are the factor loadings and , for , are independent random variables with variances , for . The represent the unique component of the variation of each observed variable. The proportion of variation for each variable accounted for by the factors is known as the communality. For this routine it is assumed that both the factors and the 's follow independent Normal distributions.
The model for the variance-covariance matrix, , can be written as:
(1)
where is the matrix of the factor loadings, , and is a diagonal matrix of unique variances, , for .
The estimation of the parameters of the model, and , by maximum likelihood is described by Lawley and Maxwell (1971). The log-likelihood is:
where is the number of observations, is the sample variance-covariance matrix or, if weights are used, is the weighted sample variance-covariance matrix and is the effective number of observations, that is, the sum of the weights. The constant is independent of the parameters of the model. A two stage maximization is employed. It makes use of the function , which is, up to a constant, times the log-likelihood maximized over . This is then minimized with respect to to give the estimates, , of . The function can be written as:
where values , for are the eigenvalues of the matrix:
The estimates , of , are then given by scaling the eigenvectors of , which are denoted by :
where is the diagonal matrix with elements , and is the identity matrix.
The minimization of is performed using e04lbf which uses a modified Newton algorithm. The computation of the Hessian matrix is described by Clark (1970). However, instead of using the eigenvalue decomposition of the matrix as described above, the singular value decomposition of the matrix is used, where is obtained either from the decomposition of the (scaled) mean centred data matrix or from the Cholesky decomposition of the correlation/covariance matrix. The routine e04lbf ensures that the values of are greater than a given small positive quantity, , so that the communality is always less than . This avoids the so called Heywood cases.
In addition to the values of , and the communalities, g03caf returns the residual correlations, i.e., the off-diagonal elements of where is the sample correlation matrix. g03caf also returns the test statistic:
Clark M R B (1970) A rapidly convergent method for maximum likelihood factor analysis British J. Math. Statist. Psych.
Hammarling S (1985) The singular value decomposition in multivariate statistics SIGNUM Newsl.20(3) 2–25
Lawley D N and Maxwell A E (1971) Factor Analysis as a Statistical Method (2nd Edition) Butterworths
Morrison D F (1967) Multivariate Statistical Methods McGraw–Hill
5Arguments
1: – Character(1)Input
On entry: selects the type of matrix on which factor analysis is to be performed.
The data matrix will be input in x and factor analysis will be computed for the correlation matrix.
The data matrix will be input in x and factor analysis will be computed for the covariance matrix, i.e., the results are scaled as described in Section 9.
The correlation/variance-covariance matrix will be input in x and factor analysis computed for this matrix.
On entry: if or the number of observations in the data array x.
If the (effective) number of observations used in computing the (possibly weighted) correlation/variance-covariance matrix input in x.
Constraint:
.
4: – IntegerInput
On entry: the number of variables in the data/correlation/variance-covariance matrix.
Constraint:
.
5: – Real (Kind=nag_wp) arrayInput
On entry: the input matrix.
If or , x must contain the data matrix, i.e.,
must contain the th observation for the th variable, for and .
If , x must contain the correlation or variance-covariance matrix. Only the upper triangular part is required.
6: – IntegerInput
On entry: the first dimension of the array x as declared in the (sub)program from which g03caf is called.
Constraints:
if or , ;
if , .
7: – IntegerInput
On entry: , the number of variables in the factor analysis.
Constraint:
.
8: – Integer arrayInput
On entry: indicates whether or not the th variable is included in the factor analysis. If , the variable represented by the th column of x is included in the analysis; otherwise it is excluded, for .
Note: the dimension of the array wt
must be at least
if and or , and at least otherwise.
On entry: if and or , wt must contain the weights to be used in the factor analysis. The effective number of observations in the analysis will then be the sum of weights. If , the th observation is not included in the analysis.
If or , wt is not referenced and the effective number of observations is .
Constraints:
if ,
, for ;
.
11: – Real (Kind=nag_wp) arrayOutput
On exit: the eigenvalues
, for .
12: – Real (Kind=nag_wp) arrayOutput
On exit: the test statistics.
Contains the value .
Contains the test statistic, .
Contains the degrees of freedom associated with the test statistic.
Contains the significance level.
13: – Real (Kind=nag_wp) arrayOutput
On exit: the communalities.
14: – Real (Kind=nag_wp) arrayOutput
On exit: the estimates of
, for .
15: – Real (Kind=nag_wp) arrayOutput
On exit: the residual correlations. The residual correlation for the th and th variables is stored in , .
16: – Real (Kind=nag_wp) arrayOutput
On exit: the factor loadings.
contains , for and .
17: – IntegerInput
On entry: the first dimension of the array fl as declared in the (sub)program from which g03caf is called.
Constraint:
.
18: – Integer arrayInput
On entry: options for the optimization. There are four options to be set:
controls iteration monitoring;
if , there is no printing of information else if , information is printed at every iprint iterations. The information printed consists of the value of at that iteration, the number of evaluations of , the current estimates of the communalities and an indication of whether or not they are at the boundary.
Let then if , the following default values are used:
If , then
where
where
Constraint:
if ,
must be such that , and , for .
19: – Integer arrayWorkspace
20: – Real (Kind=nag_wp) arrayWorkspace
21: – IntegerInput
On entry: the dimension of the array wk as declared in the (sub)program from which g03caf is called. The length of the workspace.
Constraints:
if or , ;
if , .
22: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended since useful values can be provided in some output arguments even when on exit. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases g03caf may return useful information.
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: , or .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: when or , or .
On entry, and .
Constraint: .
On entry, and values of
Constraint: exactly nvar elements of .
The effective number of observations .
The number of variables number of included observations.
On entry, the data matrix is not of full column rank or the input correlation/covariance matrix is not positive definite.
Two eigenvalues of are equal. This error exit is rare (see Lawley and Maxwell (1971)), and may be due to the data/correlation matrix being almost singular.
The singular value decomposition has failed to converge. This is an unlikely error exit.
The estimation procedure has failed to converge in iterations. Change iop to either increase the number of iterations or increase the value of .
The convergence is not certain but a lower point could not be found. All results are computed.
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
The accuracy achieved is discussed in e04lbf with the value of the argument xtol given by as described in parameter iop.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g03caf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g03caf 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.
9Further Comments
The factor loadings may be orthogonally rotated by using g03baf and factor score coefficients can be computed using g03ccf. The maximum likelihood estimators are invariant to a change in scale. This means that the results obtained will be the same (up to a scaling factor) if either the correlation matrix or the variance-covariance matrix is used. As the correlation matrix ensures that all values of are between and it will lead to a more efficient optimization. In the situation when the data matrix is input the results are always computed for the correlation matrix and then scaled if the results for the covariance matrix are required. When you input the covariance/correlation matrix the input matrix itself is used and you are advised to input the correlation matrix rather than the covariance matrix.
10Example
This example is taken from Lawley and Maxwell (1971). The correlation matrix for nine variables is input and the parameters of a factor analysis model with three factors are estimated and printed.