Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
General Statistics Examples

Example 8.4: Alpha Factor Analysis

This example shows how an algorithm for computing alpha factor patterns (Kaiser and Caffrey 1965) is transcribed into IML code.

For later reference, you could store the following ALPHA subroutine in an IML catalog and load it when needed.

   /*                Alpha Factor Analysis                      */
   /*  Ref: Kaiser et al., 1965 Psychometrika, pp. 12-13        */
   /*  r correlation matrix (n.s.) already set up               */
   /*  p number of variables                                    */
   /*  q number of factors                                      */
   /*  h communalities                                          */
   /*  m eigenvalues                                            */
   /*  e eigenvectors                                           */
   /*  f factor pattern                                         */
   /*  (IQ,H2,HI,G,MM) temporary use. freed up                  */
   /*                                                           */

   start alpha;
      p=ncol(r);
      q=0;
      h=0;                                        /* initialize */
      h2=i(p)-diag(1/vecdiag(inv(r)));                  /* smcs */
      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);
      f=hi*e*mm;                           /* resulting pattern */
      free iq h2 hi g mm;                   /* free temporaries */
   finish;

     /* Correlation Matrix from Harmon, Modern Factor Analysis, */
     /* 2nd edition, page 124, "Eight Physical Variables"       */

   r={1.000 .846 .805 .859 .473 .398 .301 .382 ,
       .846 1.000 .881 .826 .376 .326 .277 .415 ,
       .805 .881 1.000 .801 .380 .319 .237 .345 ,
       .859 .826 .801 1.000 .436 .329 .327 .365 ,
       .473 .376 .380 .436 1.000 .762 .730 .629 ,
       .398 .326 .319 .329 .762 1.000 .583 .577 ,
       .301 .277 .237 .327 .730 .583 1.000 .539 ,
       .382 .415 .345 .365 .629 .577 .539 1.000};
   nm = {Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8};
   run alpha;
   print ,"EIGENVALUES" , m;
   print ,"COMMUNALITIES" , h[rowname=nm];
   print ,"FACTOR PATTERN", f[rowname=nm];

The results are shown below.

EIGENVALUES
M
5.937855
2.0621956
0.1390178
0.0821054
0.018097
-0.047487
-0.09148
-0.100304

COMMUNALITIES
H
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
F
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

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.