楼主: nkzhh
108044 142

[程序分享] 用stata如何检验panel的自相关和异方差   [推广有奖]

91
zhangtao 发表于 2011-4-8 13:58:18
非常非常好好好

92
何志伟 在职认证  发表于 2011-4-9 18:45:49
受益匪浅~~~~~~~~~~~~~~~

93
yichikawakiko 发表于 2011-4-12 11:02:39
受益匪浅~~~

94
邓艳平 发表于 2011-4-13 23:21:06
thanks   1# nkzhh

95
yangyu1107 发表于 2011-4-14 08:31:54
我觉得上面的数据可以不做序列相关检验!

96
宋军发 发表于 2011-4-14 10:02:31
正在做面板的,目前还不知道要不要处理自相关和异方差
勤奋努力在前,顺其自然在后!

97
luoxi 发表于 2011-4-28 15:22:04
. xtgls lnc lncyjg lnnyqd lnnyjg, panel(heteroskedastic) igls
Iteration 1: tolerance = .01581804
Iteration 2: tolerance = .01178879
Iteration 3: tolerance = .00786204
Iteration 4: tolerance = .00755356
Iteration 5: tolerance = .00757862
Iteration 6: tolerance = .00742984
Iteration 7: tolerance = .00878119
Iteration 8: tolerance = .0085893
Iteration 9: tolerance = .00714584
Iteration 10: tolerance = .00491389
Iteration 11: tolerance = .00284052
Iteration 12: tolerance = .00154705
Iteration 13: tolerance = .00083718
Iteration 14: tolerance = .00045234
Iteration 15: tolerance = .00024345
Iteration 16: tolerance = .00013044
Iteration 17: tolerance = .00006964
Iteration 18: tolerance = .00003708
Iteration 19: tolerance = .00001972
Iteration 20: tolerance = .00001048
Iteration 21: tolerance = 5.568e-06
Iteration 22: tolerance = 2.959e-06
Iteration 23: tolerance = 1.573e-06
Iteration 24: tolerance = 8.363e-07
Iteration 25: tolerance = 4.448e-07
Iteration 26: tolerance = 2.366e-07
Iteration 27: tolerance = 1.259e-07
Iteration 28: tolerance = 6.703e-08


Cross-sectional time-series FGLS regression

Coefficients:  generalized least squares
Panels:        heteroskedastic
Correlation:   no autocorrelation

Estimated covariances      =        28          Number of obs      =       364
Estimated autocorrelations =         0          Number of groups   =        28
Estimated coefficients     =         4          Time periods       =        13
                                                Wald chi2(3)       =  94950.33
Log likelihood             =  292.3762          Prob > chi2        =    0.0000

------------------------------------------------------------------------------
         lnc |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lncyjg |   .0442005   .0058945     7.50   0.000     .0326475    .0557536
      lnnyqd |   .9746002   .0040893   238.33   0.000     .9665853    .9826152
      lnnyjg |   .6989617   .0068999   101.30   0.000     .6854381    .7124852
       _cons |   1.100894   .0226045    48.70   0.000      1.05659    1.145198
------------------------------------------------------------------------------

. estimates store igls

. xtgls lnc lncyjg lnnyqd lnnyjg

Cross-sectional time-series FGLS regression

Coefficients:  generalized least squares
Panels:        homoskedastic
Correlation:   no autocorrelation

Estimated covariances      =         1          Number of obs      =       364
Estimated autocorrelations =         0          Number of groups   =        28
Estimated coefficients     =         4          Time periods       =        13
                                                Wald chi2(3)       =  13366.27
Log likelihood             =  58.77705          Prob > chi2        =    0.0000

------------------------------------------------------------------------------
         lnc |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lncyjg |   .0892351   .0141136     6.32   0.000      .061573    .1168973
      lnnyqd |   1.026689   .0099941   102.73   0.000     1.007101    1.046277
      lnnyjg |   .5551315   .0178899    31.03   0.000     .5200679    .5901952
       _cons |   1.080897   .0618448    17.48   0.000     .9596838    1.202111
------------------------------------------------------------------------------

. local df=e(N_g)-1

. lrtest igls . , df(`df')

Likelihood-ratio test                                  LR chi2(27) =    467.20
(Assumption: . nested in igls)                         Prob > chi2 =    0.0000

.
以上是我按照1楼得说法做的
请高手帮我看下 这是什么意思啊
不懂程序滴人啊

98
sophiafinn 发表于 2011-5-3 03:05:16
from help file,除此对于small T, large N , 还可以用 xtabond and xtabond2
help ivreg2

help  xtabond2


   (Heteroskedastic and autocorrelation-consistent (HAC) inference in an OLS
    regression)

        . ivreg2 cinf unem, bw(3) kernel(bartlett) robust small

        . newey cinf unem, lag(2)

    (AC and HAC in IV and GMM estimation)

        . ivreg2 cinf (unem = l(1/3).unem), bw(3)

        . ivreg2 cinf (unem = l(1/3).unem), bw(3) gmm2s kernel(thann)

        . ivreg2 cinf (unem = l(1/3).unem), bw(3) gmm2s kernel(qs) robust
            orthog(l1.unem)

    (Examples using Large N, Small T Panel Data)

        . use http://fmwww.bc.edu/ec-p/data/macro/abdata.dta

        . tsset id year

    (Autocorrelation-consistent inference in an IV regression)

        . ivreg2 n (w k ys = d.w d.k d.ys d2.w d2.k d2.ys), bw(1) kernel(tru)

    (Two-step effic. GMM in the presence of arbitrary heteroskedasticity and
    autocorrelation)

        . ivreg2 n (w k ys = d.w d.k d.ys d2.w d2.k d2.ys), bw(2) gmm2s
            kernel(tru) robust

    (Two-step effic. GMM in the presence of arbitrary heterosked. and
    intragroup correlation)

        . ivreg2 n (w k ys = d.w d.k d.ys d2.w d2.k d2.ys), gmm2s cluster(id)
statax 发表于 2006-1-26 14:11
question: 在什么时候需要检验panel的自相关?
比如只有T=6,而N=30,需要吗?因为时序个数只有6,而截面却是大样本!!

99
chenecly 发表于 2011-5-3 12:09:24
谢谢。。。。。。。。。。。。

100
pan6pcpc 发表于 2011-6-22 17:06:14
Mark一下、、、

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-25 06:40