Date: Sat, 23 Feb 2002 13:05:30 +0100 Gottfried Helms "SPSSX(r) Discussion" Gottfried Helms factoranalysis. How to reproduce SPSS-results? text/plain; charset=ISO-8859-1; format=flowed

Hi Listies-

(crosspost to com.soft-sys.stat.spss, without no answers)

I'm still programming the algorithm, which solves the principal-axis-analysis - but after I corrected a small bug, I still I get results, which are different to that of my reference, SPSS in this case. Am I doing a mistake in there? Or do I overlook something?

The matter is the simple (?) task to implement the hotelling- method, if I remember the SPSS-papers right. With only 1 factor everything is fine now.

For instance the extraction of an eigenvalue/eigenvector of a matrix: (below the pseudocode of a appropriate function)

ExtraktPrincFaktor (IN R:Matrix; out LAMBDA:real;out FACTOR:Vector) ===START================================================================ IN: R : correlationsmatrix

init: A2 <- norm({1,1,1,1}) // any startingvalues // the function norm(X) causes: sum( x[i]²)=1

iterate: A1 <- A2 A2 <- norm(A1*R) until sqsum(A2-A1) < epsilon //the function sqsum(X) returns: sum of squared elements

results: A1 // first eigenvector Out: LAMBDA <- A1* R* A1' // first eigenvalue of R Out: FACTOR <- sqrt(LAMBDA)*A1' // first principal factor

===End==================================================================

Everything is fine for a single, first factor and presents the expected reference-values.

With the second factor I get stuck, because, let's say, the documentation of SPSS-Factor-method is too less detailed .

What I'm doing is:

given: R // given correlations-matrix

Init: R1 <- R // for first factor Compute: ExtractPrincFaktor ( R1, lambda1, faktor1)

after that, for the computation of factor 2, factor 1 has to be extracted from R1:

Init: R2 <- R1 - Faktor1*Faktor1' //for 2.nd factor Compute: ExtractPrincFaktor ( R2, lambda2, faktor2)

This can only run, if I estimate communalities to be 1, like in PCA, done in the line "INIT: R1 <- R ", since the diagonal of R is all 1.

Now I want to perform a principal-axes-factoring, like SPSS-PAF. I estimate the communalities as the SMC's of all variables and insert them into the diagonal of R1, before I start extracting the first factor. Also that is fine, my results are the same with SPSS.

Init: R1 <- R InsertDiag (R1, GetCommunalities(R1)) // in the main diagonal of R1 are now values<1

If I compute now the first factor:

Compute: ExtractPrincFaktor ( R1, lambda1, faktor1)

and extract this factor from R1:

Init: R2 <- (R1 - Faktor1*Faktor1')

then I can have negative values in the diagonal very easily, and cannot go further with calculations. These values can be far higher than a common epsilon, and even if I replace negative values by zero I cannot reproduce the second vector, that SPSS boldly presents. It looks, as if SPSS starts another track, if negative values occur in the diagonal. But what? Or do I miss something important? Data are given below.

regards- Gottfried.

------------------------------------------------------------------

Example: R : 1,000 0,800 0,700 0,600 0,800 1,000 0,600 0,500 0,700 0,600 1,000 0,600 0,600 0,500 0,600 1,000

R1, after insertion of communalities: R1 0,731 0,800 0,700 0,600 0,800 0,643 0,600 0,500 0,700 0,600 0,544 0,600 0,600 0,500 0,600 0,424

SPSS presents from R with

factor /matrix IN(cor=*) /crit factors(1) iterate(1) /extraction paf /rot norotate .

the following intermediate results after 1. iteration:

spssfactors F1 F2 0,896 -0,080 0,812 -0,175 0,772 0,130 0,674 0,168

I get - after first iteration - correctly the factor 1:

Gottfriedfactors F1 0,896 0,812 0,772 0,674

but cannot procees to determine factor 2, because R1-Faktor1*Faktor1' produces negative values in the main diagonal:

R2 -0,071 0,073 0,009 -0,003 0,073 -0,016 -0,027 -0,047 0,009 -0,027 -0,052 0,080 -0,003 -0,047 0,080 -0,030 ========================

Yes. What is wrong? What is the second step to do?

Gottfried.

Back to: Top of message | Previous page | Main SPSSX-L page