glsfactor(s, m [, quiet:T,silent:T,start:psi0,uselogs:T], maxit:nmax, minit:nmin, print:T,crit:crvec]), REAL symmetric matrix s with no MISSING values, integers nmax > 0 and nmin > 0, crvec = vector(numsig, nsigsq, delta) |
Usage
You use glsfactor() to find GLS (generalized least squares) estimates of
the vector psi of factor analysis uniquenesses and loading matrix L by
means of nonlinear least squares. It uses macro glsresids() to compute
residuals used by non-linear least squares macro levmar().
glsfactor(r, m) estimates uniquenesses and loadings for a m-factor
analysis based on p by p symmetric correlation or variance-covariance
matrix r. m > 0 must be an integer < (2*p + 1 - sqrt(8*p+1))/2. The
default starting value for the uniquenesses is psi0 = 1/diag(solve(r)).
glsfactor() prints the estimated uniquenesses psihat and loading matrix,
the minimized criterion value, and vals, a vector of numbers computed
from certain eigenvalues; see below.
Value returned
The result is an "invisible" (assignable but not automatically printed)
variable of the form
structure(psihat:psi,loadings:L,criterion:crit,eigenvals:vals,\
status:iconv,iter:n)
The values of these components are as follows
psi length p vector of estimated uniquenesses
L p by m matrix of estimated loadings satisfying
L' %*% dmat(1/psi) %*% L is diagonal
crit sum of squared "residuals" of r from rhat
vals 1/v - 1, where v is the vector of eigenvalues of
dmat(psi) %*% solve(r) in increasing order
iconv integer >= 0 indicating convergence status, with 0 and 4
indicating non-convergence
n number of iterations
Keyword phrase arguments
There are several keyword phrases that can be used as arguments to
control the behavior of glsfactor().
start:psi0 psi0 a REAL vector of length p with min(psi0) > 0
to be used as starting values for the iteration
uselogs:T log(psi) is used in the iteration instead of psi;
this ensures psi does not become negative and may
speed convergence
maxit:nmax No more than nmax iterations are to be used; the
default is 30
minit:nmin At least nmin iterations will be performed; the
default is 1
crit:crvec crvec = vector(numsig, nsigsq, delta), 3 criteria
for convergence; a negative criterion is ignored;
see macro levmar() for details
quiet:T uniquenesses, loadings and vals are not printed;
only certain warning messages are printed
silent:T nothing is printed except error messages
print:T macro levmar() will print a status report on every
iteration
Convergence status indicator
Values of iconv indicate the following situations
iconv Meaning
0 Not converged
1 Converged with relative change in psi or log(psi) < 10^-numsig
2 Converged with relative change in rss <= 10^-nsigsq
3 Converged with ||gradient|| < delta
4 Interation stopped; could not reduce rss.
Caveats
Without uselogs:T, there is no guarantee that min(psihat) > = 0.
Even with uselogs:T, there is no guarantee that the minimum is inside
the permissible range (r - dmat(psihat) positive semi-definite);
however, this often leads to an 'argument to solve() singular' error
message.
Invisible variable _PSIGLS
Everytime it is called by levmar(), macro glsresids() saves a copy of
the current value of psi in invisible variable _PSIGLS. Type
'print(_PSIGLS)' to see this value.
glsfactor() is very much a work in progress, that may in fact be
abandoned in favor of other methods using optimization macros in macro
file Math.mac distributed with MacAnova.
Cross references
See also ulsfactor() and glsresids().