stepgls(s, psi, m [, print:T]), REAL positive definite symmetric matrix s, REAL vector psi or structure with psi[1] a REAL vector, integer m > 0 |

stepgls(r, psi, m) performs one step of an iteration which attempts to extract m factors in factor analyis. r is a p by p correlation or variance-covariance matrix, psi is a REAL vector of trial uniquenesses of length p with min(psi) > 0 and integer m > 0. The value returned is structure(psi:newpsi, loadings:L, crit:criterion), where newpsi is an updated vector of uniquenesses, L is a p by m matrix of factor loadings satisfying L' %*% dmat(1/psi) %*% L is diagonal, and criterion is a value of the criterion being minimized; see below. In addition, stepgls() creates side effect variabls PSI, LOADINGS, and CRITERION containing newphi, L and criterion. Actually L is the loadings that minimize the criterion for argument phi, not the output newphi, and criterion is the criterion assocated with phi and L. Each step reduces the generalized least squares (GLS) criterion = trace((I - solve(r) %*% rhat) %*% (I - solve(r) %*% rhat)), where rhat has the form rhat = dmat(psi) + V where V is the unique rank m matrix that minimizes this criterion for given psi. Argument psi can also have the form structure(psi1, ...) where psi1 is the vector of uniquenesses. This means you can do many steps of the iteration as follows. Cmd> psi <- psi0 # psi0 a vector of starting values Cmd> for (i,1,500){psi <- stepgls(r,psi,m);;} # 500 steps stepgls(r, psi, m, print:T) does the same except the updated psi and the criterion value are printed. For example, Cmd> for (i,1,500){psi <- stepgls(r,psi,m,print:i %% 50 == 0);;} prints out psi and and the criterion every 50 steps. The iteration performed by stepgls() is similar but not identical to what is known Principal Factor Iteration. It is not unusual for it to converge very slowly. In addition, it is possible for a step to produce a psi with min(psi) < 0 or r - dmat(psi) not non-negative definite. When this happens stepgls() aborts. You can retrieve the most recent uniquenesses and loadings from variables PSI and LOADINGS. It is usually preferable to use a method that more directly minimizes the criterion, such as macro glsfactor(). In addition, one of the function minimization macros, dfp, bfs or broyden could be used to minimize the criterion as a function of psi or log(psi).

Gary Oehlert 2003-01-15