是错了就是帮助文件里面的例子
不过知道命令是做什么的就够了
. sysuse auto
(1978 Automobile Data)
. pca trunk weight length headroom
Principal components/correlation Number of obs = 74
Number of comp. = 4
Trace = 4
Rotation: (unrotated = principal) Rho = 1.0000
--------------------------------------------------------------------------
Component | Eigenvalue Difference Proportion Cumulative
-------------+------------------------------------------------------------
Comp1 | 3.02027 2.36822 0.7551 0.7551
Comp2 | .652053 .37494 0.1630 0.9181
Comp3 | .277113 .226551 0.0693 0.9874
Comp4 | .0505616 . 0.0126 1.0000
--------------------------------------------------------------------------
Principal components (eigenvectors)
--------------------------------------------------------------------
Variable | Comp1 Comp2 Comp3 Comp4 | Unexplained
-------------+----------------------------------------+-------------
trunk | 0.5068 0.2327 -0.8249 0.0921 | 0
weight | 0.5221 -0.4536 0.2677 0.6708 | 0
length | 0.5361 -0.3903 0.1370 -0.7358 | 0
headroom | 0.4280 0.7667 0.4786 -0.0057 | 0
--------------------------------------------------------------------
. estat residuals, fitted
Fitted correlation matrix
----------------------------------------------------------
Variable | trunk weight length headroom
-------------+--------------------------------------------
trunk | 1
weight | .6722057 1
length | .7265956 .9460086 1
headroom | .6620111 .4834558 .5162955 1
----------------------------------------------------------
Residual correlation matrix
----------------------------------------------------------
Variable | trunk weight length headroom
-------------+--------------------------------------------
trunk | 3.33e-16
weight | 5.55e-16 3.33e-16
length | 4.44e-16 2.22e-16 7.77e-16
headroom | 4.44e-16 5.55e-16 2.22e-16 7.77e-16
----------------------------------------------------------
.