楼主: clapton
10093 18

[其他] 请教连老师,关于stata10与stata12输出结果不同的问题 [推广有奖]

  • 0关注
  • 2粉丝

VIP

已卖:23份资源

副教授

34%

还不是VIP/贵宾

-

威望
0
论坛币
9323 个
通用积分
30.3700
学术水平
1 点
热心指数
0 点
信用等级
0 点
经验
1713 点
帖子
244
精华
0
在线时间
1337 小时
注册时间
2005-10-18
最后登录
2025-3-2

楼主
clapton 发表于 2012-10-12 10:02:47 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
我有一个关于stata软件的问题,就是任何一个面板数据,如果我放在STATA10里面跑回归,

xtreg y x1 x2,fe
xtreg y x1 x2,fe robust     (F(n,k)值里面的k是n-k-1,比如50个观察值,2个系数,10个面板,那么是F(2,47))
xtreg y x1 x3,fe vce(cluster panelid)      (F值里面的k是面板 的个数,即F值是F(2,9))
这三个命令在版本10里面得到的结果是不一样的,系数一样,但标准误不同。


而同样的数据和命令放在stata12里面跑,后面两个命令就一样了。就是说STATA12里面默认了ROBUST命令是CLUSTER ON PANELID的。我现在的问题是,有没有办法在STATA12里面得到之前在STATA10里面是ROBUST但是不是CLUSTER的结果(即第二个)。

这个我真是想了很久没有弄明白,我也找了很久,没有发现有关于这个问题的说法。

希望连老师能够解惑,多谢了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:stata10 stata12 Stata tata 结果不同 软件

沙发
ywh19860616 发表于 2012-10-12 10:48:56
vce(vcetype)        vcetype may be conventional, robust, cluster clustvar, bootstrap, or jackknife
一份耕耘,一份收获。

藤椅
clapton 发表于 2012-10-12 11:34:33
多谢楼上的朋友,但是我使用stata12给vce加了选项,如
xtreg y x1 x2,fe vce(robust)   
仍然无法得到stata10里面
xtreg y x1 x2,fe robust
的结果

板凳
ywh19860616 发表于 2012-10-12 11:50:54
webuse nlswork
xtset idcode
xtreg ln_w  age, fe vce(robust)


这个例子在11和12的结果是一样的,两者命令也是同样。
一份耕耘,一份收获。

报纸
蓝色 发表于 2012-10-12 11:50:54
___  ____  ____  ____  ____ tm
/__    /   ____/   /   ____/
___/   /   /___/   /   /___/   10.1   Copyright 1984-2009
  Statistics/Data Analysis            StataCorp
                                      4905 Lakeway Drive
     Special Edition                  College Station, Texas 77845 USA
                                      800-STATA-PC        http://www.stata.com
                                      979-696-4600        stata@stata.com
                                      979-696-4601 (fax)

Single-user Stata for Windows perpetual license:
       Serial number:  12345678901
         Licensed to:  Unidata Users
                       Unidata Studio

Notes:
      1.  (/m# option or -set memory-) 10.00 MB allocated to data
      2.  (/v# option or -set maxvar-) 5000 maximum variables

running D:\ProgramFiles\Stata10\profile.do ...

. do "C:\Users\QiangLi\AppData\Local\Temp\STD01000000.tmp"

. *Setup
. use "D:\Dataset_program\stata11dataset\nlswork.dta" ,clear
(National Longitudinal Survey.  Young Women 14-26 years of age in 1968)

. xtset idcode year
       panel variable:  idcode (unbalanced)
        time variable:  year, 68 to 88, but with gaps
                delta:  1 unit

. ***********************************************
. xtreg ln_w  age,fe

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,23799)         =   2720.20
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0003477    52.16   0.000     .0174534    .0188164
       _cons |   1.148214   .0102579   111.93   0.000     1.128107     1.16832
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(4709, 23799) =     8.81         Prob > F = 0.0000

. xtreg ln_w  age,fe  vce(robust)

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,4709)          =    884.05
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0006099    29.73   0.000     .0169392    .0193306
       _cons |   1.148214   .0177153    64.81   0.000     1.113483    1.182944
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtreg ln_w  age,fe  vce(cluster idcode)

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,4709)          =    884.05
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0006099    29.73   0.000     .0169392    .0193306
       _cons |   1.148214   .0177153    64.81   0.000     1.113483    1.182944
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtreg ln_w  age,fe  robust

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,4709)          =    884.05
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0006099    29.73   0.000     .0169392    .0193306
       _cons |   1.148214   .0177153    64.81   0.000     1.113483    1.182944
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------

