bash$ tcsh Displaying on melody.rem.cmu.edu:0.0 [famine]~/classes/401/S% S S-PLUS : Copyright (c) 1988, 2000 MathSoft, Inc. S : Copyright Lucent Technologies, Inc. Version 6.0 Release 1 for Linux 2.2.12 : 2000 Working data will be in .Data > high _ read.table("highway.dat",header=T) > high[1:5,] Rate Len Adt Trk Sp lw shl itg sigs acpt lan type 1 4.58 4.99 69 8 55 12 10 1.20 0 4.6 8 1 2 2.86 16.11 73 8 60 12 10 1.43 0 4.4 4 1 3 3.02 9.75 49 10 60 12 10 1.54 0 4.7 4 1 4 2.29 10.65 61 13 65 12 10 0.94 0 3.8 6 1 5 1.61 20.01 28 12 70 12 10 0.65 0 2.2 4 1 > high Rate Len Adt Trk Sp lw shl itg sigs acpt lan type 1 4.58 4.99 69 8 55 12 10 1.20 0.00 4.6 8 1 2 2.86 16.11 73 8 60 12 10 1.43 0.00 4.4 4 1 3 3.02 9.75 49 10 60 12 10 1.54 0.00 4.7 4 1 4 2.29 10.65 61 13 65 12 10 0.94 0.00 3.8 6 1 5 1.61 20.01 28 12 70 12 10 0.65 0.00 2.2 4 1 6 6.87 5.97 30 6 55 12 10 0.34 1.84 24.8 4 2 7 3.85 8.57 46 8 55 12 8 0.47 0.70 11.0 4 2 8 6.12 5.24 25 9 55 12 10 0.38 0.38 48.5 4 2 9 3.29 15.79 43 12 50 12 4 0.95 1.39 7.5 4 2 10 5.88 8.26 23 7 50 12 5 0.12 1.21 8.2 4 2 11 4.20 7.03 23 6 60 12 10 0.29 1.85 5.4 4 2 12 4.61 13.28 20 9 50 12 2 0.15 1.21 11.2 4 2 13 4.80 5.40 18 14 50 12 8 0.00 0.56 15.2 2 2 14 3.85 2.96 21 8 60 12 10 0.34 0.00 5.4 4 2 15 2.69 11.75 27 7 55 12 10 0.26 0.60 7.9 4 2 16 1.99 8.86 22 9 60 12 10 0.68 0.00 3.2 4 2 17 2.01 9.78 19 9 60 12 10 0.20 0.10 11.0 4 2 18 4.22 5.49 9 11 50 12 6 0.18 0.18 8.9 2 2 19 2.76 8.63 12 8 55 13 6 0.14 0.00 12.4 2 2 20 2.55 20.31 12 7 60 12 10 0.05 0.99 7.8 4 2 21 1.89 40.09 15 13 55 12 8 0.05 0.12 9.6 4 2 22 2.34 11.81 8 8 60 12 10 0.00 0.00 4.3 2 2 23 2.83 11.39 5 9 50 12 8 0.00 0.09 11.1 2 2 24 1.81 22.00 5 15 60 12 7 0.00 0.00 6.8 2 2 25 9.23 3.58 23 6 40 12 2 0.56 2.51 53.0 4 3 26 8.60 3.23 13 6 45 12 2 0.31 0.93 17.3 2 3 27 8.21 7.73 7 8 55 12 8 0.13 0.52 27.3 2 3 28 2.93 14.41 10 10 55 12 6 0.00 0.07 18.0 2 3 29 7.48 11.54 12 7 45 12 3 0.09 0.09 30.2 2 3 30 2.57 11.10 9 8 60 12 7 0.00 0.00 10.3 2 3 31 5.77 22.09 4 8 45 11 3 0.00 0.14 18.2 2 3 32 2.90 9.39 5 10 55 13 1 0.00 0.00 12.3 2 3 33 2.97 19.49 4 13 55 12 4 0.00 0.00 7.1 2 3 34 1.84 21.01 5 12 55 10 8 0.00 0.10 14.0 2 3 35 3.78 27.16 2 10 55 12 3 0.04 0.04 11.3 2 3 36 2.76 14.03 3 8 50 12 4 0.07 0.00 16.3 2 3 37 4.27 20.63 1 11 55 11 4 0.00 0.00 9.6 2 3 38 3.05 20.06 3 11 60 12 8 0.00 0.00 9.0 2 4 39 4.12 12.91 1 10 55 12 3 0.00 0.00 10.4 2 4 > high[1:4,] Rate Len Adt Trk Sp lw shl itg sigs acpt lan type 1 4.58 4.99 69 8 55 12 10 1.20 0 4.6 8 1 2 2.86 16.11 73 8 60 12 10 1.43 0 4.4 4 1 3 3.02 9.75 49 10 60 12 10 1.54 0 4.7 4 1 4 2.29 10.65 61 13 65 12 10 0.94 0 3.8 6 1 > X _ highway[,-1] Problem: Object "highway" not found Use traceback() to see the call stack > X _ high[,-1] > y _ high[,1] > summary(princomp(X)) Importance of components: Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Standard deviation 18.7944952 11.6421363 6.51362787 4.73454208 2.017334558 Proportion of Variance 0.6289318 0.2413279 0.07554194 0.03991152 0.007245996 Cumulative Proportion 0.6289318 0.8702598 0.94580173 0.98571325 0.992959246 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Standard deviation 1.681353443 0.752416013 0.4672255465 0.4513446983 Proportion of Variance 0.005033387 0.001007995 0.0003886829 0.0003627095 Cumulative Proportion 0.997992632 0.999000627 0.9993893099 0.9997520194 Comp. 10 Comp. 11 Standard deviation 0.3356784696 1.630819e-01 Proportion of Variance 0.0002006269 4.735367e-05 Cumulative Proportion 0.9999526463 1.000000e-00 > pc.var _ princomp(X) > pc.cor _ princomp(X,cor=T) > pc.var Standard deviations: Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 18.7945 11.64214 6.513628 4.734542 2.017335 1.681353 0.752416 0.4672255 Comp. 9 Comp. 10 Comp. 11 0.4513447 0.3356785 0.1630819 The number of variables is 11 and the number of observations is 39 Component names: "sdev" "loadings" "correlations" "scores" "center" "scale" "n.obs" "call" "factor.sdev" "coef" Call: princomp(x = X) > summary(pc.var) Importance of components: Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Standard deviation 18.7944952 11.6421363 6.51362787 4.73454208 2.017334558 Proportion of Variance 0.6289318 0.2413279 0.07554194 0.03991152 0.007245996 Cumulative Proportion 0.6289318 0.8702598 0.94580173 0.98571325 0.992959246 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Standard deviation 1.681353443 0.752416013 0.4672255465 0.4513446983 Proportion of Variance 0.005033387 0.001007995 0.0003886829 0.0003627095 Cumulative Proportion 0.997992632 0.999000627 0.9993893099 0.9997520194 Comp. 10 Comp. 11 Standard deviation 0.3356784696 1.630819e-01 Proportion of Variance 0.0002006269 4.735367e-05 Cumulative Proportion 0.9999526463 1.000000e-00 > summary(pc.cor) Importance of components: Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Standard deviation 2.0109882 1.6199488 1.0646227 0.93935135 0.78378527 Proportion of Variance 0.3676431 0.2385667 0.1030383 0.08021645 0.05584721 Cumulative Proportion 0.3676431 0.6062098 0.7092481 0.78946458 0.84531179 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Comp. 10 Standard deviation 0.74800568 0.65084781 0.54694369 0.48884717 0.34268017 Proportion of Variance 0.05086477 0.03850935 0.02719522 0.02172469 0.01067543 Cumulative Proportion 0.89617656 0.93468591 0.96188113 0.98360582 0.99428125 Comp. 11 Standard deviation 0.250811276 Proportion of Variance 0.005718754 Cumulative Proportion 1.000000000 > screeplot(pc.var) > ps("scree-var.ps",F,T) Generated postscript file "scree-var.ps". > screeplot(pc.cor) > ps("scree-cor.ps",F,T) Generated postscript file "scree-cor.ps". > print(loadings(pc.var)) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.111 0.346 0.918 -0.149 Adt -0.973 -0.126 0.164 Trk 0.119 0.856 -0.479 Sp 0.314 0.848 0.149 0.381 lw 0.151 -0.687 shl 0.399 -0.451 -0.776 itg sigs 0.305 0.896 0.297 acpt 0.147 -0.868 0.332 0.333 lan 0.932 -0.337 type 0.109 -0.134 -0.239 0.660 Comp. 10 Comp. 11 Len Adt Trk Sp lw -0.699 shl -0.120 itg 0.116 -0.992 sigs acpt lan type -0.685 > loadings(pc.var,cutoff=.1) Problem in loadings: argument cutoff= not matched: loadings(pc.var, cutoff = 0.1) Use traceback() to see the call stack > print(loadings(pc.var,cutoff=.1) + ) Problem in loadings: argument cutoff= not matched: loadings(pc.var, cutoff = 0.1) Use traceback() to see the call stack > print(loadings(pc.var),cutoff=.1) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.111 0.346 0.918 -0.149 Adt -0.973 -0.126 0.164 Trk 0.119 0.856 -0.479 Sp 0.314 0.848 0.149 0.381 lw 0.151 -0.687 shl 0.399 -0.451 -0.776 itg sigs 0.305 0.896 0.297 acpt 0.147 -0.868 0.332 0.333 lan 0.932 -0.337 type 0.109 -0.134 -0.239 0.660 Comp. 10 Comp. 11 Len Adt Trk Sp lw -0.699 shl -0.120 itg 0.116 -0.992 sigs acpt lan type -0.685 > print(loadings(pc.var),cutoff=.5) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.918 Adt -0.973 Trk 0.856 Sp 0.848 lw -0.687 shl -0.776 itg sigs 0.896 acpt -0.868 lan 0.932 type 0.660 Comp. 10 Comp. 11 Len Adt Trk Sp lw -0.699 shl itg -0.992 sigs acpt lan type -0.685 > print(loadings(pc.var),cutoff=.1) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.111 0.346 0.918 -0.149 Adt -0.973 -0.126 0.164 Trk 0.119 0.856 -0.479 Sp 0.314 0.848 0.149 0.381 lw 0.151 -0.687 shl 0.399 -0.451 -0.776 itg sigs 0.305 0.896 0.297 acpt 0.147 -0.868 0.332 0.333 lan 0.932 -0.337 type 0.109 -0.134 -0.239 0.660 Comp. 10 Comp. 11 Len Adt Trk Sp lw -0.699 shl -0.120 itg 0.116 -0.992 sigs acpt lan type -0.685 > print(loadings(pc.cor),cutoff=.1) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.114 0.417 -0.372 0.181 0.497 0.562 -0.172 0.198 Adt -0.446 -0.141 -0.170 0.223 -0.125 0.108 Trk 0.447 -0.191 0.414 -0.111 -0.553 -0.460 0.166 -0.120 Sp -0.275 0.386 0.249 -0.310 0.140 -0.136 0.127 0.535 lw -0.134 0.769 0.421 0.254 -0.240 0.198 shl -0.358 0.147 -0.606 -0.288 -0.172 0.102 itg -0.415 -0.117 -0.169 0.286 -0.283 0.133 0.166 0.310 0.440 sigs -0.466 -0.210 0.658 -0.154 -0.370 0.270 0.251 acpt 0.188 -0.405 -0.167 -0.277 -0.685 0.407 lan -0.417 -0.150 -0.196 0.209 0.165 -0.790 type 0.441 0.132 0.226 0.666 -0.217 Comp. 10 Comp. 11 Len Adt 0.266 0.767 Trk 0.137 Sp -0.493 0.168 lw 0.198 shl 0.578 -0.152 itg -0.537 sigs acpt -0.213 lan -0.248 type 0.483 > summary(X) Len Adt Trk Sp Min.: 2.960 Min.: 1.00 Min.: 6.000 Min.:40 1st Qu.: 7.995 1st Qu.: 5.00 1st Qu.: 8.000 1st Qu.:50 Median:11.390 Median:13.00 Median: 9.000 Median:55 Mean:12.884 Mean:19.62 Mean: 9.333 Mean:55 3rd Qu.:17.800 3rd Qu.:24.00 3rd Qu.:11.000 3rd Qu.:60 Max.:40.090 Max.:73.00 Max.:15.000 Max.:70 lw shl itg sigs Min.:10.00 Min.: 1.000 Min.:0.0000 Min.:0.0000 1st Qu.:12.00 1st Qu.: 4.000 1st Qu.:0.0000 1st Qu.:0.0000 Median:12.00 Median: 8.000 Median:0.1300 Median:0.0900 Mean:11.95 Mean: 6.872 Mean:0.2964 Mean:0.4005 3rd Qu.:12.00 3rd Qu.:10.000 3rd Qu.:0.3600 3rd Qu.:0.5800 Max.:13.00 Max.:10.000 Max.:1.5400 Max.:2.5100 acpt lan type Min.: 2.20 Min.:2.000 Min.:1.000 1st Qu.: 6.95 1st Qu.:2.000 1st Qu.:2.000 Median:10.30 Median:2.000 Median:2.000 Mean:12.93 Mean:3.128 Mean:2.308 3rd Qu.:14.60 3rd Qu.:4.000 3rd Qu.:3.000 Max.:53.00 Max.:8.000 Max.:4.000 > sqrt(diag(var(X)) + ) [1] 7.6096835 18.6118460 2.3545402 5.8489765 0.4558808 3.0364408 [7] 0.4111696 0.6333908 10.9508219 1.3607174 0.7661883 > print(loadings(pc.cor),cutoff=.1) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.114 0.417 -0.372 0.181 0.497 0.562 -0.172 0.198 Adt -0.446 -0.141 -0.170 0.223 -0.125 0.108 Trk 0.447 -0.191 0.414 -0.111 -0.553 -0.460 0.166 -0.120 Sp -0.275 0.386 0.249 -0.310 0.140 -0.136 0.127 0.535 lw -0.134 0.769 0.421 0.254 -0.240 0.198 shl -0.358 0.147 -0.606 -0.288 -0.172 0.102 itg -0.415 -0.117 -0.169 0.286 -0.283 0.133 0.166 0.310 0.440 sigs -0.466 -0.210 0.658 -0.154 -0.370 0.270 0.251 acpt 0.188 -0.405 -0.167 -0.277 -0.685 0.407 lan -0.417 -0.150 -0.196 0.209 0.165 -0.790 type 0.441 0.132 0.226 0.666 -0.217 Comp. 10 Comp. 11 Len Adt 0.266 0.767 Trk 0.137 Sp -0.493 0.168 lw 0.198 shl 0.578 -0.152 itg -0.537 sigs acpt -0.213 lan -0.248 type 0.483 > print(loadings(pc.cor),cutoff=.2) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.417 -0.372 0.497 0.562 Adt -0.446 0.223 Trk 0.447 0.414 -0.553 -0.460 Sp -0.275 0.386 0.249 -0.310 0.535 lw 0.769 0.421 0.254 -0.240 shl -0.358 -0.606 -0.288 itg -0.415 0.286 -0.283 0.310 0.440 sigs -0.466 -0.210 0.658 -0.370 0.270 0.251 acpt -0.405 -0.277 -0.685 0.407 lan -0.417 0.209 -0.790 type 0.441 0.226 0.666 -0.217 Comp. 10 Comp. 11 Len Adt 0.266 0.767 Trk Sp -0.493 lw shl 0.578 itg -0.537 sigs acpt -0.213 lan -0.248 type 0.483 > print(loadings(pc.cor),cutoff=.3) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.417 -0.372 0.497 0.562 Adt -0.446 Trk 0.447 0.414 -0.553 -0.460 Sp 0.386 -0.310 0.535 lw 0.769 0.421 shl -0.358 -0.606 itg -0.415 0.310 0.440 sigs -0.466 0.658 -0.370 acpt -0.405 -0.685 0.407 lan -0.417 -0.790 type 0.441 0.666 Comp. 10 Comp. 11 Len Adt 0.767 Trk Sp -0.493 lw shl 0.578 itg -0.537 sigs acpt lan type 0.483 > biplot(pc.cor) > biplot(pc.cor,expand=2) Lines out of bounds X= 3.951994 Y= 5.17722 Lines out of bounds X= 4.01439 Y= 5.050305 Lines out of bounds X= 3.951994 Y= 5.17722 Lines out of bounds X= 3.38843 Y= 5.312805 Lines out of bounds X= 3.484866 Y= 5.20936 Lines out of bounds X= 3.38843 Y= 5.312805 Lines out of bounds X= 1.793969 Y= 5.041634 Lines out of bounds X= 1.935127 Y= 5.03300 Lines out of bounds X= 1.793969 Y= 5.041634 Lines out of bounds X= 5.76189 Y= 3.252443 Lines out of bounds X= 5.659227 Y= 3.155183 Lines out of bounds X= 5.76189 Y= 3.252443 > biplot(pc.cor,expand=1.1) > print(loadings(pc.cor),cutoff=.3) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.417 -0.372 0.497 0.562 Adt -0.446 Trk 0.447 0.414 -0.553 -0.460 Sp 0.386 -0.310 0.535 lw 0.769 0.421 shl -0.358 -0.606 itg -0.415 0.310 0.440 sigs -0.466 0.658 -0.370 acpt -0.405 -0.685 0.407 lan -0.417 -0.790 type 0.441 0.666 Comp. 10 Comp. 11 Len Adt 0.767 Trk Sp -0.493 lw shl 0.578 itg -0.537 sigs acpt lan type 0.483 > biplot(pc.cor,var.axes=c(Adt=T,shl=T,itg=T,lan=T,type=T)) > ps("biplot-pc1.ps",F,T) Generated postscript file "biplot-pc1.ps". > biplot(pc.cor,var.axes=c(Len=T,Trk=T,Sp=T,sigs=T,acpt=T)) > ps("biplot-pc2.ps",F,T) Generated postscript file "biplot-pc2.ps". > biplot(pc.cor,var.axes=c(Len=T,lw=T)) > ps("biplot-pc3.ps",F,T) Generated postscript file "biplot-pc3.ps". > biplot(pc.cor,var.axes=c(Trk=T,Sp=T,lw=T,shl=T)) > ps("biplot-pc4.ps",F,T) Generated postscript file "biplot-pc4.ps". > princomp(X,cor=T,scores=4)$loadings Comp. 1 Comp. 2 Comp. 3 Comp. 4 Len 0.114 0.417 -0.372 0.181 Adt -0.446 -0.141 -0.170 0.223 Trk 0.447 -0.191 0.414 Sp -0.275 0.386 0.249 -0.310 lw -0.134 0.769 0.421 shl -0.358 0.147 -0.606 itg -0.415 -0.117 -0.169 0.286 sigs -0.466 -0.210 acpt 0.188 -0.405 -0.167 lan -0.417 -0.150 -0.196 type 0.441 > print(princomp(X,cor=T,scores=4)$loadings,cutoff=.3) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Len 0.417 -0.372 Adt -0.446 Trk 0.447 0.414 Sp 0.386 -0.310 lw 0.769 0.421 shl -0.358 -0.606 itg -0.415 sigs -0.466 acpt -0.405 lan -0.417 type 0.441 > princomp(X,cor=T,scores=4)$scores Comp. 1 Comp. 2 Comp. 3 Comp. 4 1 -5.05046469 -1.106427091 -0.65729426 0.66793822 2 -4.21414000 0.202636347 -0.53789846 0.72622814 3 -3.82425964 0.376187093 -0.21588258 0.71295655 4 -4.34755467 1.229164115 -0.43011676 0.80697994 5 -2.75837764 2.512091505 0.14607566 -0.08310560 6 -1.05701493 -2.588350989 -0.14977144 -1.41745127 7 -1.52180679 -0.951301977 -0.08729037 -0.03807027 8 -0.54802185 -1.826436964 -0.20479908 -0.93729636 9 -1.15765417 -0.809617720 -1.41754974 2.16439638 10 -0.07170144 -1.638878578 -0.03397845 0.08047160 11 -1.39629637 -1.406422848 0.39450546 -1.61823265 12 0.46805273 -1.220424409 -0.53651203 1.12323054 13 0.55592886 0.214280520 0.09109827 0.45883772 14 -1.43687756 0.131146033 1.05198145 -1.09996018 15 -1.09464796 -0.471770851 0.22051973 -0.88314655 16 -1.75148796 0.627438920 0.56035648 -0.50937150 17 -1.03910534 0.473297946 0.58873977 -0.94158872 18 0.70729981 0.080722888 0.52677313 0.45281037 19 0.33082032 -0.293685321 2.53746922 0.66235036 20 -0.62832761 0.227229146 0.10811493 -1.32801493 21 0.14727807 2.603927684 -1.38191628 1.02822576 22 -0.03762964 1.085376551 1.18451274 -1.35176670 23 0.86769297 0.188438754 0.54580537 -0.34781168 24 0.62997561 2.780110521 0.03565037 0.68924242 25 1.59192956 -5.702103653 -1.50227892 0.58874171 26 1.85605538 -2.498482412 0.30166348 0.45213492 27 1.24941384 -0.872819566 0.57658452 -1.06310231 28 1.50169585 0.483186279 0.36375398 -0.05774618 29 2.34845259 -1.583114022 0.01180448 0.46465750 30 0.97325596 0.646886696 1.07846710 -0.90224946 31 2.79119932 -0.007655607 -2.02259230 -0.10365766 32 1.84464235 -0.032833766 2.38175682 1.76354085 33 1.79033074 1.751527887 0.07382482 1.03199691 34 1.82556916 2.092735154 -3.40890985 -1.84684882 35 2.09079335 1.367475385 -0.15610919 0.84714616 36 2.03155347 -0.205626074 0.37737733 0.23805733 37 2.11302527 1.656568246 -1.53851050 -0.28902503 38 1.71338341 1.845484298 0.50212470 -0.51733471 39 2.50701962 0.640039880 0.62245040 0.37583721 > X[,1] [1] 4.99 16.11 9.75 10.65 20.01 5.97 8.57 5.24 15.79 8.26 7.03 13.28 [13] 5.40 2.96 11.75 8.86 9.78 5.49 8.63 20.31 40.09 11.81 11.39 22.00 [25] 3.58 3.23 7.73 14.41 11.54 11.10 22.09 9.39 19.49 21.01 27.16 14.03 [37] 20.63 20.06 12.91 > pc.cor$loadings[,1] Len Adt Trk Sp lw shl itg 0.1144207 -0.4462998 0.01262738 -0.2753715 -0.08989167 -0.3575894 -0.4145709 sigs acpt lan type -0.004405912 0.1883315 -0.4167168 0.4413328 > pc.cor$loadings[1,] Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 0.1144207 0.416767 -0.3722961 0.1807215 0.496682 -0.03408627 0.5621534 Comp. 8 Comp. 9 Comp. 10 Comp. 11 -0.1715448 0.1975547 0.09804137 0.00310702 > (pc.cor$loadings[1,] %*% pc.cor$scores) * pc.cor$scale[1] + pc.cor$center Problem in "%*%.default"(pc.cor$loadings[1, ], pc.c..: Number of columns of x should be the same as number of rows of y Use traceback() to see the call stack > pc.cor$scores %*% pc.cor$loadings[1,] * pc.cor$scale[1] + pc.cor$center [,1] 1 4.99000000 2 22.84128205 3 6.19923077 4 52.76589744 5 19.07461538 6 -0.04230769 7 -4.01769231 8 -7.24358974 9 15.83410256 10 -1.49589744 11 -3.54641026 12 13.28000000 13 12.13128205 14 -0.59076923 15 53.86589744 16 7.92461538 17 3.76769231 18 -7.09769231 19 -3.85358974 20 20.35410256 21 30.33410256 22 1.23358974 23 11.39000000 24 28.73128205 25 0.02923077 26 45.34589744 27 6.79461538 28 8.39769231 29 -1.04769231 30 -1.38358974 31 22.13410256 32 -0.36589744 33 8.91358974 34 21.01000000 35 33.89128205 36 10.47923077 37 62.74589744 38 19.12461538 39 6.89769231 Warning messages: Length of longer object is not a multiple of the length of the shorter object in: e1 + e2 > pc.cor$scores %*% pc.cor$loadings[1,] * pc.cor$scale[1] + pc.cor$center[1] [,1] 1 4.99 2 16.11 3 9.75 4 10.65 5 20.01 6 5.97 7 8.57 8 5.24 9 15.79 10 8.26 11 7.03 12 13.28 13 5.40 14 2.96 15 11.75 16 8.86 17 9.78 18 5.49 19 8.63 20 20.31 21 40.09 22 11.81 23 11.39 24 22.00 25 3.58 26 3.23 27 7.73 28 14.41 29 11.54 30 11.10 31 22.09 32 9.39 33 19.49 34 21.01 35 27.16 36 14.03 37 20.63 38 20.06 39 12.91 > t(pc.cor$scores %*% pc.cor$loadings[1,] * pc.cor$scale[1] + pc.cor$center) > 1 2 3 4 5 6 7 8 [1,] 4.99 22.84128 6.199231 52.7659 19.07462 -0.04230769 -4.017692 -7.24359 9 10 11 12 13 14 15 16 [1,] 15.8341 -1.495897 -3.54641 13.28 12.13128 -0.5907692 53.8659 7.924615 17 18 19 20 21 22 23 24 [1,] 3.767692 -7.097692 -3.85359 20.3541 30.3341 1.23359 11.39 28.73128 25 26 27 28 29 30 31 [1,] 0.02923077 45.3459 6.794615 8.397692 -1.047692 -1.38359 22.1341 32 33 34 35 36 37 38 39 [1,] -0.3658974 8.91359 21.01 33.89128 10.47923 62.7459 19.12462 6.897692 Warning messages: Length of longer object is not a multiple of the length of the shorter object in: e1 + e2 > t(pc.cor$scores %*% pc.cor$loadings[1,] * pc.cor$scale[1] + pc.cor$center[1]) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 [1,] 4.99 16.11 9.75 10.65 20.01 5.97 8.57 5.24 15.79 8.26 7.03 13.28 5.4 2.96 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [1,] 11.75 8.86 9.78 5.49 8.63 20.31 40.09 11.81 11.39 22 3.58 3.23 7.73 14.41 29 30 31 32 33 34 35 36 37 38 39 [1,] 11.54 11.1 22.09 9.39 19.49 21.01 27.16 14.03 20.63 20.06 12.91 > X[1,] Len Adt Trk Sp lw shl itg sigs acpt lan type 1 4.99 69 8 55 12 10 1.2 0 4.6 8 1 > X[,1] [1] 4.99 16.11 9.75 10.65 20.01 5.97 8.57 5.24 15.79 8.26 7.03 13.28 [13] 5.40 2.96 11.75 8.86 9.78 5.49 8.63 20.31 40.09 11.81 11.39 22.00 [25] 3.58 3.23 7.73 14.41 11.54 11.10 22.09 9.39 19.49 21.01 27.16 14.03 [37] 20.63 20.06 12.91 > pc.cor.4 _ princomp(X,cor=T,scores=4) > t(pc.cor.4$scores %*% pc.cor.4$loadings[1,] * pc.cor.4$scale[1] + pc.cor.4$center[1]) 1 2 3 4 5 6 7 8 [1,] 7.824504 12.38661 12.34648 15.29374 17.85625 2.367353 8.790493 5.99571 9 10 11 12 13 14 15 16 [1,] 16.25691 7.896161 3.981198 12.49092 14.40083 7.62466 8.650843 11.08447 17 18 19 20 21 22 23 24 [1,] 10.5481 12.88628 6.052142 10.95032 26.42272 11.10208 12.22128 22.96474 25 26 27 28 29 30 31 32 [1,] 1.40198 6.427891 8.169973 14.59177 10.54428 11.50497 20.77455 10.10014 33 34 35 36 37 38 39 [1,] 21.10054 28.03045 20.54856 13.25427 23.79623 18.0276 15.81199 > plot(X[,1],type="n") > lines(X[,1],lty=1) > t(pc.cor.4$scores %*% pc.cor.4$loadings[1,] * pc.cor.4$scale[1] + pc.cor.4$center[1]) 1 2 3 4 5 6 7 8 [1,] 7.824504 12.38661 12.34648 15.29374 17.85625 2.367353 8.790493 5.99571 9 10 11 12 13 14 15 16 [1,] 16.25691 7.896161 3.981198 12.49092 14.40083 7.62466 8.650843 11.08447 17 18 19 20 21 22 23 24 [1,] 10.5481 12.88628 6.052142 10.95032 26.42272 11.10208 12.22128 22.96474 25 26 27 28 29 30 31 32 [1,] 1.40198 6.427891 8.169973 14.59177 10.54428 11.50497 20.77455 10.10014 33 34 35 36 37 38 39 [1,] 21.10054 28.03045 20.54856 13.25427 23.79623 18.0276 15.81199 > lines(.last.Value,lty=2) Problem: Object ".last.Value" not found Use traceback() to see the call stack > xsmooth _ t(pc.cor.4$scores %*% pc.cor.4$loadings[1,] * pc.cor.4$scale[1] + pc.cor.4$center[1]) > lines(xsmooth,lty=2) Lines out of bounds X= 25 Y= 1.40198 Lines out of bounds X= 26 Y= 6.42789 > legend(locator(),lty=1:2,legend=c("Raw Data","Smoothed Data, 4 PC's")) > title("Length of Highway Segments\nRaw, and Smoothed by PCA", + xlab="Highway Segment Number",ylab="Length") > plot(X[,1],type="n",xlab="",ylab="") > lines(X[,1],lty=1) > lines(xsmooth,lty=2) Lines out of bounds X= 25 Y= 1.40198 Lines out of bounds X= 26 Y= 6.42789 > legend(locator(),lty=1:2,legend=c("Raw Data","Smoothed Data, 4 PC's")) > title("Length of Highway Segments", + xlab="Highway Segment Number",ylab="Length") > ps("pc-smoothing.ps",F,T) Generated postscript file "pc-smoothing.ps". > print(loadings(pc.cor),cutoff=.3) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.417 -0.372 0.497 0.562 Adt -0.446 Trk 0.447 0.414 -0.553 -0.460 Sp 0.386 -0.310 0.535 lw 0.769 0.421 shl -0.358 -0.606 itg -0.415 0.310 0.440 sigs -0.466 0.658 -0.370 acpt -0.405 -0.685 0.407 lan -0.417 -0.790 type 0.441 0.666 Comp. 10 Comp. 11 Len Adt 0.767 Trk Sp -0.493 lw shl 0.578 itg -0.537 sigs acpt lan type 0.483 > screeplot(pc.cor) > dim(pc.cor$scores) [1] 39 11 > major.road _ - pc.cor$scores[,1] > slow.downs _ - pc.cor$scores[,2] > open.road _ - pc.cor$scores[,3] > crowdedness _ pc.cor$scores[,4] > lm(y ~ X) Problem: Length of X (variable 2) is 11 != length of others (39) Use traceback() to see the call stack > attach(high) > lm(Rate ~ .,data=high) Call: lm(formula = Rate ~ ., data = high) Coefficients: (Intercept) Len Adt Trk Sp lw 12.51902 -0.05644494 0.009261974 -0.1270782 -0.06847023 -0.3432971 shl itg sigs acpt lan type -0.09471145 0.2868105 0.4907792 0.06840828 -0.01309656 0.2338268 Degrees of freedom: 39 total; 27 residual Residual standard error: 1.17159 > summary(lm(Rate ~ ., data=high) + ) Call: lm(formula = Rate ~ ., data = high) Residuals: Min 1Q Median 3Q Max -1.867 -0.8856 0.09851 0.6906 2.887 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 12.5190 6.5290 1.9175 0.0658 Len -0.0564 0.0328 -1.7222 0.0965 Adt 0.0093 0.0326 0.2841 0.7785 Trk -0.1271 0.1057 -1.2026 0.2396 Sp -0.0685 0.0637 -1.0756 0.2916 lw -0.3433 0.4967 -0.6912 0.4954 shl -0.0947 0.1245 -0.7606 0.4535 itg 0.2868 1.1426 0.2510 0.8037 sigs 0.4908 0.3941 1.2453 0.2237 acpt 0.0684 0.0241 2.8376 0.0085 lan -0.0131 0.2743 -0.0477 0.9623 type 0.2338 0.4893 0.4778 0.6366 Residual standard error: 1.172 on 27 degrees of freedom Multiple R-Squared: 0.7527 F-statistic: 7.472 on 11 and 27 degrees of freedom, the p-value is 1.051e-05 Correlation of Coefficients: (Intercept) Len Adt Trk Sp lw shl itg Len -0.2454 Adt -0.0328 0.0762 Trk -0.2539 -0.3082 -0.0617 Sp -0.0330 -0.1774 0.1623 -0.2290 lw -0.8674 0.3179 -0.0634 0.1655 -0.3682 shl -0.2576 0.2082 -0.1177 0.2469 -0.7103 0.4252 itg -0.0806 0.0734 -0.7678 0.0746 -0.2035 0.1404 0.2330 sigs -0.1690 0.0669 -0.0235 0.2516 0.1312 0.0468 0.0953 0.1183 acpt -0.0834 0.1059 0.0951 -0.0651 0.4503 -0.1122 -0.2908 -0.1275 lan -0.0880 -0.1208 -0.5142 0.1375 -0.1317 0.0444 -0.0224 0.1554 type -0.4508 0.0235 0.1660 0.2544 -0.2431 0.3002 0.4863 0.1254 sigs acpt lan Len Adt Trk Sp lw shl itg sigs acpt -0.2259 lan -0.2444 -0.0584 type 0.0932 -0.3023 0.1607 > collin function(X, cutoff = 0.7) { if(!is.data.frame(X) && !is.matrix(X)) stop("X must be a data.frame or a matrix") if(!is.data.frame(X)) X <- data.frame(X) p <- ncol(X) if(p < 2) stop("X must have at least 2 columns") if(is.null(names(X))) names(X) <- paste("X", 1:p, sep = "") rprt <- 0 namelist <- names(X) for(i in 1:p) { xlst <- paste(namelist[ - i], collapse = "+") rslt <- lm(formula(paste(namelist[i], "~", xlst)), X, na.action = na.omit) r2 <- summary(rslt)$r.sq if(r2 >= cutoff) { rprt <- rprt + 1 cat(namelist[i], round(r2, 3), "\n") } } if(rprt == 0) cat("No R^2 >=", cutoff, "\n") invisible(NULL) } > args(collin) function(X, cutoff = 0.7) NULL > collin(X) Adt 0.902 Sp 0.739 shl 0.747 itg 0.836 lan 0.741 type 0.743 > > summary(lm(Rate ~ major.roads + slow.downs + open.road + crowdedness)) Problem: Object "major.roads" not found Use traceback() to see the call stack > summary(lm(Rate ~ major.road + slow.downs + open.road + crowdedness)) Call: lm(formula = Rate ~ major.road + slow.downs + open.road + crowdedness) Residuals: Min 1Q Median 3Q Max -1.826 -0.8812 0.2622 0.5912 3.236 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 3.9333 0.1751 22.4637 0.0000 major.road -0.2711 0.0871 -3.1136 0.0037 slow.downs 0.9628 0.1081 8.9078 0.0000 open.road 0.2500 0.1645 1.5198 0.1378 crowdedness -0.0058 0.1864 -0.0311 0.9754 Residual standard error: 1.093 on 34 degrees of freedom Multiple R-Squared: 0.7288 F-statistic: 22.84 on 4 and 34 degrees of freedom, the p-value is 3.116e-09 Correlation of Coefficients: (Intercept) major.road slow.downs open.road major.road 0 slow.downs 0 0 open.road 0 0 0 crowdedness 0 0 0 0 > major.road 1 2 3 4 5 6 7 8 5.050465 4.21414 3.82426 4.347555 2.758378 1.057015 1.521807 0.5480218 9 10 11 12 13 14 15 16 1.157654 0.07170144 1.396296 -0.4680527 -0.5559289 1.436878 1.094648 1.751488 17 18 19 20 21 22 23 1.039105 -0.7072998 -0.3308203 0.6283276 -0.1472781 0.03762964 -0.867693 24 25 26 27 28 29 30 -0.6299756 -1.59193 -1.856055 -1.249414 -1.501696 -2.348453 -0.973256 31 32 33 34 35 36 37 -2.791199 -1.844642 -1.790331 -1.825569 -2.090793 -2.031553 -2.113025 38 39 -1.713383 -2.50702 > (1:39)[order(major.road)] [1] 31 39 29 37 35 36 26 32 34 33 38 25 28 27 30 23 18 24 13 12 19 21 22 10 8 [26] 20 17 6 15 9 11 14 7 16 5 3 2 4 1 > (1:39)[order(slow.downs)] [1] 24 21 5 34 38 33 37 35 4 22 30 39 16 28 17 3 20 13 2 23 14 18 31 32 36 [26] 19 15 9 27 7 1 12 11 29 10 8 26 6 25 > plot(major.road,xlab="highway",ylab="score",pch="*") > points(slow.downs,pch="o") Points out of bounds X= 25 Y= 5.7021 > legend(locator(),pch=c("*","o"),legend=c("Major Road Score", "Slow Down Score")) > points(Rate,pch="x") Points out of bounds X= 6 Y= 6.87 Points out of bounds X= 8 Y= 6.12 Points out of bounds X= 10 Y= 5.88 Points out of bounds X= 25 Y= 9.23 Points out of bounds X= 26 Y= 8.6 Points out of bounds X= 27 Y= 8.21 Points out of bounds X= 29 Y= 7.48 Points out of bounds X= 31 Y= 5.77 > pclm _ lm(Rate ~ major.road + slow.downs + open.road + crowdedness) pclm _ lm(Rate ~ major.road + slow.downs + open.road + crowdedness) > rawlm _ lm(Rate ~ . , data=high) > legend(locator(),pch="*o",legend=c("Major Road Score", "Slow Down Score")) > plot(major.road,xlab="highway",ylab="score",pch="*") > points(slow.downs,pch="o") Points out of bounds X= 25 Y= 5.7021 > legend(locator(),pch="*o",legend=c("Major Road Score", "Slow Down Score")) > ps("highway-scores.ps",F,T) Generated postscript file "highway-scores.ps". > par(mfrow=c(2,3))) Problem: Syntax error: No opening parenthesis before unbalanced (")") on input line 1 > par(mfrow=c(2,3)) > > plot(rawlm) > ps("hwy-raw-diag.ps",F,T) Generated postscript file "hwy-raw-diag.ps". > plot(pclm) > ps("hwy-pca-diag.ps",F,T) Generated postscript file "hwy-pca-diag.ps". > summart(rawlm) Problem: Couldn't find a function definition for "summart" > summary(rawlm) Call: lm(formula = Rate ~ ., data = high) Residuals: Min 1Q Median 3Q Max -1.867 -0.8856 0.09851 0.6906 2.887 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 12.5190 6.5290 1.9175 0.0658 Len -0.0564 0.0328 -1.7222 0.0965 Adt 0.0093 0.0326 0.2841 0.7785 Trk -0.1271 0.1057 -1.2026 0.2396 Sp -0.0685 0.0637 -1.0756 0.2916 lw -0.3433 0.4967 -0.6912 0.4954 shl -0.0947 0.1245 -0.7606 0.4535 itg 0.2868 1.1426 0.2510 0.8037 sigs 0.4908 0.3941 1.2453 0.2237 acpt 0.0684 0.0241 2.8376 0.0085 lan -0.0131 0.2743 -0.0477 0.9623 type 0.2338 0.4893 0.4778 0.6366 Residual standard error: 1.172 on 27 degrees of freedom Multiple R-Squared: 0.7527 F-statistic: 7.472 on 11 and 27 degrees of freedom, the p-value is 1.051e-05 Correlation of Coefficients: (Intercept) Len Adt Trk Sp lw shl itg Len -0.2454 Adt -0.0328 0.0762 Trk -0.2539 -0.3082 -0.0617 Sp -0.0330 -0.1774 0.1623 -0.2290 lw -0.8674 0.3179 -0.0634 0.1655 -0.3682 shl -0.2576 0.2082 -0.1177 0.2469 -0.7103 0.4252 itg -0.0806 0.0734 -0.7678 0.0746 -0.2035 0.1404 0.2330 sigs -0.1690 0.0669 -0.0235 0.2516 0.1312 0.0468 0.0953 0.1183 acpt -0.0834 0.1059 0.0951 -0.0651 0.4503 -0.1122 -0.2908 -0.1275 lan -0.0880 -0.1208 -0.5142 0.1375 -0.1317 0.0444 -0.0224 0.1554 type -0.4508 0.0235 0.1660 0.2544 -0.2431 0.3002 0.4863 0.1254 sigs acpt lan Len Adt Trk Sp lw shl itg sigs acpt -0.2259 lan -0.2444 -0.0584 type 0.0932 -0.3023 0.1607 > args(stepwise) function(x, y, wt, intercept = T, tolerance = 1e-07, method = "efroymson", size.max = ncol(x), nbest = 3, f.crit = 2, xinclude, plot.rss = dev.cur( ) != 1, time = 0.02) NULL > sw _ stepwise(X,y,meth="exhaustive") > args(sum.step) function(step.rslt, data, y, sortcol = 1, sigfig = c(IC = 1, RSE = 1, R = 3), includeBIC = T, includeAIC = F, includeRSE = F, includeR2 = F, includeR2a = T, top = NULL, compact = F) NULL > sum.step(sw,high,"Rate",includeAIC=T,includeR2=T) BIC AIC R2 R2a Len Adt Trk Sp lw shl itg sigs acpt lan type 3(#1) -66.0 -62.6 0.694 0.667 1 0 0 1 0 0 0 0 1 0 0 4(#1) -66.1 -61.9 0.720 0.687 1 0 0 1 0 0 0 1 1 0 0 4(#2) -66.3 -62.2 0.717 0.683 1 0 1 1 0 0 0 0 1 0 0 3(#2) -66.3 -63.0 0.688 0.661 0 0 1 1 0 0 0 0 1 0 0 4(#3) -67.0 -62.8 0.707 0.673 0 0 1 1 0 0 0 1 1 0 0 5(#1) -67.1 -62.1 0.732 0.692 1 0 1 1 0 0 0 1 1 0 0 3(#3) -67.3 -64.0 0.671 0.643 0 0 0 1 0 0 0 1 1 0 0 5(#3) -67.7 -62.8 0.724 0.682 1 0 0 1 0 0 0 1 1 0 1 5(#2) -67.7 -62.7 0.724 0.682 1 0 0 1 0 1 0 1 1 0 0 2(#1) -68.2 -65.7 0.622 0.601 0 0 0 1 0 0 0 0 1 0 0 6(#1) -68.6 -62.8 0.739 0.689 1 0 1 1 0 1 0 1 1 0 0 6(#2) -68.8 -63.0 0.736 0.686 1 0 0 1 0 0 1 1 1 0 1 6(#3) -68.9 -63.0 0.735 0.685 1 0 1 1 1 0 0 1 1 0 0 2(#2) -68.9 -66.4 0.607 0.586 0 0 1 0 0 0 0 0 1 0 0 2(#3) -69.3 -66.8 0.600 0.578 0 0 0 0 0 0 0 1 1 0 0 7(#1) -70.0 -63.4 0.746 0.688 1 0 1 1 0 0 1 1 1 0 1 7(#2) -70.1 -63.4 0.745 0.687 1 0 1 1 1 1 0 1 1 0 0 7(#3) -70.2 -63.5 0.744 0.686 1 1 1 1 0 0 0 1 1 0 1 1(#1) -71.1 -69.4 0.517 0.504 0 0 0 0 0 0 0 0 1 0 0 8(#1) -71.6 -64.2 0.750 0.684 1 0 1 1 1 1 1 1 1 0 0 8(#2) -71.7 -64.2 0.750 0.683 1 1 1 1 1 1 0 1 1 0 0 8(#3) -71.8 -64.4 0.748 0.680 1 0 1 1 0 1 1 1 1 0 1 1(#2) -73.1 -71.5 0.464 0.449 0 0 0 1 0 0 0 0 0 0 0 9(#2) -73.5 -65.2 0.752 0.675 1 0 1 1 1 1 1 1 1 0 1 9(#1) -73.5 -65.2 0.752 0.675 1 1 1 1 1 1 0 1 1 0 1 9(#3) -73.6 -65.3 0.751 0.673 1 1 1 1 1 1 1 1 1 0 0 10(#3) -75.5 -66.4 0.752 0.663 1 0 1 1 1 1 1 1 1 1 1 10(#2) -75.5 -66.4 0.752 0.664 1 1 1 1 1 1 0 1 1 1 1 10(#1) -75.5 -66.3 0.753 0.664 1 1 1 1 1 1 1 1 1 0 1 11(#1) -77.5 -67.5 0.753 0.652 1 1 1 1 1 1 1 1 1 1 1 1(#3) -77.8 -76.1 0.319 0.300 0 0 0 0 0 0 0 1 0 0 0 0(#3) -83.4 -82.6 0.000 0.000 0 0 0 0 0 0 0 0 0 0 0 1(#2) -83.7 -82.0 0.077 0.052 0 0 0 0 0 0 0 0 0 0 1 > pc.var _ princomp(X) > print(loadings(pc.var),cutoff=.1) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.111 0.346 0.918 -0.149 Adt -0.973 -0.126 0.164 Trk 0.119 0.856 -0.479 Sp 0.314 0.848 0.149 0.381 lw 0.151 -0.687 shl 0.399 -0.451 -0.776 itg sigs 0.305 0.896 0.297 acpt 0.147 -0.868 0.332 0.333 lan 0.932 -0.337 type 0.109 -0.134 -0.239 0.660 Comp. 10 Comp. 11 Len Adt Trk Sp lw -0.699 shl -0.120 itg 0.116 -0.992 sigs acpt lan type -0.685 > sqrt(diag(var(X))) [1] 7.6096835 18.6118460 2.3545402 5.8489765 0.4558808 3.0364408 [7] 0.4111696 0.6333908 10.9508219 1.3607174 0.7661883 > print(loadings(pc.cor),cutoff=.1) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.114 0.417 -0.372 0.181 0.497 0.562 -0.172 0.198 Adt -0.446 -0.141 -0.170 0.223 -0.125 0.108 Trk 0.447 -0.191 0.414 -0.111 -0.553 -0.460 0.166 -0.120 Sp -0.275 0.386 0.249 -0.310 0.140 -0.136 0.127 0.535 lw -0.134 0.769 0.421 0.254 -0.240 0.198 shl -0.358 0.147 -0.606 -0.288 -0.172 0.102 itg -0.415 -0.117 -0.169 0.286 -0.283 0.133 0.166 0.310 0.440 sigs -0.466 -0.210 0.658 -0.154 -0.370 0.270 0.251 acpt 0.188 -0.405 -0.167 -0.277 -0.685 0.407 lan -0.417 -0.150 -0.196 0.209 0.165 -0.790 type 0.441 0.132 0.226 0.666 -0.217 Comp. 10 Comp. 11 Len Adt 0.266 0.767 Trk 0.137 Sp -0.493 0.168 lw 0.198 shl 0.578 -0.152 itg -0.537 sigs acpt -0.213 lan -0.248 type 0.483 > print(loadings(pc.cor),cutoff=.2) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.417 -0.372 0.497 0.562 Adt -0.446 0.223 Trk 0.447 0.414 -0.553 -0.460 Sp -0.275 0.386 0.249 -0.310 0.535 lw 0.769 0.421 0.254 -0.240 shl -0.358 -0.606 -0.288 itg -0.415 0.286 -0.283 0.310 0.440 sigs -0.466 -0.210 0.658 -0.370 0.270 0.251 acpt -0.405 -0.277 -0.685 0.407 lan -0.417 0.209 -0.790 type 0.441 0.226 0.666 -0.217 Comp. 10 Comp. 11 Len Adt 0.266 0.767 Trk Sp -0.493 lw shl 0.578 itg -0.537 sigs acpt -0.213 lan -0.248 type 0.483 > > print(loadings(pc.cor),cutoff=.3) Comp. 1 Comp. 2 Comp. 3 Comp. 4 Comp. 5 Comp. 6 Comp. 7 Comp. 8 Comp. 9 Len 0.417 -0.372 0.497 0.562 Adt -0.446 Trk 0.447 0.414 -0.553 -0.460 Sp 0.386 -0.310 0.535 lw 0.769 0.421 shl -0.358 -0.606 itg -0.415 0.310 0.440 sigs -0.466 0.658 -0.370 acpt -0.405 -0.685 0.407 lan -0.417 -0.790 type 0.441 0.666 Comp. 10 Comp. 11 Len Adt 0.767 Trk Sp -0.493 lw shl 0.578 itg -0.537 sigs acpt lan type 0.483 > summary(pclm) Call: lm(formula = Rate ~ major.road + slow.downs + open.road + crowdedness) Residuals: Min 1Q Median 3Q Max -1.826 -0.8812 0.2622 0.5912 3.236 Coefficients: Value Std. Error t value Pr(>|t|) (Intercept) 3.9333 0.1751 22.4637 0.0000 major.road -0.2711 0.0871 -3.1136 0.0037 slow.downs 0.9628 0.1081 8.9078 0.0000 open.road 0.2500 0.1645 1.5198 0.1378 crowdedness -0.0058 0.1864 -0.0311 0.9754 Residual standard error: 1.093 on 34 degrees of freedom Multiple R-Squared: 0.7288 F-statistic: 22.84 on 4 and 34 degrees of freedom, the p-value is 3.116e-09 Correlation of Coefficients: (Intercept) major.road slow.downs open.road major.road 0 slow.downs 0 0 open.road 0 0 0 crowdedness 0 0 0 0 >