<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d25388941\x26blogName\x3dThrough+Foreign+Eyes\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://wildthoughtsfaq.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://wildthoughtsfaq.blogspot.com/\x26vt\x3d6141665306460740873', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
MWave 468x60

Lakaw is a journey is a step is a move. I love to travel around the world and this is my travel and travel gadget site. Welcome and Enjoy!

0 comments | Tuesday, February 19, 2008

SAS software has a procedure called "PROC PRINCOMP" for performing Principal Components Analysis. The eigenvalues and eigenvectors of the sample variance-covariance matrix can be computed. Eigenvalues are the variances of the principal components. Eigenvectors are the loadings of the principal components. The procedure can also create a new set of data that contains the values of the principal component scores. This new data can be used for later data analysis.

Here is an example of a SAS code to run a Principal Components Analysis.
*****

dm log 'clear';
dm output 'clear';
options nodate;

data PCA;
input X1 X2 X3 X4 X5 X6 X7 X8;
datalines;
6 7 2 5 8 7 8 8

9 10 5 8 10 9 9 10

7 8 3 6 9 8 9 7

5 6 8 5 6 5 9 2

6 8 8 8 4 4 9 5

7 7 7 6 8 7 10 5

9 9 8 8 8 8 8 8

9 9 9 8 9 9 8 8

9 9 7 8 8 8 8 5

4 7 10 2 10 10 7 10

4 7 10 0 10 8 3 9

4 7 10 4 10 10 7 8

6 9 8 10 5 4 9 4

8 9 8 9 6 3 8 2

4 8 8 7 5 4 10 2
6 9 5 7 8 9 8 9

8 7 7 7 9 5 8 6

6 8 8 4 8 8 6 4

6 7 8 4 7 8 5 4

4 8 7 8 8 9 10 5

;

PROC PRINCOMP DATA=PCA OUT=PCSCORES COVARIANCE;
VAR X1--X8;
title 'Principal Component Analysis';
RUN;


PROC FACTOR DATA=PCA scree;
VAR X1--X8;

TITLE2'Scree Plot of Eigenvalues';
RUN;

PROC PRINT DATA=PCSCORES;
VAR PRIN1 PRIN2 PRIN3;
TITLE2 'VALUES OF THE FIRST THREE PRINCIPAL COMPONENT SCORES';
RUN;


proc univariate data=pcscores plot;
var prin1 prin2;
TITLE2 'Univariate Analysis on the first two Principal Components';

run;

proc gplot DATA=PCSCORES;
plot prin2*prin1;
TITLE2 'A Scatter Plot of the First Two Principal Component Scores';

run;

quit;

*****
Acknowledgments goes to Weiming Ke, PhD (SDSU, Department of Mathematics and Statistics).

Labels:

0 Comments:

Links to this post:

Create a Link

<< Home

More Interesting Stories

Related Posts with Thumbnails