The HPPRINCOMP Procedure

Example 59.3 Extracting Principal Components with NIPALS

(View the complete code for this example.)

This example demonstrates the NIPALS method in PROC HPPRINCOMP, which extracts principal components successively. The data that this example uses are from the Getting Started section; they provide crime rates per 100,000 people in seven categories for each of the 50 US states in 1977. The following DATA step generates the data:

data Crime;
   title 'Crime Rates per 100,000 Population by State';
   input State $1-15 Murder Rape Robbery Assault
         Burglary Larceny Auto_Theft;
   datalines;
Alabama        14.2 25.2  96.8 278.3 1135.5 1881.9 280.7
Alaska         10.8 51.6  96.8 284.0 1331.7 3369.8 753.3
Arizona         9.5 34.2 138.2 312.3 2346.1 4467.4 439.5
Arkansas        8.8 27.6  83.2 203.4  972.6 1862.1 183.4
California     11.5 49.4 287.0 358.0 2139.4 3499.8 663.5

   ... more lines ...   

Wisconsin       2.8 12.9  52.2  63.7  846.9 2614.2 220.7
Wyoming          .  21.9  39.7 173.9  811.6 2772.2 282.0
;

The following statements use PROC HPPRINCOMP to extract principal components by using the NIPALS method:

proc hpprincomp data=Crime method=nipals;
run;

Output 59.3.1 displays the PROC HPPRINCOMP output. The "Model Information" table shows that the NIPALS method is used to extract principal components. The "Explained Variation of Variables" table lists the fraction of variation that is accounted for in each variable by each of the seven principal components. All the variation in each variable is accounted for by seven principal components because there are only seven variables. The eigenvalues indicate that two or three components provide a good summary of the data: two components account for 76% of the total variance, and three components account for 87%. Subsequent components account for less than 5% each.

Note that in the Getting Started section, the principal components are extracted from the same data by using the eigenvalue decomposition method; the "Eigenvalues" table generated there matches the one generated by the NIPALS method. Also, the eigenvectors in the "Eigenvectors" table match the loading factors in the "Loadings" table.

Output 59.3.1: Results of Principal Component Analysis Using NIPALS

Crime Rates per 100,000 Population by State

The HPPRINCOMP Procedure

Performance Information
Execution ModeSingle-Machine
Number of Threads4

Data Access Information
DataEngineRolePath
WORK.CRIMEV9InputOn Client

Model Information
Data SourceWORK.CRIME
Component Extraction MethodNIPALS

Number of Observations Read50
Number of Observations Used48

Number of Variables7
Number of Principal Components7

Centering and Scaling Information
VariableSubtracted offDivided by
Murder7.516673.93059
Rape26.0750010.81304
Robbery127.5562588.49374
Assault214.58750100.64360
Burglary1316.37917423.31261
Larceny2696.88542714.75023
Auto_Theft383.97917194.37033

Explained Variation of Variables
VariablePrin1Prin2Prin3Prin4Prin5Prin6Prin7
Murder0.371170.855390.877900.895620.975550.991431.00000
Rape0.762420.799170.840590.841990.850650.990411.00000
Robbery0.637830.640640.821640.929420.997880.999921.00000
Assault0.635170.791270.793410.917810.988220.995131.00000
Burglary0.789130.844140.881830.882070.885440.948001.00000
Larceny0.513730.721780.937180.954790.954920.955301.00000
Auto_Theft0.336380.657460.904810.961970.996230.997061.00000

Eigenvalues of the Data Matrix
 EigenvalueDifferenceProportionCumulative
14.0458242.7817950.57800.5780
21.2640300.5165290.18060.7586
30.7475000.4211750.10680.8653
40.3263250.0611190.04660.9120
50.2652070.0368430.03790.9498
60.2283640.1056130.03260.9825
70.122750 0.01751.0000

Loadings
VariablePrin1Prin2Prin3Prin4Prin5Prin6Prin7
Murder0.30289-0.618930.17353-0.233080.54896-0.26371-0.26428
Rape0.43410-0.17053-0.235390.065400.180750.782320.27946
Robbery0.397050.047130.49208-0.57470-0.508080.094520.02497
Assault0.39622-0.35142-0.053430.61744-0.51525-0.17395-0.19921
Burglary0.441640.20861-0.22454-0.027500.11273-0.523400.65085
Larceny0.356340.40570-0.53681-0.232310.02172-0.04085-0.60346
Auto_Theft0.288340.504000.575240.418530.359390.06024-0.15487