Next: forstep()
Up: Multivariate Macros Help File
Previous: distcomp()
Contents
Usage:
facanal(s, m [, method:Meth] [,start:psi0] [,rotate:Rotmeth] \
[,maxit:nmax] [,minit:nmin] [,crit:vector(nsig1,nsig2,dg)]\
[,minimizer:M] [,gold:ngold] [,quiet:T] [,silent:T] \ [,recordwhen:d1]
[,printwhen:d2]), REAL p.d. symmetric matrix s, integer m > 0, psi0
positive vector of starting uniquenesses, Rotmeth one of "varimax",
quartimax", "equimax", "none" (default), nmin >= 0, nmax > 0, ngold >
0, d1 >= 0, d2 >= 0, nsig1, nsig2 integers, dg REAL scalar, M one of
"dfp", "bfs" (default) or "broyden",
|
Keywords:
factor analysis
facanal() uses an optimization macro (dfp(), bfs() or broyden()) to find
ULS, GLS or ML estimates of uniquenesses and loadings. The optimizer
minimizes a criterion as a function of log(psi), psi = vector of
uniquenesses.
You can specify a rotation method and starting values.
facanal() is to be preferred to other macros, including ulsfactor() and
glsfactor(), for factor extraction.
By default, minimizer bfs() is used but you can specify another
minimizer.
facanal(r, m, method:Meth) computes estimated uniquenesses and unrotated
estimated loadings for a orthogonal factor analysis based a p by p
correlation or covariance matix r which must be symmetric and positive
definite.
Integer m > 0 is the number of factors assumed. It must satisfy r <
(2*p + 1 - sqrt(8*p+1))/2
Meth is must be one of "mle" or "ml" (ML or maximum likelihood method),
"uls" (ULS or unweighted least squares method) or "gls" (GLS or
generalized least squares method). If you omit method:Meth, the default
is method:"mle".
In addition to the uniquenesses and loadings, facanal() prints the
minimized value of the criterion being minimized. This can be used in a
goodness of fit test.
See below for the value returned by facanal(). It is "invisible" unless
'quiet:T' or 'silent:T' is an argument.
facanal(r, m, method:Meth, start:psi0), does the same except that the
minimization iteration is started with uniquenesses psi0. The default
starting values are psi0 = 1/diag(solve(r)).
You control rotation of the estimated loadings using keywords 'rotate'
and 'kaiser'.
facanal(r, m, method:Meth, rotate:Rot), where Rot is one of "varimax",
"quartimax", "equimax" or "none" (the default), carries out the
indicated rotation of the factor loadings using Kaiser normalization.
It does not affect the values of the uniquenesses or criterion.
facanal(r, m, method:Meth, rotate:Rot,kaiser:F), does the same except
Kaiser normalization is not done.
There are several keywords you can use to control the actual
minimization of the criterion. Default values are in [..]
nmin:n1 integer n1 >= 0 = minimum number of interations performed
[0]
nmax:n2 integer n2 > 0 = maximum number of interations performed
[30]
crit:vector(nsig1,nsig2,dg)
nsig1 target number of significant digits in log uniquenesses
[5]
nsig2 target number of significant digits in the criterion [8]
dg target upper limit for ||gradient|| [-1]
Negative values of nsig1, nsig2 or dg are ignored.
minimizer:M M = name of minimizer, one of "dfp" (Davidon-Fletcher-
Powell), "bfs" (Broyden-Fletcher-Shanno) or "broyden"
["bfs"]
ngold:n integer n >= 0 = number of steps in golden mean linear
search by minimizer [1]; ignored with minimizer:"broyden"
facanal() requires and loads automatically one of the macros ulscrit(),
glscrit() or mlcrit() to compute the objective function, gradient vector
and loading matrix.
There are three keywords that you can use to control what gets printed.
quiet:T suppresses printing of results; the return value is
visible
silent:T same as quiet:T except warning messages are also
suppressed
printwhen:d1 d1 >= 0 integer specifies (when d1 > 0) that partial
results are printed at iterations d1, 2*d1, 3*d1. These
are the current values of x = log(uniquenesses), the F(x)
= criterion and the gradient vector dF(x)/dx
In addition to returning them, facanal() saves the estimated
uniquenesses, rotated loadings, minimized criterion, eigenvalues and
gradient vector in side-effect variables PSI, LOADINGS, CRITERION,
EIGENVALUES and GRADIENT, respectively.
Each time they are entered, ulscrit(), glscrit() or mlcrit() save a copy
of their argument psi in invisible variable _PSIULS, _PSIGLS or _PSIML.
You can use keyword 'recordwhen' to specify that partial results are
saved in side-effect structure BFSRECORD, DFPRECORD or BROYDNRECORD on
some or all iterations:
recordwhen:d2 d2 >= 0 integer specifies (when d2 > 0) that partial
results are saved at iterations d2, 2*d2, 3*d2, ...
Values of x = log(uniquenesses), F(x) = criterion and
dF(x)/df go in components 'xvalx', 'funval' and
'gradients' of the structure.
facanal() always returns as structure a value which can be assigned.
Unless 'silent:T' or 'quiet:T' is an argument, the return value is
"invisible" and won't be automatically printed.
The result has the form structure(psihat:psi,loadings:l,criterion:crit,
eigenvals:vals, gradient:g, method:Meth, rotation:Rot, iter:n, status:k)
where the values of the components are as follows:
psi REAL vector of estimated uniquenesses
l REAL p by m matrix of loadings
crit Minimized criterion
vals eigenvalues s relative to psi
g REAL gradient vector at optimum
n > 0 integer = number of iterations
k >= 0 integer specifying which (1, 2 or 3) of the convergence
criterion signalled convergence; k = 0 means not
converged
Cmd> facanal(cor(y),2,rotate:"varimax") # y a 50 by 5 matrix
Convergence in 26 iterations by criterion 2
estimated uniquenesses:
(1) 0.39881 5.4107e-07 0.20203 0.32915 0.63907
varimax rotated estimated loadings:
(1,1) 0.71121 0.30883
(2,1) 0.13876 0.99033
(3,1) -0.84817 -0.28032
(4,1) -0.80203 -0.16613
(5,1) 0.59678 -0.069151
minimized ml criterion:
(1) 0.013439
Cmd> result <- facanal(cor(y),2,rotate:"varimax",method:"uls",\
silent:T)
Cmd> compnames(result)
(1) "psihat"
(2) "loadings"
(3) "criterion"
(4) "eigenvals"
(5) "gradient"
(6) "method"
(7) "rotation"
(8) "iter"
(9) "status"
Cmd> result[vector(8,9)] # status = 0 => did not converge
component: iter
(1) 30
component: status
(1) 0
See also ulsfactor(), glsfactor(), ulscrit(), glscrit(), mlcrit(),
minimizer().
Gary Oehlert
2003-01-15