Next: stepml() Up: Multivariate Macros Help File Previous: standardize()   Contents

# stepgls()

Usage:
 ```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 ```

Keywords: factor analysis, iteration
```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.

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.

CRITERION containing newphi, L and criterion.

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