stata课堂命令讲解(5)

2019-08-31 21:01

-------------+--------------------------------------------------+-------------

price | 0.3014 0.9183 0.1662 -0.1572 0.1160 | 0 mpg | -0.4558 0.0192 0.8754 0.1600 -0.0053 | 0 weight | 0.5000 -0.0386 0.1883 0.3737 -0.7573 | 0 length | 0.4908 -0.1795 0.1649 0.5386 0.6400 | 0 turn | 0.4589 -0.3501 0.3788 -0.7210 0.0591 | 0 ------------------------------------------------------------------------------ 进一步分析,各个主成份的载荷矩阵 . estat loadings

Principal component loadings (unrotated)

component normalization: sum of squares(column) = 1

----------------------------------------------------------------

| Comp1 Comp2 Comp3 Comp4 Comp5

-------------+--------------------------------------------------

price | .3014 .9183 .1662 -.1572 .116 mpg | -.4558 .01923 .8754 .16 -.005314 weight | .5 -.03859 .1883 .3737 -.7573 length | .4908 -.1795 .1649 .5386 .64 turn | .4589 -.3501 .3788 -.721 .05914 ---------------------------------------------------------------- 因素分析

.. factor price mpg weight length turn (obs=74)

Factor analysis/correlation Number of obs = 74

Method: principal factors Retained factors = 2

Rotation: (unrotated) Number of params = 9

--------------------------------------------------------------------------

Factor | Eigenvalue Difference Proportion Cumulative -------------+------------------------------------------------------------

Factor1 | 3.57602 3.31462 0.9655【第一个因子较大】 0.9655

Factor2 | 0.26140 0.28064 0.0706 1.0361 Factor3 |-0.01923 0.00881 -0.0052 1.0309

Factor4 | -0.02804 0.05822 -0.0076 1.0233

Factor5 | -0.08627【出现负数,数据有问题】 . -0.0233 1.0000

--------------------------------------------------------------------------

LR test: independent vs. saturated: chi2(10) = 379.35 Prob>chi2 = 0.0000

Factor loadings (pattern matrix) and unique variances

-------------------------------------------------

Variable | Factor1 Factor2 | Uniqueness -------------+--------------------+-------------- price | 0.5056 0.4222 | 0.5662 mpg | -0.8303 -0.0729 | 0.3052 weight | 0.9793 0.0517 | 0.0383 length | 0.9591 -0.1122 | 0.0676 turn | 0.8672 -0.2502 | 0.1853 -------------------------------------------------

作球形演变,不拒绝H0,故数据不适合做因素分析。做主成份分析 . estatkmo

Kaiser-Meyer-Olkin measure of sampling adequacy

-----------------------

Variable | kmo -------------+--------- price | 0.6831 mpg | 0.9609 weight | 0.7476 length | 0.7924 turn | 0.8932

-------------+--------- Overall | 0.8179

-----------------------

继续主成份分析,并做碎石图。

. pca price mpg weight length

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.04003 2.37073 0.7600 0.7600

Comp2 | .669304 .42455 0.1673 0.9273

Comp3 | .244754 .198846 0.0612 0.9885

Comp4 | .0459085 . 0.0115 1.0000 --------------------------------------------------------------------------

Principal components (eigenvectors)

--------------------------------------------------------------------

Variable | Comp1 Comp2 Comp3 Comp4 | Unexplained

-------------+----------------------------------------+-------------

price | 0.3775 0.9196 0.0240 0.1057 | 0 mpg | -0.5145 0.1901 0.8361 -0.0063 | 0 weight | 0.5521 -0.1521 0.3688 -0.7321 | 0 length | 0.5366 -0.3082 0.4053 0.6729 | 0 --------------------------------------------------------------------

. screeplot

构造两个主成份,根据得分画图scoreplot . predict sc1 sc2 (score assumed)

(2 components skipped)

Scoring coefficients

sum of squares(column-loading) = 1

------------------------------------------------------

Variable | Comp1 Comp2 Comp3 Comp4 -------------+---------------------------------------- price | 0.3775 0.9196 0.0240 0.1057 mpg | -0.5145 0.1901 0.8361 -0.0063 weight | 0.5521 -0.1521 0.3688 -0.7321 length | 0.5366 -0.3082 0.4053 0.6729 ------------------------------------------------------ .

作旋转,正交(默认)+斜交

. rotate

Principal components/correlation Number of obs = 74

Number of comp. = 4

Trace = 4

Rotation: orthogonal varimax (Kaiser off) Rho = 1.0000

--------------------------------------------------------------------------

Component | Variance Difference Proportion Cumulative

-------------+------------------------------------------------------------

Comp1 | 1.00001 9.27638e-06 0.2500 0.2500

Comp2 | 1 4.40853e-07 0.2500 0.5000

Comp3 | 1 .0000268949 0.2500 0.7500

Comp4 | .999977 . 0.2500 1.0000 --------------------------------------------------------------------------

Rotated components 旋转后结果,每个成分代表一个变量,便于成分定义。

--------------------------------------------------------------------

Variable | Comp1 Comp2 Comp3 Comp4 | Unexplained

-------------+----------------------------------------+-------------

price | -0.0000 0.0000 1.0000 -0.0000 | 0 mpg | 0.0000 1.0000 -0.0000 0.0000 | 0 weight | 1.0000 -0.0000 0.0000 -0.0000 | 0 length | 0.0000 -0.0000 0.0000 1.0000 | 0 --------------------------------------------------------------------

Component rotation matrix

------------------------------------------------------

| Comp1 Comp2 Comp3 Comp4 -------------+----------------------------------------

Comp1 | 0.5521 -0.5145 0.3775 0.5366 Comp2 | -0.1521 0.1901 0.9196 -0.3082 Comp3 | 0.3688 0.8361 0.0240 0.4053 Comp4 | -0.7321 -0.0063 0.1057 0.6729

------------------------------------------------------ .

第七周课 时间序列

.sysuse gdp96 .tsset

.ac gnp96, lags(20) .pac gnp96, lag(30) .scatter gnp96 date 验证趋势性

.wntestq gnp96,lags(40) H0原数据是portmanteau白噪声序列

另一种白噪声检验

谱密度图

. pergram gnp96

累计谱密度图 cumsp gnp96

#估计#


stata课堂命令讲解(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:Redhat

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: