APPLE TASTE with 5 covariates - YOURNAME 1 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) The data as SAS sees it 21:33 Wednesday, October 19, 2005 Obs farm yy nat kk pp shade water 1 A 2876 20.0 38 2488 2.42 216 2 B 2078 11.1 13 2998 1.62 321 3 C 3052 19.8 31 3835 2.79 376 4 D 2265 13.9 19 2360 1.65 265 5 E 940 17.0 24 233 0.86 18 6 F 2815 16.9 26 3922 2.70 369 7 G 2661 11.6 16 4343 2.40 453 8 H 2181 14.3 22 3110 2.05 267 9 I 2052 10.5 13 2869 1.63 286 10 J 2064 18.2 31 2335 2.17 252 11 K 1551 8.3 8 1784 0.84 185 12 L 2338 20.4 36 2601 2.47 275 13 M 1753 8.7 18 2124 1.27 201 14 N 2110 7.5 4 4408 1.85 411 APPLE TASTE with 5 covariates - YOURNAME 2 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) The data as SAS sees it 21:33 Wednesday, October 19, 2005 The PRINCOMP Procedure Observations 14 Variables 5 Simple Statistics nat kk pp shade water Mean 14.15714286 21.35714286 2815.000000 1.908571429 278.2142857 StD 4.59643914 10.27024936 1111.444936 0.631857544 109.2310033 Correlation Matrix nat kk pp shade water nat Sodium 1.0000 0.9531 -.1361 0.5980 -.1455 kk Potassium 0.9531 1.0000 -.1719 0.5796 -.1916 pp Phosphorus -.1361 -.1719 1.0000 0.6968 0.9788 shade Shade 0.5980 0.5796 0.6968 1.0000 0.6740 water Water -.1455 -.1916 0.9788 0.6740 1.0000 Eigenvalues of the Correlation Matrix Eigenvalue Difference Proportion Cumulative 1 2.64995587 0.37257225 0.5300 0.5300 2 2.27738362 2.22807114 0.4555 0.9855 3 0.04931249 0.02801055 0.0099 0.9953 4 0.02130194 0.01925585 0.0043 0.9996 5 0.00204608 0.0004 1.0000 Eigenvectors Prin1 Prin2 Prin3 Prin4 Prin5 nat Sodium 0.300110 0.567769 0.737532 -.119502 0.171284 kk Potassium 0.280688 0.581949 -.605548 0.272208 0.376514 pp Phosphorus 0.485171 -.402078 -.100123 -.573749 0.513546 shade Shade 0.607029 0.093933 -.176799 -.188920 -.745482 water Water 0.476731 -.410467 0.219260 0.739421 0.097087 APPLE TASTE with 5 covariates - YOURNAME 3 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) THE 5 PRINCIPAL COMPONENTS 21:33 Wednesday, October 19, 2005 Obs Prin1 Prin2 Prin3 Prin4 Prin5 1 0.91340 2.09289 -0.28229 -0.11606 0.018084 2 -0.43862 -1.12106 0.15235 0.13942 0.042747 3 2.35080 0.63800 0.19465 -0.01927 0.082067 4 -0.58591 0.01049 0.18453 0.16695 -0.012907 5 -3.01231 2.25693 0.30399 -0.11895 0.015654 6 1.94577 -0.02208 0.02743 -0.14178 -0.069142 7 1.58859 -1.75595 -0.01875 0.17196 -0.010117 8 0.24260 0.01052 -0.10364 -0.25716 -0.011632 9 -0.67726 -1.01549 -0.00536 -0.01830 -0.082123 10 0.45472 1.35681 -0.00238 0.14264 -0.049357 11 -2.63094 -0.91596 0.05250 0.01897 -0.006444 12 1.23972 1.77382 -0.00592 0.14664 0.005329 13 -1.70017 -0.41911 -0.59176 0.07785 0.039062 14 0.30961 -2.88981 0.09464 -0.19292 0.038778 APPLE TASTE with 5 covariates - YOURNAME 4 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) MEANS AND VARIANCES OF PRIN1-PRIN5 21:33 Wednesday, October 19, 2005 Note that the means are zero and the variances are the same as the eigenvalues in the principal component output. The MEANS Procedure Variable Mean Variance ---------------------------------------- Prin1 0.0000 2.6500 Prin2 0.0000 2.2774 Prin3 0.0000 0.0493 Prin4 -0.0000 0.0213 Prin5 -0.0000 0.0020 ---------------------------------------- APPLE TASTE with 5 covariates - YOURNAME 5 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) CORRELATIONS WITH AND WITHIN PRIN1-PRIN5 21:33 Wednesday, October 19, 2005 Note that Prin1-Prin5 are uncorrelated, as they should be. Note that only Prin1 appears to be correlated with AppleTaste The CORR Procedure 6 Variables: yy Prin1 Prin2 Prin3 Prin4 Prin5 Simple Statistics Variable N Mean Std Dev Sum yy 14 2195 559.46110 30736 Prin1 14 0 1.62787 0 Prin2 14 0 1.50910 0 Prin3 14 0 0.22206 0 Prin4 14 0 0.14595 0 Prin5 14 0 0.04523 0 Simple Statistics Variable Minimum Maximum Label yy 940.00000 3052 AppleTaste Prin1 -3.01231 2.35080 Prin2 -2.88981 2.25693 Prin3 -0.59176 0.30399 Prin4 -0.25716 0.17196 Prin5 -0.08212 0.08207 Pearson Correlation Coefficients, N = 14 Prob > |r| under H0: Rho=0 yy Prin1 Prin2 Prin3 Prin4 Prin5 yy 1.00000 0.92949 -0.02904 -0.11280 0.01847 0.03719 AppleTaste <.0001 0.9215 0.7010 0.9500 0.8995 Prin1 0.92949 1.00000 0.00000 0.00000 0.00000 0.00000 <.0001 1.0000 1.0000 1.0000 1.0000 Prin2 -0.02904 0.00000 1.00000 0.00000 0.00000 0.00000 0.9215 1.0000 1.0000 1.0000 1.0000 Prin3 -0.11280 0.00000 0.00000 1.00000 0.00000 0.00000 0.7010 1.0000 1.0000 1.0000 1.0000 Prin4 0.01847 0.00000 0.00000 0.00000 1.00000 0.00000 0.9500 1.0000 1.0000 1.0000 1.0000 Prin5 0.03719 0.00000 0.00000 0.00000 0.00000 1.00000 0.8995 1.0000 1.0000 1.0000 1.0000 APPLE TASTE with 5 covariates - YOURNAME 6 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) CORRELATIONS WITH AND WITHIN PRIN1-PRIN5 21:33 Wednesday, October 19, 2005 DATA IN A PRIN2*PRIN1 plot: THIS SHOWS THE DISTRIBUTION of the n individual rows title6 in the d THIS CAN ALSO BE USEFUL TO DETECT OUTLIERS. Plot of Prin2*Prin1. Symbol is value of farm. Prin2 | 3 + | | | | |E | A 2 + | | L | | | J | 1 + | | | C | | | 0 + D H F | | | M | | | K -1 + I | B | | | | G | -2 + | | | | | | N -3 + -+----------+----------+----------+----------+----------+----------+- -3 -2 -1 0 1 2 3 Prin1 APPLE TASTE with 5 covariates - YOURNAME 7 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) DATA SORTED BY THE FIRST PRINCIPAL COMPONENT IS IT CLEAR HOW THE COVARIATES DEPEND ON PRIN1? 21:33 Wednesday, October 19, 2005 Obs yy Prin1 nat kk pp shade water 1 3052 2.35080 19.8 31 3835 2.79 376 2 2815 1.94577 16.9 26 3922 2.70 369 3 2661 1.58859 11.6 16 4343 2.40 453 4 2338 1.23972 20.4 36 2601 2.47 275 5 2876 0.91340 20.0 38 2488 2.42 216 6 2064 0.45472 18.2 31 2335 2.17 252 7 2110 0.30961 7.5 4 4408 1.85 411 8 2181 0.24260 14.3 22 3110 2.05 267 9 2078 -0.43862 11.1 13 2998 1.62 321 10 2265 -0.58591 13.9 19 2360 1.65 265 11 2052 -0.67726 10.5 13 2869 1.63 286 12 1753 -1.70017 8.7 18 2124 1.27 201 13 1551 -2.63094 8.3 8 1784 0.84 185 14 940 -3.01231 17.0 24 233 0.86 18 APPLE TASTE with 5 covariates - YOURNAME 8 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) DATA SORTED BY THE SECOND PRINCIPAL COMPONENT IS IT CLEAR HOW THE COVARIATES DEPEND ON PRIN2? 21:33 Wednesday, October 19, 2005 Obs yy Prin2 nat kk pp shade water 1 940 2.25693 17.0 24 233 0.86 18 2 2876 2.09289 20.0 38 2488 2.42 216 3 2338 1.77382 20.4 36 2601 2.47 275 4 2064 1.35681 18.2 31 2335 2.17 252 5 3052 0.63800 19.8 31 3835 2.79 376 6 2181 0.01052 14.3 22 3110 2.05 267 7 2265 0.01049 13.9 19 2360 1.65 265 8 2815 -0.02208 16.9 26 3922 2.70 369 9 1753 -0.41911 8.7 18 2124 1.27 201 10 1551 -0.91596 8.3 8 1784 0.84 185 11 2052 -1.01549 10.5 13 2869 1.63 286 12 2078 -1.12106 11.1 13 2998 1.62 321 13 2661 -1.75595 11.6 16 4343 2.40 453 14 2110 -2.88981 7.5 4 4408 1.85 411 APPLE TASTE with 5 covariates - YOURNAME 9 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) PROC GLM of taste on 5 principal components Note also that only Prin1 appears to affect AppleTaste 21:33 Wednesday, October 19, 2005 The GLM Procedure Number of Observations Read 14 Number of Observations Used 14 APPLE TASTE with 5 covariates - YOURNAME 10 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) PROC GLM of taste on 5 principal components Note also that only Prin1 appears to affect AppleTaste 21:33 Wednesday, October 19, 2005 The GLM Procedure Dependent Variable: yy AppleTaste Sum of Source DF Squares Mean Square F Value Pr > F Model 5 3577640.728 715528.146 11.65 0.0016 Error 8 491316.700 61414.588 Corrected Total 13 4068957.429 R-Square Coeff Var Root MSE yy Mean 0.879252 11.28799 247.8197 2195.429 Source DF Type I SS Mean Square F Value Pr > F Prin1 1 3515415.526 3515415.526 57.24 <.0001 Prin2 1 3431.641 3431.641 0.06 0.8191 Prin3 1 51776.366 51776.366 0.84 0.3854 Prin4 1 1388.363 1388.363 0.02 0.8842 Prin5 1 5628.832 5628.832 0.09 0.7698 Source DF Type III SS Mean Square F Value Pr > F Prin1 1 3515415.526 3515415.526 57.24 <.0001 Prin2 1 3431.641 3431.641 0.06 0.8191 Prin3 1 51776.366 51776.366 0.84 0.3854 Prin4 1 1388.363 1388.363 0.02 0.8842 Prin5 1 5628.832 5628.832 0.09 0.7698 Standard Parameter Estimate Error t Value Pr > |t| Intercept 2195.428571 66.232592 33.15 <.0001 Prin1 319.445913 42.222581 7.57 <.0001 Prin2 -10.766168 45.545555 -0.24 0.8191 Prin3 -284.194490 309.517808 -0.92 0.3854 Prin4 70.806029 470.928045 0.15 0.8842 Prin5 460.018980 1519.505801 0.30 0.7698 APPLE TASTE with 5 covariates - YOURNAME 11 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) PROC GLM on the FIRST principal component ONLY 21:33 Wednesday, October 19, 2005 The GLM Procedure Number of Observations Read 14 Number of Observations Used 14 APPLE TASTE with 5 covariates - YOURNAME 12 PRINCIPAL COMPONENTS ANALYSIS (using PROC PRINCOMP) PROC GLM on the FIRST principal component ONLY 21:33 Wednesday, October 19, 2005 The GLM Procedure Dependent Variable: yy AppleTaste Sum of Source DF Squares Mean Square F Value Pr > F Model 1 3515415.526 3515415.526 76.21 <.0001 Error 12 553541.902 46128.492 Corrected Total 13 4068957.429 R-Square Coeff Var Root MSE yy Mean 0.863960 9.782848 214.7754 2195.429 Source DF Type I SS Mean Square F Value Pr > F Prin1 1 3515415.526 3515415.526 76.21 <.0001 Source DF Type III SS Mean Square F Value Pr > F Prin1 1 3515415.526 3515415.526 76.21 <.0001 Standard Parameter Estimate Error t Value Pr > |t| Intercept 2195.428571 57.40115221 38.25 <.0001 Prin1 319.445913 36.59263056 8.73 <.0001 APPLE TASTE with 5 covariates - YOURNAME 13 PROC IML: REDOING THE PRINCIPAL COMPONENTS ANALYSIS 21:33 Wednesday, October 19, 2005 The covariance matrix of the covariates: VARNAMES XCOV Sodium 21.13 44.99 -695.05 1.74 -73.04 Potassium 44.99 105.48 -1962.77 3.76 -214.93 Phosphorus -695.05 -1962.77 1235309.85 489.37 118826.38 Shade 1.74 3.76 489.37 0.40 46.52 Water -73.04 -214.93 118826.38 46.52 11931.41 The CORRELATION MATRIX of the covariates: VARNAMES CORR Sodium 1.0000 0.9531 -0.1361 0.5980 -0.1455 Potassium 0.9531 1.0000 -0.1719 0.5796 -0.1916 Phosphorus -0.1361 -0.1719 1.0000 0.6968 0.9788 Shade 0.5980 0.5796 0.6968 1.0000 0.6740 Water -0.1455 -0.1916 0.9788 0.6740 1.0000 The eigenvalues and normalized eigenvectors of CORR: THE `FACTOR LOADINGS' are the columns of EGVECS These define the `Principal Component factors' in terms of the original variables. The `FACTOR WEIGHTINGS' are the rows of EGVECS These reverse the transformation. EGVALS VARNAMES EGVECS 2.6500 Sodium 0.3001 0.5678 0.7375 -0.1195 0.1713 2.2774 Potassium 0.2807 0.5819 -0.6055 0.2722 0.3765 0.0493 Phosphorus 0.4852 -0.4021 -0.1001 -0.5737 0.5135 0.0213 Shade 0.6070 0.0939 -0.1768 -0.1889 -0.7455 0.0020 Water 0.4767 -0.4105 0.2193 0.7394 0.0971 The PCs themselves are OBS YY 1 0.91340 2.09289 -0.28229 -0.11606 0.01808 2 -0.43862 -1.12106 0.15235 0.13942 0.04275 3 2.35080 0.63800 0.19465 -0.01927 0.08207 4 -0.58591 0.01049 0.18453 0.16695 -0.01291 5 -3.01231 2.25693 0.30399 -0.11895 0.01565 6 1.94577 -0.02208 0.02743 -0.14178 -0.06914 7 1.58859 -1.75595 -0.01875 0.17196 -0.01012 8 0.24260 0.01052 -0.10364 -0.25716 -0.01163 9 -0.67726 -1.01549 -0.00536 -0.01830 -0.08212 10 0.45472 1.35681 -0.00238 0.14264 -0.04936 11 -2.63094 -0.91596 0.05250 0.01897 -0.00644 12 1.23972 1.77382 -0.00592 0.14664 0.00533 13 -1.70017 -0.41911 -0.59176 0.07785 0.03906 14 0.30961 -2.88981 0.09464 -0.19292 0.03878 The covariance matrix for Y (PC data columns or PC scores) is APPLE TASTE with 5 covariates - YOURNAME 14 PROC IML: REDOING THE PRINCIPAL COMPONENTS ANALYSIS 21:33 Wednesday, October 19, 2005 PRNAMES COVPCDAT PRIN1 2.6500 -0.0000 0.0000 -0.0000 -0.0000 PRIN2 -0.0000 2.2774 0.0000 -0.0000 -0.0000 PRIN3 0.0000 0.0000 0.0493 -0.0000 -0.0000 PRIN4 -0.0000 -0.0000 -0.0000 0.0213 -0.0000 PRIN5 -0.0000 -0.0000 -0.0000 -0.0000 0.0020 APPLE TASTE with 5 covariates - YOURNAME 15 WE ARE NOW BACK IN REGULAR SAS (NOT PROC IML): SCREE PLOT FOR EIGENVALUES FOR APPLE COVARIATES 21:33 Wednesday, October 19, 2005 Plot of EGVALS*EVAL. Symbol is value of EVAL. EGVALS | | | | | | | 3 + | | 1 | | | 2 | 2 + | | | | | | 1 + | | | | | | 0 + 3 4 5 | ---+------------+------------+------------+------------+-- 1 2 3 4 5 EVAL