Hi All

To better understand the factor analysis (FA) based on the covariance
matrix better, I want to replicate more manually what my satistics
software package (SAS/STAT) outputs. To do that I used interactive
matrix language (SAS/IML). Independent from the specific syntax of this
lanuage, I dont have access to the specific formulas I need to do FA on
the covariance matrix. However, I was sucessful in replicating the FA
output of the package using the correlation matrix. It would be very
helpful, and I would greatly appreciate if one could look over my
partially correct partially incorrect (in comparison to the package
output) formulas that I used. Thanks a lot.

Bye Toby



Comment: The prior communality estimates are different than SAS/STAT
proc factor uses, however, I think it doesnt too much since both
(SAS/STAT proc factor and the eigvec and eigval functions of my SAS/IML
code) converged to the same eigenvalues and eigenvectors.

The problem may be in calculation the factor pattern.





proc iml;
use datafile;
read all var _all_ into X;

/*sample size n (1x1)*/
n = nrow (X);

/*number of variables in the dataset (1x1)*/
p = ncol (X);

/*just a n x n square matrix full of 1 (nxn)*/
J = shape (1, n, n);

/*mean centered data matrix (nxp)*/
Xd = X - (J / n)` * X;
reset print;

/*variance covariance matrix of the datamatrix (pxp)*/
S = (1 / (n - 1)) * Xd` * Xd;

/*diag matrix of prior communality estimates/squared multiple
correlations (pxp) (not the same as the SAS/STAT proc factor yields)*/
thetau = diag (1 - (1 / (S ** (-1))));

/*reduced variance covariance matrix (by 1 - prior communality
estimates) (i is an identity matrix of pxp) (pxp)*/
Sr = S - (i (p) - thetau);

/*eigenvalues of the reduced variance covariance matrix (px1) (match
with SAS/STAT proc factor output)*/
lambdal = eigval (Sr);

/*eigenvectors of the reduced variance covariance matrix (pxp) match
with SAS/STAT proc factor output)*/
U = eigvec (Sr);

/*diagonal matrix of eigenvalues (pxp)*/
D = diag (lambdal);

/*trace of diagonal matrix of eigenvalues (1x1)*/
trace = trace (D);

/*factor pattern based on the eigenvectors multiplied by the diagonal
matrix of eigenvalues (pxp) (doesnt match SAS/STAT proc factor although
U and D match)*/
lambdau = U * sqrt (D * D);

/*factors chosen to retain (1x1)*/
c = 4;

/*factor pattern consisting only of the factors retained (pxc) (doesnt
match, i get values greater than 1)*/
lambdauc = lambdau[1:p, 1:c];

/*standardized scoring coefficients (pxc) (doesnt match)*/
B = Sr ** (-1) * lambdauc;
quit;






.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
.                  http://jse.stat.ncsu.edu/                    .
=================================================================

Reply via email to