General Statistics Examples


Example 10.4 Alpha Factor Analysis

This example shows how an algorithm for computing alpha factor patterns (Kaiser and Caffrey 1965) could be implemented in the SAS/IML language. This algorithm is similar to that provided by the METHOD=ALPHA option in the FACTOR procedure.

The following statements define a SAS/IML module for computing an alpha factor analysis. The input is a matrix of correlations. The module computes eigenvalues, communalities, and a factor pattern.

proc iml;
/*                Alpha Factor Analysis                      */
/*  Ref: Kaiser et al., 1965 Psychometrika, pp. 12-13        */
/*  Input:  r = correlation matrix                           */
/*  Output: m = eigenvalues                                  */
/*          h = communalities                                */
/*          f = factor pattern                               */
start alpha(m, h, f, r);
   p = ncol(r);
   q = 0;
   h = 0;                                      /* initialize */
   h2 = I(p) - diag(1/vecdiag(inv(r)));/* smc=sqrd mult corr */
   do while(max(abs(h-h2))>.001); /* iterate until converges */
      h = h2;
      hi = diag(sqrt(1/vecdiag(h)));
      g = hi*(r-I(p))*hi + I(p);
      call eigen(m,e,g);         /* get eigenvalues and vecs */
      if q=0 then do;
         q = sum(m>1);                  /* number of factors */
         iq = 1:q;
      end;                                   /* index vector */
      mm = diag(sqrt(m[iq,]));           /* collapse eigvals */
      e = e[,iq] ;                       /* collapse eigvecs */
      h2 = h*diag((e*mm) [,##]);        /* new communalities */
   end;
   hi = sqrt(h);
   h = vecdiag(h2);               /* communalities as vector */
   f = hi*e*mm;                         /* resulting pattern */
finish;

The following statements call the ALPHA module on a sample correlation matrix. The results are shown in Output 10.4.1.

/* Correlation Matrix from Harmon, Modern Factor Analysis, */
/* Second edition, page 124, "Eight Physical Variables"    */
nm = {Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8};
r ={ 1.00 .846 .805 .859 .473 .398 .301 .382 ,
     .846 1.00 .881 .826 .376 .326 .277 .415 ,
     .805 .881 1.00 .801 .380 .319 .237 .345 ,
     .859 .826 .801 1.00 .436 .329 .327 .365 ,
     .473 .376 .380 .436 1.00 .762 .730 .629 ,
     .398 .326 .319 .329 .762 1.00 .583 .577 ,
     .301 .277 .237 .327 .730 .583 1.00 .539 ,
     .382 .415 .345 .365 .629 .577 .539 1.00};
run alpha(Eigenvalues, Communalities, Factors, r);
print Eigenvalues,
      Communalities[rowname=nm],
      Factors[label="Factor Pattern" rowname=nm];

Output 10.4.1: Alpha Factor Analysis: Results

Eigenvalues
5.937855
2.0621956
0.1390178
0.0821054
0.018097
-0.047487
-0.09148
-0.100304

Communalities
VAR1 0.8381205
VAR2 0.8905717
VAR3 0.81893
VAR4 0.8067292
VAR5 0.8802149
VAR6 0.6391977
VAR7 0.5821583
VAR8 0.4998126

Factor Pattern
VAR1 0.813386 -0.420147
VAR2 0.8028363 -0.49601
VAR3 0.7579087 -0.494474
VAR4 0.7874461 -0.432039
VAR5 0.8051439 0.4816205
VAR6 0.6804127 0.4198051
VAR7 0.620623 0.4438303
VAR8 0.6449419 0.2895902