ulsfactor(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 ulsfactor() to find ULS (unweighted least squares) estimates of
the vector psi of factor analysis uniquenesses and the loading matrix L
by means of nonlinear least squares. It uses macro ulsresids() to
compute residuals required by non-linear least squares macro levmar().
ulsfactor(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)).
Printed output
ulsfactor() 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' %*% L is diagonal
crit sum of squared "residuals" = vector(r - rhat)
vals v, where v is the vector of eigenvalues of r - dmat(psi)
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 ulsfactor().
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
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.
Caveat
With or without uselogs:T, there is no guarantee that the solution
found is admissible in the sense that r - dmat(psihat) is positive
semi-definite. A warning is printed when is not. With uselogs:T this
situation is sometimes indicated by an 'argument to solve() singular'
error message.
Without uselogs:T, there is no guarantee that min(psihat) > = 0. A
warning is printed if it is not.
Invisible variable _PSIGLS
Every time macro ulsresids() is called by levmar(), it saves a copy of
the current value of psi in invisible variable _PSIGLS. Type
print(_PSIGLS) to see this value.
ulsfactor() 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.