其他
PCA降维大法 | 如何使用主成分分析方法构建综合指标?
PCA思想
PCA实践
pca x1 x2 x3 x4
Principal components/correlation Number of obs = 31
Number of comp. = 4
Trace = 4
Rotation: (unrotated = principal) Rho = 1.0000
--------------------------------------------------------------------------
Component | Eigenvalue Difference Proportion Cumulative
-------------+------------------------------------------------------------
Comp1 | 2.75053 1.81171 0.6876 0.6876
Comp2 | .938819 .707485 0.2347 0.9223
Comp3 | .231334 .152019 0.0578 0.9802
Comp4 | .0793157 . 0.0198 1.0000
--------------------------------------------------------------------------
Principal components (eigenvectors)
--------------------------------------------------------------------
Variable | Comp1 Comp2 Comp3 Comp4 | Unexplained
-------------+----------------------------------------+-------------
x1 | 0.5619 -0.2946 0.1363 -0.7609 | 0
x2 | 0.5401 0.2318 -0.7916 0.1673 | 0
x3 | 0.5160 -0.4715 0.3463 0.6257 | 0
x4 | 0.3554 0.7982 0.4847 0.0402 | 0
--------------------------------------------------------------------
predict c1 c2,score //计算主成分得分
gen innovation = (0.6876*c1+0.2347*c2)/0.9223
gsort -innovation