Docsity

SAS Code and Output for Principal Component Analysis of Eurojobs Data - Prof. B. Habing, Study notes of Statistics

Toggle sidebar
bg1
The SAS code and output for Example 7.1 on page 99-104
DATA eurojobs;
INPUT Country $ Agr Min Man PS Con SI Fin SPS TC;
CARDS;
Belgium 3.3 0.9 27.6 0.9 8.2 19.1 6.2 26.6 7.2
Denmark 9.2 0.1 21.8 0.6 8.3 14.6 6.5 32.2 7.1
France 10.8 0.8 27.5 0.9 8.9 16.8 6.0 22.6 5.7
W_Germany 6.7 1.3 35.8 0.9 7.3 14.4 5.0 22.3 6.1
Ireland 23.2 1.0 20.7 1.3 7.5 16.8 2.8 20.8 6.1
Italy 15.9 0.6 27.6 0.5 10.0 18.1 1.6 20.1 5.7
Luxembourg 7.7 3.1 30.8 0.8 9.2 18.5 4.6 19.2 6.2
Netherlands 6.3 0.1 22.5 1.0 9.9 18.0 6.8 28.5 6.8
United_Kingdom 2.7 1.4 30.2 1.4 6.9 16.9 5.7 28.3 6.4
Austria 12.7 1.1 30.2 1.4 9.0 16.8 4.9 16.8 7.0
Finland 13.0 0.4 25.9 1.3 7.4 14.7 5.5 24.3 7.6
Greece 41.4 0.6 17.6 0.6 8.1 11.5 2.4 11.0 6.7
Norway 9.0 0.5 22.4 0.8 8.6 16.9 4.7 27.6 9.4
Portugal 27.8 0.3 24.5 0.6 8.4 13.3 2.7 16.7 5.7
Spain 22.9 0.8 28.5 0.7 11.5 9.7 8.5 11.8 5.5
Sweden 6.1 0.4 25.9 0.8 7.2 14.4 6.0 32.4 6.8
Switzerland 7.7 0.2 37.8 0.8 9.5 17.5 5.3 15.4 5.7
Turkey 66.8 0.7 7.9 0.1 2.8 5.2 1.1 11.9 3.2
Bulgaria 23.6 1.9 32.3 0.6 7.9 8.0 0.7 18.2 6.7
Czechoslovakia 16.5 2.9 35.5 1.2 8.7 9.2 0.9 17.9 7.0
E_Germany 4.2 2.9 41.2 1.3 7.6 11.2 1.2 22.1 8.4
Hungary 21.7 3.1 29.6 1.9 8.2 9.4 0.9 17.2 8.0
Poland 31.1 2.5 25.7 0.9 8.4 7.5 0.9 16.1 6.9
Rumania 34.7 2.1 30.1 0.6 8.7 5.9 1.3 11.7 5.0
USSR 23.7 1.4 25.8 0.6 9.2 6.1 0.5 23.6 9.3
Yugoslavia 48.7 1.5 16.8 1.1 4.9 6.4 11.3 5.3 4.0
;
PROC FACTOR DATA=eurojobs
SIMPLE
METHOD=PRIN
PRIORS=ONE
NFACT=9
SCREE
ROTATE=NONE;
VAR Agr Min Man PS Con SI Fin SPS TC;
RUN;
The eigenvalues in Table 7.1 are found in the table on the second page of output produced by the above
commands. To find the eigenvectors you would need to use PROC PRINCOMP instead.
pf3
pf4
pf5

Partial preview of the text

Download SAS Code and Output for Principal Component Analysis of Eurojobs Data - Prof. B. Habing and more Study notes Statistics in PDF only on Docsity!

The SAS code and output for Example 7.1 on page 99-

DATA eurojobs;

INPUT Country $ Agr Min Man PS Con SI Fin SPS TC;

CARDS;

Belgium 3.3 0.9 27.6 0.9 8.2 19.1 6.2 26.6 7.

Denmark 9.2 0.1 21.8 0.6 8.3 14.6 6.5 32.2 7.

France 10.8 0.8 27.5 0.9 8.9 16.8 6.0 22.6 5.

W_Germany 6.7 1.3 35.8 0.9 7.3 14.4 5.0 22.3 6.

Ireland 23.2 1.0 20.7 1.3 7.5 16.8 2.8 20.8 6.

Italy 15.9 0.6 27.6 0.5 10.0 18.1 1.6 20.1 5.

Luxembourg 7.7 3.1 30.8 0.8 9.2 18.5 4.6 19.2 6.

Netherlands 6.3 0.1 22.5 1.0 9.9 18.0 6.8 28.5 6.

United_Kingdom 2.7 1.4 30.2 1.4 6.9 16.9 5.7 28.3 6.

Austria 12.7 1.1 30.2 1.4 9.0 16.8 4.9 16.8 7.

Finland 13.0 0.4 25.9 1.3 7.4 14.7 5.5 24.3 7.

Greece 41.4 0.6 17.6 0.6 8.1 11.5 2.4 11.0 6.