.
end of do-file

地板
蓝色 发表于 2012-10-12 11:51:38
  ___  ____  ____  ____  ____ (R)
/__    /   ____/   /   ____/
___/   /   /___/   /   /___/   12.1   Copyright 1985-2011 StataCorp LP
  Statistics/Data Analysis            StataCorp
                                      4905 Lakeway Drive
     Special Edition                  College Station, Texas 77845 USA
                                      800-STATA-PC        http://www.stata.com
                                      979-696-4600        stata@stata.com
                                      979-696-4601 (fax)

Single-user Stata network perpetual license:
       Serial number:  93611859953
         Licensed to:  StataUser
                       StataUser

Notes:
      1.  (/v# option or -set maxvar-) 5000 maximum variables

running D:\ProgramFiles\StataSE12\profile.do ...

. do "C:\Users\QiangLi\AppData\Local\Temp\STD00000000.tmp"

. *Setup
. use "D:\Dataset_program\stata11dataset\nlswork.dta" ,clear
(National Longitudinal Survey.  Young Women 14-26 years of age in 1968)

. xtset idcode year
       panel variable:  idcode (unbalanced)
        time variable:  year, 68 to 88, but with gaps
                delta:  1 unit

. ***********************************************
. xtreg ln_w  age,fe

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,23799)         =   2720.20
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0003477    52.16   0.000     .0174534    .0188164
       _cons |   1.148214   .0102579   111.93   0.000     1.128107     1.16832
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(4709, 23799) =     8.81         Prob > F = 0.0000

. xtreg ln_w  age,fe  vce(robust)

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,4709)          =    884.05
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0006099    29.73   0.000     .0169392    .0193306
       _cons |   1.148214   .0177153    64.81   0.000     1.113483    1.182944
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtreg ln_w  age,fe  vce(cluster idcode)

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,4709)          =    884.05
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0006099    29.73   0.000     .0169392    .0193306
       _cons |   1.148214   .0177153    64.81   0.000     1.113483    1.182944
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtreg ln_w  age,fe  robust

Fixed-effects (within) regression               Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                F(1,4709)          =    884.05
corr(u_i, Xb)  = 0.0314                         Prob > F           =    0.0000

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0181349   .0006099    29.73   0.000     .0169392    .0193306
       _cons |   1.148214   .0177153    64.81   0.000     1.113483    1.182944
-------------+----------------------------------------------------------------
     sigma_u |  .40635023
     sigma_e |  .30349389
         rho |  .64192015   (fraction of variance due to u_i)
------------------------------------------------------------------------------

.
end of do-file


7
蓝色 发表于 2012-10-12 11:53:49
看看一样不一样啊

8
clapton 发表于 2012-10-13 00:27:54
郁闷啊,我的结果确实不同,版主请看。
另外,注意我分别使用robust和cluster时,F统计值是不一样的,而上面版主的结果里F统计值一直没有变化,不只是否与此有关。

*************stata10.0的结果

. webuse nlswork
(National Longitudinal Survey.  Young Women 14-26 years of age in 1968)

. xtreg ln_wage hours,fe

Fixed-effects (within) regression               Number of obs      =     28467
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.0001                         Obs per group: min =         1
       between = 0.0314                                        avg =       6.0
       overall = 0.0074                                        max =        15

                                                F(1,23756)         =      3.14
corr(u_i, Xb)  = 0.0976                         Prob > F           =    0.0764

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       hours |   .0004474   .0002525     1.77   0.076    -.0000475    .0009423
       _cons |   1.658941   .0094249   176.02   0.000     1.640468    1.677415
