g03cac computes the maximum likelihood estimates of the arguments 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 function may be called by the names: g03cac or nag_mv_factor.
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:
, 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 function 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:
where is the matrix of the factor loadings, , and is a diagonal matrix of unique variances, , for .
The estimation of the arguments 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 arguments 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 e04lbc 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 function e04lbc 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, g03cac returns the residual correlations, i.e., the off-diagonal elements of where is the sample correlation matrix. g03cac also returns the test statistic:
On entry: if or then the elements of wt must contain the weights to be used in the factor analysis. The effective number of observations is the sum of the weights. If then the th observation is not included in the analysis.
If or wt is NULLthen wt is not referenced and the effective number of observations is .
if wt is referenced, then for , and the sum of the weights .
10: – doubleOutput
On exit: the eigenvalues , for .
11: – doubleOutput
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.
12: – doubleOutput
On exit: the communalities.
13: – doubleOutput
On exit: the estimates of , for .
14: – doubleOutput
On exit: the residual correlations. The residual correlation for the th and th variables is stored in , .
15: – doubleOutput
On exit: the factor loadings. contains , for and .
16: – IntegerInput
On entry: the stride separating matrix column elements in the array fl.
17: – Nag_E04_Opt *Input/Output
On entry/exit: a pointer to a structure of type Nag_E04_Opt whose members are optional parameters for e04lbc. These structure members offer the means of adjusting some of the argument values of the algorithm.
If the optional parameters are not required the NAG defined null pointer, E04_DEFAULT, can be used in the function call. See the document for e04lbc for further details.
18: – doubleInput
On entry: a lower bound for the value of .
19: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
Additional error messages are output if the optimization fails to converge or if the options are set incorrectly. Details of these can be found in the e04lbc document.
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
Value given to is not valid. Correct range is .
Value given to eps is not valid. Correct range is machine precision .
Value given to is not valid. Correct range is .
On entry, or and the data matrix is not of full column rank, or and the input correlation/variance-covariance matrix is not positive definite. This exit may also be caused by two of the eigenvalues of being equal; this is rare (see Lawley and Maxwell (1971)) and may be due to the data/correlation matrix being almost singular.
On entry, .
Constraint: when referenced, all elements of wt must be non-negative.
Cannot open file for appending.
Cannot close file .
With weighted data, the effective number of observations given by the sum of
weights , while the number of variables included in the analysis, .
Constraint: effective number of observations .
Options structure not initialized.
A singular value decomposition has failed to converge. This is a very unlikely error exit.
The number of variables, nvar in the analysis , while number of variables included in the analysis via array .
Constraint: these two numbers must be the same.
The conditions for a minimum have not all been satisfied but a lower
point could not be found. Note that in this case all the results are computed. See e04lbc for further details.
The maximum number of iterations, , have been performed.
Background information to multithreading can be found in the Multithreading documentation.
g03cac is not threaded in any implementation.
The factor loadings may be orthogonally rotated by using g03bac and factor score coefficients can be computed using g03ccc. 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 0 and 1 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 so you are advised to input the correlation matrix rather than the covariance matrix.
The example is taken from Lawley and Maxwell (1971). The correlation matrix for nine variables is input and the arguments of a factor analysis model with three factors are estimated and printed.