Norway 9.0 0.5 22.4 0.8 8.6 16.9 4.7 27.6 9.

Portugal 27.8 0.3 24.5 0.6 8.4 13.3 2.7 16.7 5.

Spain 22.9 0.8 28.5 0.7 11.5 9.7 8.5 11.8 5.

Sweden 6.1 0.4 25.9 0.8 7.2 14.4 6.0 32.4 6.

Switzerland 7.7 0.2 37.8 0.8 9.5 17.5 5.3 15.4 5.

Turkey 66.8 0.7 7.9 0.1 2.8 5.2 1.1 11.9 3.

Bulgaria 23.6 1.9 32.3 0.6 7.9 8.0 0.7 18.2 6.

Czechoslovakia 16.5 2.9 35.5 1.2 8.7 9.2 0.9 17.9 7.

E_Germany 4.2 2.9 41.2 1.3 7.6 11.2 1.2 22.1 8.

Hungary 21.7 3.1 29.6 1.9 8.2 9.4 0.9 17.2 8.

Poland 31.1 2.5 25.7 0.9 8.4 7.5 0.9 16.1 6.

Rumania 34.7 2.1 30.1 0.6 8.7 5.9 1.3 11.7 5.

USSR 23.7 1.4 25.8 0.6 9.2 6.1 0.5 23.6 9.

Yugoslavia 48.7 1.5 16.8 1.1 4.9 6.4 11.3 5.3 4.

PROC FACTOR DATA=eurojobs

SIMPLE

METHOD=PRIN

PRIORS=ONE

NFACT=

SCREE

ROTATE=NONE;

VAR Agr Min Man PS Con SI Fin SPS TC;

RUN;

The eigenvalues in Table 7.1 are found in the table on the second page of output produced by the above

commands. To find the eigenvectors you would need to use PROC PRINCOMP instead.

The FACTOR Procedure Initial Factor Method: Principal Components

Prior Communality Estimates: ONE

Eigenvalues of the Correlation Matrix: Total = 9 Average = 1

EigenvalueEigenvalueEigenvalueEigenvalue Difference Proportion Cumulative

9 factors will be retained by the NFACTOR criterion.

To produce the output on page 101, we would want to restrict the output to four factors:

PROC FACTOR DATA=eurojobs

SIMPLE

METHOD=PRIN

PRIORS=ONE

NFACT=

SCREE

ROTATE=NONE;

VAR Agr Min Man PS Con SI Fin SPS TC;

RUN;

From page 5 of this output we get the following (with the underlining and bold face again provided by me, and

not SAS.)

The FACTOR Procedure Rotation Method: Varimax

Orthogonal Transformation Matrix

1 2 3 4

Rotated Factor Pattern

Factor1 Factor2 Factor3 Factor

Agr - ---0.687350.687350.687350.68735 - -0.56893--0.568930.568930.56893 -0.31441 -0. Min -0.22360 0.13264 - ---0.550100.550100.550100.55010 0.700990.700990.700990. Man 0.13317 0.750550.750550.750550.75055 -0.11729 0. PS 0.22600 0.02259 0.15751 0.892560.892560.892560. Con 0.15587 0.898310.898310.898310.89831 0.03230 -0. SI 0.529630.529630.529630.52963 0.33280 0.621700.621700.621700.62170 -0. Fin -0.06685 -0.05058 0.911860.911860.911860.91186 0. SPS 0.932290.932290.932290.93229 0.04105 0.17350 -0. TC 0.769970.769970.769970.76997 0.23183 -0.33235 0.

Variance Explained by Each Factor

Factor1 Factor2 Factor3 Factor

Final Communality Estimates: Total = 7.

Agr Min Man PS Con

0.96627097 0.86159014 0.83361535 0.87305005 0.

SI Fin SPS TC

0.77894807 0.83954493 0.90380919 0.

Notice that the reason it looks different is that Factors 2 and 4 are reversed!

The above code uses the option PRIORS=ONE. Some would argue that using PRIORS=ONE is simply

performing a “Principal Components Analysis.” Instead, it is probably better to use the option PRIOS=SMC

which would result in a “Principal Factors Analysis.” (We could also try the option METHOD=ML which

would perform a “Maximum-likelihood Factor Analysis”...)

PROC FACTOR DATA=eurojobs

SIMPLE

METHOD=PRIN

PRIORS=SMC

NFACT=

SCREE

ROTATE=VARIMAX;

VAR Agr Min Man PS Con SI Fin SPS TC;

RUN;

Rotated Factor Pattern

Factor1 Factor2 Factor3 Factor

Agr -0.69287 -0.55552 -0.31962 -0.

Min -0.22041 0.10285 -0.52049 0.

Man 0.13611 0.72885 -0.10021 0.

PS 0.22911 0.01556 0.16077 0.

Con 0.15579 0.90630 0.02270 -0.

SI 0.53523 0.33329 0.61674 -0.

Fin -0.05899 -0.05460 0.91583 0.

SPS 0.93479 0.03791 0.16660 -0.

TC 0.76515 0.22778 -0.33204 0.

Notice that is very similar to the output on the previous page.