-------------+----------------------------------------------------------------
     sigma_u |   .4229084
     sigma_e |  .32040339
         rho |  .63532952   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(4709, 23756) =     8.30         Prob > F = 0.0000

. xtreg ln_wage hours,fe robust

Fixed-effects (within) regression               Number of obs      =     28467
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.0001                         Obs per group: min =         1
       between = 0.0314                                        avg =       6.0
       overall = 0.0074                                        max =        15

                                                F(1,23756)         =      1.20
corr(u_i, Xb)  = 0.0976                         Prob > F           =    0.2724

                                 (Std. Err. adjusted for clustering on idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       hours |   .0004474   .0004076     1.10   0.272    -.0003516    .0012464
       _cons |   1.658941   .0152638   108.68   0.000     1.629023    1.688859
-------------+----------------------------------------------------------------
     sigma_u |   .4229084
     sigma_e |  .32040339
         rho |  .63532952   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtreg ln_wage hours,fe vce(cluster  idcode)

Fixed-effects (within) regression               Number of obs      =     28467
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.0001                         Obs per group: min =         1
       between = 0.0314                                        avg =       6.0
       overall = 0.0074                                        max =        15

                                                F(1,4709)          =      0.81
corr(u_i, Xb)  = 0.0976                         Prob > F           =    0.3696

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       hours |   .0004474   .0004986     0.90   0.370    -.0005301     .001425
       _cons |   1.658941   .0182299    91.00   0.000     1.623202     1.69468
-------------+----------------------------------------------------------------
     sigma_u |   .4229084
     sigma_e |  .32040339
         rho |  .63532952   (fraction of variance due to u_i)
------------------------------------------------------------------------------

9
clapton 发表于 2012-10-13 00:28:46
***************stata12的结果


. webuse nlswork
(National Longitudinal Survey.  Young Women 14-26 years of age in 1968)

. xtreg ln_wage hours,fe

Fixed-effects (within) regression               Number of obs      =     28467
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.0001                         Obs per group: min =         1
       between = 0.0314                                        avg =       6.0
       overall = 0.0074                                        max =        15

                                                F(1,23756)         =      3.14
corr(u_i, Xb)  = 0.0976                         Prob > F           =    0.0764

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       hours |   .0004474   .0002525     1.77   0.076    -.0000475    .0009423
       _cons |   1.658941   .0094249   176.02   0.000     1.640468    1.677415
-------------+----------------------------------------------------------------
     sigma_u |   .4229084
     sigma_e |  .32040339
         rho |  .63532952   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(4709, 23756) =     8.30         Prob > F = 0.0000

. xtreg ln_wage hours,fe robust
Fixed-effects (within) regression               Number of obs      =     28467
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.0001                         Obs per group: min =         1
       between = 0.0314                                        avg =       6.0
       overall = 0.0074                                        max =        15

                                                F(1,4709)          =      0.81
corr(u_i, Xb)  = 0.0976                         Prob > F           =    0.3696

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       hours |   .0004474   .0004986     0.90   0.370    -.0005301     .001425
       _cons |   1.658941   .0182299    91.00   0.000     1.623202     1.69468
-------------+----------------------------------------------------------------
     sigma_u |   .4229084
     sigma_e |  .32040339
         rho |  .63532952   (fraction of variance due to u_i)
------------------------------------------------------------------------------


. xtreg ln_wage hours,fe vce(cluster  idcode)

Fixed-effects (within) regression               Number of obs      =     28467
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.0001                         Obs per group: min =         1
       between = 0.0314                                        avg =       6.0
       overall = 0.0074                                        max =        15

                                                F(1,4709)          =      0.81
corr(u_i, Xb)  = 0.0976                         Prob > F           =    0.3696

                              (Std. Err. adjusted for 4710 clusters in idcode)
------------------------------------------------------------------------------
             |               Robust
     ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       hours |   .0004474   .0004986     0.90   0.370    -.0005301     .001425
       _cons |   1.658941   .0182299    91.00   0.000     1.623202     1.69468
-------------+----------------------------------------------------------------
     sigma_u |   .4229084
     sigma_e |  .32040339
         rho |  .63532952   (fraction of variance due to u_i)
------------------------------------------------------------------------------

.

10
蓝色 发表于 2012-10-13 02:02:46
update 25feb2008 -------------------------------------------------------------------------------------------------        -

Ado-files

1.  bootstrap has the new jackknifeopts() option for passing options to jackknife when the bca option is specified.

2.  The documentation for glm and binreg did not mention that the constraints() option was allowed when fitting models
using ml optimization.  The help files and dialogs have been updated.

3.  glm, when used with the binomial family and either the log or identity link, sometimes issued a spurious warning
message regarding inadmissible predictions.  This has been fixed.

4.  When using a saved scatterplot matrix that was created using the by() option and that had previously been edited
with the Graph Editor, Observation Property edits might be ignored for some observations.  This has been fixed.

5.  The Y axis tab has been removed from the dialog box for graph pie.

6.  kdensity displayed a bandwidth of zero on the graph even though the bandwidth was not exactly zero.  kdensity now
displays more significant digits for the bandwidth in the resulting graph.

7.  notes did not attach notes to a variable name with exactly 32 characters.  This has been fixed.

8.  predict with the scores option after mlogit was displaying an error when specifying the correct number of
variables.  This has been fixed.

9.  predict with the scores option after ologit and oprobit produced incorrect equation-level score values when the
estimation results were computed under version control less than 9.  This affected the standard errors produced by
svy: ologit and svy: oprobit when they were called under version control less than 9.  This has been fixed.

10.  ssc whatsnew and ssc whatshot have been renamed ssc new and ssc hot.  The old subcommand names continue to work
but are undocumented.

11.  The following changes are made to sts graph and stcurve for kernel-based hazard estimation (when option hazard is
used).

A.  The use of the boundary-adjusted kernel functions epan2, biweight, or rectangular can sometimes lead to
negative estimates of the hazard function.  In such cases, the negative hazard estimates are replaced with 0.

B.  When a hazard estimation grid included a time point equal to the value of a bandwidth, the hazard estimates
obtained using an epan2, biweight, or rectangular kernel were incorrectly shifted by one time point in the
right boundary region.  This could result in a slightly different curve being displayed in the right boundary
region with these kernels.  This has been fixed.

C.  The left boundary region is changed to be the region [L,L+h) instead of the old region [0,h).  Here L is the
minimum analysis time at which failure occurred, and h is the bandwidth.  As such, the default plotting range
is restricted to [L,R] (R is the observed maximum failure time) for the epan2, biweight, and rectangular
kernels.  For other available kernels, the default plotting range is [L+h,R-h].

12.  svy results will now report the population and subpopulation sizes out to a larger number of significant digits,
reserving scientific notation for sizes greater than 99 trillion.

13.  svy: tabulate twoway, when used with data that contained a stratum with a single sampling unit, would report
zero-valued test statistics (with p-values of 1) when it should have reported missing values.  This has been
fixed.

14.  svy: tabulate twoway now recognizes value labels assigned to extended missing values.

15.  svyset would not check for invalid syntax beyond the stage that contained an fpc() option.  This has been fixed.

16.  The dialog box for xtabond did not allow vce(robust) to be specified with the twostep option.  This has been
fixed.

17.  xtgee terminated with error 198, Unable to identify sample, if pweights were used with the noconstant option.
This has been fixed.

18.  xtgee did not properly mark the estimation sample (contained in e(sample)) when using the autoregressive,
stationary, and nonstationary correlation structures, and observations were dropped because they did not have
equally spaced time intervals.  This has been fixed.

19.  xtmixed, xtmelogit, and xtmepoisson now support time-series operators.

20.  xtreg, fe now uses vce(cluster id) when vce(robust) is specified, in light of the new results in Stock and Watson,
"Heteroskedasticity-robust standard errors for fixed-effects panel-data regression," Econometrica 76 (2008):
155-174.


已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
Sunknownay + 100 + 10 + 1 + 1 + 1 热心帮助其他会员

总评分: 经验 + 100  论坛币 + 10  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

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

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