我在我的数据上使用R工具运行主成分分析,该数据有20个变量。运行PCA后,我发现有 只有7个组件定义了95%的方差。所以我选择了7个 组件和碎石图也显示相同。我的问题是如何 让这7个组件为模型做好准备,以及如何知道哪个 变量在哪个组件中。
mypca<-prcomp(pca,Center=T,Score=T)
summary(mpca)
biplot(mpca,cex=c(1,0.7))
plot(mpca,type='l')
我的输出ex-
mypca
Standard deviations:
[1] 7.767354e+05 5.209863e+05 2.078040e+05 6.977353e+04 5.907508e+04 3.739487e+04
[7] 2.939656e+04 2.040803e+04 1.824598e+04 1.335107e+04 7.003151e+03 2.081214e+03
[13] 1.015031e+03 6.049221e+01 2.112127e+00 1.715362e+00 4.009252e-01 2.409152e-01
[19] 1.621897e-01 4.669961e-02
Rotation:
PC1 PC2 PC3 PC4
DEL -4.446095e-01 -1.365373e-01 4.646724e-01 -9.940610e-02
BMP -2.294502e-01 -9.178854e-02 -5.172624e-01 5.812253e-02
QUICK -2.294736e-01 -9.180154e-02 -5.171577e-01 5.757215e-02
FLOOR -1.447338e-01 -5.555989e-02 -2.882114e-01 -7.512070e-03
BESTPRICE -1.186925e-01 -4.219830e-02 -1.647242e-01 -3.008956e-01
ESTIMATED -2.406338e-02 -3.139576e-03 6.057867e-02 -1.826918e-01
BMC -1.616599e-02 -2.238196e-03 3.833399e-02 -1.451767e-01
QUOTEDPRICE -4.365873e-02 -1.183297e-02 -5.564309e-02 -2.973147e-01
REQUESTED -3.652228e-02 -1.067759e-02 1.748905e-03 -7.063598e-01
APPROVED -3.287014e-02 -8.370115e-03 -4.601376e-02 -2.583385e-01
QUOTED -4.519003e-02 -1.224860e-02 -5.761017e-02 -3.077816e-01
REVENUE -3.170393e-01 9.480183e-01 -2.556628e-02 7.246487e-03
QUANTITY -2.404408e-07 3.705113e-07 5.301165e-07 -2.193947e-06
X1 -2.831711e-02 -3.113612e-03 4.470644e-02 -2.422465e-01
X2 -1.447338e-01 -5.555989e-02 -2.882114e-01 -7.512053e-03
X3 -7.297359e-01 -2.394014e-01 1.986816e-01 1.754359e-01
logY -4.388139e-07 -7.189463e-08 2.997868e-08 -3.984610e-06
logX1 -4.035784e-07 1.776258e-08 4.018616e-07 -3.839607e-06
logX2 -5.257616e-07 -1.990498e-08 -5.620499e-09 -3.691808e-06
logX3 -6.027988e-07 -8.882444e-08 3.592355e-07 -3.854011e-06
PC5 PC6 PC7 PC8
DEL 2.655996e-01 -4.871577e-01 4.858557e-01 -7.900992e-02
BMP -1.241183e-02 -1.416174e-01 1.216632e-01 7.375359e-02
QUICK -1.251853e-02 -1.418838e-01 1.211338e-01 7.373242e-02
FLOOR 6.466498e-02 -1.007271e-01 6.056409e-02 2.915110e-02
BESTPRICE 4.360928e-01 -2.468458e-02 -4.409979e-01 -6.050895e-01
ESTIMATED 2.348922e-01 8.722483e-02 -9.211753e-02 -6.305748e-02
BMC 1.765210e-01 5.616374e-02 -4.638213e-02 -7.011109e-02
QUOTEDPRICE 1.197124e-01 3.503717e-01 2.580183e-01 6.299166e-02
REQUESTED -6.252076e-01 -2.981786e-01 -1.336283e-01 -6.348676e-03
APPROVED -7.632572e-03 4.275728e-01 3.304660e-01 3.226306e-02
QUOTED 1.238035e-01 3.627518e-01 2.673074e-01 6.503694e-02
REVENUE -4.094309e-03 -3.884740e-03 -6.433982e-05 -2.820808e-03
QUANTITY 2.116696e-06 -2.182645e-06 -8.395780e-08 6.520955e-06
X1 3.956981e-01 -1.292357e-01 -3.700478e-01 7.706389e-01
X2 6.466492e-02 -1.007270e-01 6.056412e-02 2.915108e-02
X3 -2.589924e-01 3.847492e-01 -3.463963e-01 5.463960e-02
logY 3.011230e-06 3.069097e-06 2.083898e-06 4.412121e-06
logX1 3.955857e-06 1.506631e-06 1.223865e-07 5.651752e-06
logX2 3.462507e-06 1.953241e-06 9.907307e-07 4.681642e-06
logX3 3.276134e-06 3.016372e-06 1.466362e-06 5.386398e-06
01 -6.387075e-01 1.450583e-01 6.910169e-02
如何将这些组件转换为可以在模型中使用?
> PC1 PC2 PC3 PC4 PC5 PC6
> PC7 1 -1.45833502 2.11282609 -0.7707549 0.16211139 -0.6085632
> 0.01124237 0.1537967869 2 -0.06652181 0.50169802 -0.9595252 -0.10297871 -0.1358572 0.06384388 0.0340014187 3 0.53154796 0.03483829 -0.5028758 -0.06841849 -0.1215346 0.06935621 -0.0227362565 4 0.20524983 0.33707245 -0.7822114 -0.08349523 -0.1335755 0.06973486
> 0.0004967936 5 -0.12844451 0.52862201 -0.9929951 -0.10849844 -0.1353270 0.06171903 0.0435270695 6 -0.43249794 0.63998469 -1.1443612 -0.13686075 -0.1311380 0.04991448 0.0934741840