



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




(^11 11 12 13 1112 ) 22 12 22 23 22 12 23 33 13 23 33 33 13 23
11 22 33
dm 'log;clear;output;clear;'; options ps= 50 ls= 70 pageno= 1 ; goptions reset=global border ftext=swiss gunit=cm htext= 0.4 htitle= 0.5 ; options mprint symbolgen mlogic; goptions display noprompt; **********************************************************************; ** **; ** AUTHOR: Chris Bilder **; ** COURSE: STAT 873 **; ** DATE: 9-14-03 **; ** PURPOSE: Chapter 5 HW **; ** **; ** NOTES: **; ** **; **********************************************************************; title1 'Chris Bilder, STAT 873'; data big8; length school $ 14 ; *This makes sure the full name is in the data set; *Otherwise, school would have the length of colorado; input SCHOOL$ GAMES RO_YDS RD_YDS PO_YDS PD_RAT TO_YDS TD_YDS SO SD TOM WINS; datalines; COLORADO 11 291.5 114.2 203.8 125.2 495.3 343.7 36.2 19.2 0.55 10 IOWA_STATE 11 178.0 272.8 137.1 137.1 315.1 460.7 17.5 33.0 -0.64 0. KANSAS 11 247.1 171.2 140.9 135.8 363.3 400.7 28.5 22.0 0.73 6. KANSAS_STATE 11 125.6 167.5 237.6 94.3 363.3 312.5 27.7 14.2 1.18 9. MISSOURI 12 107.9 235.3 202.5 138.5 310.4 414.9 17.3 27.1 0.17 3.
run ; title2 'PCA using the correlation matrix'; proc princomp data=big8 out=scores; var RO_YDS RD_YDS PO_YDS PD_RAT TO_YDS TD_YDS SO SD TOM; run ; Chris Bilder, STAT 873 1 PCA using the correlation matrix The PRINCOMP Procedure Observations 8 Variables 9 Simple Statistics RO_YDS RD_YDS PO_YDS Mean 209.6125000 172.6625000 170. StD 79.5444429 62.2110908 39. Simple Statistics PD_RAT TO_YDS TD_YDS Mean 120.6750000 377.4250000 359. StD 18.4135625 70.4542962 68. Simple Statistics SO SD TOM Mean 24.96250000 21.56250000 0. StD 8.35975692 6.69774749 0. Correlation Matrix RO_YDS RD_YDS PO_YDS PD_RAT TO_YDS RO_YDS 1.0000 -.7377 -.4691 -.1943 0. RD_YDS -.7377 1.0000 -.0781 0.6682 -. PO_YDS -.4691 -.0781 1.0000 -.3241 0. PD_RAT -.1943 0.6682 -.3241 1.0000 -. TO_YDS 0.8403 -.8759 0.0730 -.4438 1. TD_YDS -.4265 0.8839 -.2327 0.9069 -. SO 0.7521 -.8260 0.1657 -.4763 0. SD -.4630 0.8862 -.2923 0.8337 -. TOM -.0180 -.3912 0.6748 -.3652 0.
%MACRO PLOTS(data, analysis, order); Scatter plot of the first two principal components; proc gplot data=&data; plot prin2prin1 / vaxis=axis1 haxis=axis2 frame grid vref= 0 href= 0 cvref=green chref=green; title2 "&analysis: Prin. Comp. #1 vs. Prin. Comp. #2"; symbol1 v=dot pointlabel=('#SCHOOL' h= 0.4 ) h= 0.25 cv=blue; axis1 label = (a= 90 'Prin. Comp. #2') length = 12 order = (&order); axis2 label = ('Prin. Comp. #1') length = 12 order = (&order); run; Bubble plot of the first three principal components; proc gplot data=&data; bubble prin2prin1 = prin3 / vaxis=axis1 haxis=axis2 frame grid bcolor=blue bsize= 10 vref= 0 href= 0 cvref=green chref=green; title2 "&analysis:Prin. Comp. #1 vs. Prin. Comp. #2 with bubble proportional to Prin. Comp. #3"; axis1 label = (a= 90 'Prin. Comp. #2') length = 12 order = (&order); axis2 label = ('Prin. Comp. #1') length = 12 order = (&order); run; 3D scatter plot of the first three principal components; proc g3d data=&data; scatter prin2prin1 = prin3 / grid zticknum= 6 xticknum= 6 yticknum= 6 shape='cube' color='blue' rotate= 140 tilt= 40 ; title2 "&analysis: 3D scatter plot"; run; *Find Min and put into a data set; proc means data=&data noprint; var prin3; output out=out_set1 min=min; run; data null; set out_set1; call symput('min_prin3', min); run; *Test it - the value should appear in the LOG Window; %put &min_prin3;
*Adjust prin3; data score2; set &data; prin3_adj = prin3 - &min_prin3 + 0.001 ; run; Bubble plot of the first three principal components; proc gplot data=score2; bubble prin2prin1 = prin3_adj / vaxis=axis1 haxis=axis2 frame grid bcolor=blue bsize= 10 vref= 0 href= 0 cvref=green chref=green; title2 "&analysis:Prin. Comp. #1 vs. Prin. Comp. #2 with bubble proportional to Prin. Comp. #3 adj."; axis1 label = (a= 90 'Prin. Comp. #2') length = 12 order = (&order); axis2 label = ('Prin. Comp. #1') length = 12 order = (&order); run; %MEND PLOTS; % PLOTS (scores, Correlation matrix, - 5 to 5 by 1 );
NOTE: Nebraska was the NATIONAL CHAMPION in 1994!