这是PCA的结果。 RC1和RC3可以解释哪些变量是相关的。但是,无法在RC2中解释。当检查特征值时,因子的数量是3.但是真的只有两个吗?或哪些变量应与RC2相关?
输入变量是7种类型。我用'principal()'函数。
names(mydata)
[1] "A" "B" "C" "D" "E" "F" "G"
> x<-cbind(A, B, C, D, E, F, G)
> e_value<-eigen(cor(x))
> e_value
eigen() decomposition
$values
[1] 2.3502254 1.4170606 1.2658360 0.8148231 0.5608698 0.3438629 0.2473222
$vectors
[,1] [,2] [,3] [,4] [,5]
[,6] [,7]
[1,] 0.2388621 0.46839043 0.37003850 0.47205027 -0.58802244
-0.133939151 -0.009233395
[2,] 0.1671739 -0.71097984 -0.14062597 0.25083439 -0.26726985
-0.502411130 -0.244983436
[3,] 0.2132841 -0.19677142 0.64662974 0.34508779 0.61416969
-0.003950736 0.036814153
[4,] 0.1697817 -0.24468987 0.55631886 -0.69016805 -0.34039757
0.039899816 0.089531675
[5,] 0.4857016 0.36681570 -0.09905329 -0.31456085 0.26225761
-0.344919726 -0.577088755
[6,] -0.5359245 0.20164924 0.17958243 -0.13144417 0.11755661
-0.748885304 0.218966481
[7,] 0.5635252 0.03619081 -0.27131854 -0.05105919 0.08439733
-0.219629096 0.741315659
> PCA<-principal(x,nfactors = 3, rotate = "varimax")
> print(PCA)
Principal Components Analysis
Call: principal(r = x, nfactors = 3, rotate = "varimax")
Standardized loadings (pattern matrix) based upon correlation matrix
RC1 RC2 RC3 h2 u2 com
A 0.24 0.69 0.29 0.62 0.38 1.6
B 0.25 -0.83 0.24 0.81 0.19 1.3
C 0.06 0.05 0.83 0.69 0.31 1.0
D 0.03 -0.04 0.74 0.54 0.46 1.0
E 0.76 0.42 -0.01 0.76 0.24 1.5
F -0.83 0.24 -0.17 0.77 0.23 1.3
G 0.92 -0.01 0.00 0.84 0.16 1.0
RC1 RC2 RC3
SS loadings 2.23 1.40 1.40
Proportion Var 0.32 0.20 0.20
Cumulative Var 0.32 0.52 0.72
Proportion Explained 0.44 0.28 0.28
Cumulative Proportion 0.44 0.72 1.00
Mean item complexity = 1.3
Test of the hypothesis that 3 components are sufficient.
The root mean square of the residuals (RMSR) is 0.11
with the empirical chi square 63.33 with prob < 1.1e-13
Fit based upon off diagonal values = 0.84
PCA和7个变量之间的关系在输出中是正确的:
Standardized loadings (pattern matrix) based upon correlation matrix
RC1 RC2 RC3 h2 u2 com
A 0.24 0.69 0.29 0.62 0.38 1.6
B 0.25 -0.83 0.24 0.81 0.19 1.3
C 0.06 0.05 0.83 0.69 0.31 1.0
D 0.03 -0.04 0.74 0.54 0.46 1.0
E 0.76 0.42 -0.01 0.76 0.24 1.5
F -0.83 0.24 -0.17 0.77 0.23 1.3
G 0.92 -0.01 0.00 0.84 0.16 1.0
该矩阵告诉您哪些变量与PCA相关。所以你可以看到A
和B
与主成分2(标记为RC2
)密切相关。
PCA是数据的轮换,因此存在与变量一样多的主成分(7)。但是大多数人对可视化感兴趣,因此通常只选择前2或3个主要组件进行绘图。