I'm trying to use Matrix-End Matrix to work out a small factor analytic problem (4 variables and 5 cases) from Tabachnick and Fidell's Using Multivariate Statistics (5th Ed.), p 615-628. I'm able to compute the four eigenvalues of 2.016305104, 1.941513814, .037812306, and .004368776 and the associated eigenvector matrix (see Matrix-End Matrix code below). However, Tabachnick et al., in the section I'm working from, reanalyses the correlation matrix restricting the solution to two values and vectors: "In this example, when no limit is placed on the number of factors, eigenvalues of 2.02, 1.94, 04, and .00 are computed for each of the four possible factors. Only the first two factors, with values over 1.00, are large enough to be retained in subsequent analyses. FA us rerun specifying extraction of just the first two factors; they have eignevalues of 2.00 and 1.91, respectively, as indicated in Table 13.3. [The new Eigenvectors are included too; p 617-618].
How do I only extract a two factor solution in Matrix-End Matrix? TIA Stephen Salbod, Pace University, NYC MATRIX. ***** This section creates data matrix-A. COMPUTE A = {32,64,65,67; 61,37,62,65; 59,40,45,43; 36,62,34,35; 62,46,43,40}. ***** This section creates a deviation matrix-X (A-M). COMPUTE N = NROW(A). COMPUTE ONE=MAKE(N,N,1). COMPUTE X = A - (ONE*A)*(1/N). ***** This section computes the a variance-covariance matrix-S . COMPUTE tranX = TRANSPOS(X). COMPUTE prodX = tranX*X. COMPUTE S = (1/(N-1))*prodX. COMPUTE invS = INV(S). PRINT S /TITLE = "Covariance Matrix S". PRINT invS /TITLE = "Inverse of S". ***** This section computes the correlation matrix-R. COMPUTE rtdiagS = SQRT(DIAG(S)). COMPUTE rtD = MDIAG(rtdiagS). COMPUTE invrtD = inv(rtD). COMPUTE R = invrtD*S*invrtD. PRINT R /TITLE = "R, the correlation matrix" /FORMAT = "F6.3". CALL EIGEN(R, EIGENVEC, EIGENVAL). PRINT EIGENVEC. PRINT EIGENVAL. END MATRIX. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Stephen,
I'm not familiar with T&F nor am I algebraically familiar with different eigenvalue/vector extraction routines. However, my limited knowledge of eigenvalues makes me suspicious that the eigenvalues/vectors depend on the number of them extracted. Since T&F report different values for the first two factors I wonder whether they may have indulged in some type of adjustment of the main diagonal, i.e., to adjust the communalities, between the first and second extractions. What do they say about the model (principle components, common factor, etc) and the communalities? Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Salbod, Mr. Stephen Sent: Wednesday, January 18, 2012 10:19 AM To: [hidden email] Subject: Matrix-End Matrix question I'm trying to use Matrix-End Matrix to work out a small factor analytic problem (4 variables and 5 cases) from Tabachnick and Fidell's Using Multivariate Statistics (5th Ed.), p 615-628. I'm able to compute the four eigenvalues of 2.016305104, 1.941513814, .037812306, and .004368776 and the associated eigenvector matrix (see Matrix-End Matrix code below). However, Tabachnick et al., in the section I'm working from, reanalyses the correlation matrix restricting the solution to two values and vectors: "In this example, when no limit is placed on the number of factors, eigenvalues of 2.02, 1.94, 04, and .00 are computed for each of the four possible factors. Only the first two factors, with values over 1.00, are large enough to be retained in subsequent analyses. FA us rerun specifying extraction of just the first two factors; they have eignevalues of 2.00 and 1.91, respectively, as indicated in Table 13.3. [The new Eigenvectors are included too; p 617-618]. How do I only extract a two factor solution in Matrix-End Matrix? TIA Stephen Salbod, Pace University, NYC MATRIX. ***** This section creates data matrix-A. COMPUTE A = {32,64,65,67; 61,37,62,65; 59,40,45,43; 36,62,34,35; 62,46,43,40}. ***** This section creates a deviation matrix-X (A-M). COMPUTE N = NROW(A). COMPUTE ONE=MAKE(N,N,1). COMPUTE X = A - (ONE*A)*(1/N). ***** This section computes the a variance-covariance matrix-S . COMPUTE tranX = TRANSPOS(X). COMPUTE prodX = tranX*X. COMPUTE S = (1/(N-1))*prodX. COMPUTE invS = INV(S). PRINT S /TITLE = "Covariance Matrix S". PRINT invS /TITLE = "Inverse of S". ***** This section computes the correlation matrix-R. COMPUTE rtdiagS = SQRT(DIAG(S)). COMPUTE rtD = MDIAG(rtdiagS). COMPUTE invrtD = inv(rtD). COMPUTE R = invrtD*S*invrtD. PRINT R /TITLE = "R, the correlation matrix" /FORMAT = "F6.3". CALL EIGEN(R, EIGENVEC, EIGENVAL). PRINT EIGENVEC. PRINT EIGENVAL. END MATRIX. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
I no longer have my copy of T&F (BTW: I was a student of both authors in the 80's).
AFAIK: The Eigenvalues are *NOT* going to change as a function of the number of retained components. The number of retained components serves only as a base for which vectors are subjected to rotation! I believe we need more detail re what is going on between pg 615-618.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
It is *NOT* obvious where they are obtaining the alleged eigenvectors.
AFAICT they are *INCORRECT*. They certainly don't match anything in SPSS output. They would not vary based upon the number of components extracted (likewise for the eigenvalues). My mods of your program with additional calcs. DATA LIST FREE /V1 TO V4. BEGIN DATA 32,64,65,67 61,37,62,65 59,40,45,43 36,62,34,35 62,46,43,40 end data. FACTOR /VARIABLES v1 v2 v3 v4 /CRITERIA FACTORS(4). FACTOR /VARIABLES v1 v2 v3 v4 /CRITERIA FACTORS(2). MATRIX. ***** This section creates data matrix-A. COMPUTE A = {32,64,65,67; 61,37,62,65; 59,40,45,43; 36,62,34,35; 62,46,43,40}. ***** This section creates a deviation matrix-X (A-M). COMPUTE X = A - (MAKE(NROW(A),NROW(A),1)*A)*(1/NROW(A)). ***** This section computes the a variance-covariance matrix-S . COMPUTE S = (1/(NROW(A)-1))*TRANSPOS(X)*X. PRINT S /TITLE = "Covariance Matrix S". PRINT (INV(S))/TITLE = "Inverse of S". ***** This section computes the correlation matrix-R. COMPUTE rtD = MDIAG(SQRT(DIAG(S))). COMPUTE invrtD = Ginv(rtD). COMPUTE R = invrtD*S*invrtD. *PRINT R /TITLE = "R, the correlation matrix" /FORMAT = "F6.3". CALL EIGEN(R, EIGENVEC, EIGENVAL). COMPUTE COMPMat=EIGENVEC *MDIAG(SQRT(EIGENVAL)). PRINT EIGENVAL /TITLE "EigenValues". PRINT EIGENVEC / TITLE "Eigenvectors" PRINT COMPMAT / TITLE "Components Matrix". *----------------------------------------------- ** VARIOUS FUBAR ATTEMPTS AT FIGURING OUT WTF T&F are doing *. COMPUTE REDVEC=EIGENVEC(:,1:2). COMPUTE EVAL2=T(REDVEC)*R*REDVEC. PRINT EVAL2. COMPUTE CRED=COMPMAT(:,1:2). COMPUTE NEWR=CRED*T(CRED). PRINT NEWR. CALL EIGEN(NewR, EIGVEC2, EIGVAL2). PRINT EIGVEC2. PRINT EIGVAL2. END MATRIX.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
I was able to reproduce the eigenvalues from the T&F 2 factor solution by using principal axis factoring (PAF) rather than principle components (PC) . Consult the algorithms for specifics on the difference (primarily, the substitution of the diagonals of R with the estimated communalities at each iteration of the solution). I have *NO* idea where they are getting the published eigenvectors.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Hi David,
I appreciate all the time and thought you've put into this problem. Your modifications to the code are enlightening (makes it readable). And, once again (thank you for pointing it out) I missed the obvious: the communality estimates in the major diagonal. I can now see T&F are unclear in their presentation--that is a major step for me. Thank you! --Steve |
Administrator
|
Hi Steve,
Moving a little further: I tried the following *QAD* (PAF) implementation with MATRIX. Results are pretty close but not exact so wondering where I might be straying (see Factor loadings are not as close as one would expect and one of the final communalities exceeds 1). Might work better with a data set with larger N? Anyhow, definitely just illustrative and not intended for production use. -- DATA LIST FREE /V1 TO V4. BEGIN DATA 32,64,65,67 61,37,62,65 59,40,45,43 36,62,34,35 62,46,43,40 end data. FACTOR /VARIABLES v1 v2 v3 v4 /CRITERIA FACTORS(2)/CRIT ITER(50)/extraction=paf . CORR V1 TO V4 / MATRIX OUT (*). MATRIX. MGET FILE */TYPE=COR . PRINT CR /TITLE = "R, the correlation matrix" /FORMAT = "F6.3". ***------------------------------------------------------------***. CALL EIGEN(CR, EVEC, EVALue). COMPUTE COMPMat=EVEC *MDIAG(SQRT(EVALue)). PRINT EVALue /TITLE "Initial EigenValues". PRINT EVEC / TITLE "Initial Eigenvectors". PRINT COMPMAT / TITLE "Initial Components Matrix". COMPUTE NFAC=NCOL(CR). LOOP #=1 TO NCOL(CR). + DO IF EVALue(#) <1. + COMPUTE EVALue(#)=0. + COMPUTE NFAC=NFAC-1. + END IF. END LOOP. LOOP #0=1 TO 25. * CR-(I-MDiag(Communalities)). + CALL EIGEN(CR-MDIAG(MAKE(NCOL(CR),1,1)-RSUM(EVEC&*EVEC *MDIAG(EVALue))) ,EVEC, EVALue). + COMPUTE EVALue=EVALUE(1:NFAC). + COMPUTE EVEC=EVEC(:,1:NFAC). END LOOP. COMPUTE COMPMat=EVEC *MDIAG(SQRT(EVALue)). COMPUTE C=MDIAG(RSUM(EVEC&*EVEC *MDIAG(EVALue)) ). PRINT EVEC /TITLE "Eigenvectors from PAF". PRINT EVALue / TITLE "Eigenvalues from PAF". PRINT COMPMAT /TITLE "Factor Matrix". PRINT (T(DIAG(C)))/TITLE "Communalities". END MATRIX. ** OUTPUT from FACTOR. Communalities Initial Extraction V1 .961 .970 V2 .953 .960 V3 .990 .989 V4 .991 .996 Extraction Method: Principal Axis Factoring. Total Variance Explained Factor Initial Eigenvalues Extraction Sums of Squared Loadings Total % of Variance Cumulative % Total % of Variance Cumulative % 1 2.016 50.408 50.408 2.005 50.118 50.118 2 1.942 48.538 98.945 1.909 47.733 97.852 3 .038 .945 99.891 4 .004 .109 100.000 Extraction Method: Principal Axis Factoring. Factor Matrix Factor 1 2 V1 -.400 .900 V2 .251 -.947 V3 .932 .348 V4 .956 .286 Extraction Method: Principal Axis Factoring. a 2 factors extracted. 4 iterations required. ** Output from MATRIX **. R, the correlation matrix 1.000 -.953 -.055 -.130 -.953 1.000 -.091 -.036 -.055 -.091 1.000 .990 -.130 -.036 .990 1.000 Initial EigenValues 2.016305104 1.941513814 .037812306 .004368776 Initial Eigenvectors .3524130186 .6143298243 .6624913038 .2439450833 -.2511248167 -.6637642199 .6758934421 .1988000044 -.6273986982 .3222290586 .2754625014 -.6531919454 -.6473888045 .2796146654 -.1685044144 .6887014135 Initial Components Matrix .5004147107 .8559962110 .1288239950 .0161239696 -.3565888485 -.9248772154 .1314300926 .0131400280 -.8908851872 .4489882182 .0535647483 -.0431738443 -.9192704702 .3896100835 -.0327663348 .0455209036 Eigenvectors from PAF -.2880998600 .6499228582 .1819297804 -.6830412264 .6508185424 .2551003796 .6784801033 .2144265791 Eigenvalues from PAF 2.005761789 1.909914895 Factor Matrix -.4080211955 .8981912491 .2576579056 -.9439607249 .9217212384 .3525478843 .9608969018 .2963368260 Communalities .973228816 .957449446 .973860052 1.011138370 ------ END MATRIX -----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |