全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
60727 28
2017-01-11
受到警告
尽管这个问题不止一个人问过,但是搜遍各家网站也没有满意的答案,有些不懂装懂的B只告诉你看手册,可是手册中也没有比较这两个命令的区别,下面我翻译一下stata 中有关回答和手册解释:
1.stata官网中的回答
Re: st: Some questions about ivreg2 xtivreg xtivreg2

From          "Austin Nichols" <austinnichols@gmail.com>
To          statalist@hsphsun2.harvard.edu
Subject          Re: st: Some questions about ivreg2 xtivreg xtivreg2
Date          Tue, 13 Nov 2007 14:24:59 -0500
Roma <fr1975@katamail.com>:
The difference between ivreg2 and xtivreg2 is more or less the same as
the difference between reg and xtreg; see the [XT] xtreg manual entry.

In short, if
yit = Xit b + Wi c + uit
then
yi(t-1) =  Xi(t-1) b + Wi c + ui(t-1)
and
yit - yi(t-1) = Xit b - Xi(t-1) b + uit - ui(t-1)
which is estimated via the -fd- option on -xtivreg2-.

Also if
yit = Xit b + Wi c + uit
then
Es(yis) =  Es(Xis) b + Wi c + Es(uis)
where Es is the mean over all t, and
yit - Es(yis) = Xit b - Es(Xis)  b + uit - Es(uis)
which is estimated via the -fe- option on -xtivreg2-.

Note this applies even if you don't observe Wi and can't estimate c,
so by using -xtivreg2- you may eliminate another source of bias.

-xtivreg2- is a program that transforms the data appropriately, then
calls -ivreg2- to do the estimation.  Hence a "wrapper" for -ivreg2-.


On 11/13/07, fr1975@katamail.com <fr1975@katamail.com> wrote:
> * ivreg2 y1 x1 x2 (x3 = x4 x5 x6), first bw(2) gmm2s kernel(tru)
>
> Then, I was suggested to compute the same equation by "xtivreg2", getting very different result (and the insignificance of one instrument)!
> I know that as estimation methods differ you have something of a check on whether models  are stable, efficient and so on, but I really don't understand why and how it would be better estimating the equation above by xtivreg2 (or xtvreg).
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

翻译:
Re:st:关于ivreg2 xtivreg xtivreg2的一些问题

从“奥斯汀尼科尔斯”<austinnichols@gmail.com>
statalist@hsphsun2.harvard.edu
主题Re:st:关于ivreg2 xtivreg xtivreg2的一些问题
Date Tue,13 Nov 2007 14:24:59 -0500
Roma <fr1975@katamail.com>:
ivreg2和xtivreg2之间的差异或多或少相同
reg和xtreg之间的差异;请参见[XT] xtreg手动输入。

总之,如果
yit = Xit b + Wi c + uit
然后
yi(t-1)= Xi(t-1)b + Wi c + ui(t-1)

yit-yi(t-1)= Xit b-Xi(t-1)b +
这通过-fd-选项在-xtivreg2-上估计。

也是如果
yit = Xit b + Wi c + uit
然后
Es(yis)= Es(Xis)b + Wi c + Es(uis)
其中Es是所有t的平均值,
yit-Es(yis)= Xit b-Es(Xis)b + uit-Es(uis)
这通过-fe-选项在-xtivreg2-上估计。

注意这适用,即使你不遵守Wi并且不能估计c,所以你可以通过使用-xtivreg2-消除另一个偏见的来源。

-xtivreg2-是一个适当地调用-ivreg2-转换数据的程序来做估计。因此,被称为-ivreg2-的“包装器”。


在11/13/07,fr1975@katamail.com <fr1975@katamail.com>写道:
> * ivreg2 y1 x1 x2(x3 = x4 x5 x6),first bw(2)gmm2s kernel(tru)
>然后,我建议通过“xtivreg2”计算相同的方程,得到非常不同的结果(和一个仪器的无意义)!
>我知道,作为估计方法不同,你有一些模型设计更为稳定,高效等等,但我真的不明白为什么和如何更好地估计上面的方程xtivreg2(或xtvreg)。
*:
*搜索和帮助尝试:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/


2.ivreg2手册翻译

ivreg2为线性回归模型实现了一系列单方程估计方法:OLS,工具变量(IV,也称为两阶段最小二乘法,2SLS),广义矩(GMM)方法,有限信息最大似然 LIML)和k类估计量。 在IV / GMM的语言中,varlist1是外生回归或“包含的工具”,varlist_iv是从回归或“排除的工具”中排除的外生变量,varlist2是正被“检测”的内源回归。
ivreg2还将使用鲁棒(异方差一致),自相关一致(AC),异方差和自相关一致(HAC)和聚类鲁棒方差估计来估计线性回归模型。

ivreg2是Stata官方ivregress的替代品。其特点包括:两步可行GMM估计(gmm2s选项)和连续更新的GMM估计(提示选项); LIML和k类估计;过度识别和欠认定检验统计自动输出;工具子集异质性的C统计检验(orthog()选项);内生回归的内生性测试(endog()选项);仪器冗余测试(冗余()选项);用户指定的内核(内核()选项)选择基于内核的自相关一致性(AC)和异方差和自相关一致性(HAC)标准误差和协方差估计(bw两级簇鲁棒标准误差和统计;默认报告大样本统计(z和卡方而不是t和F);小选项报告小样本统计;第一阶段回归报告有各种测试和统计鉴定和仪器相关性; ffirst选项只报告这些识别统计信息,而不是第一阶段回归结果本身。 ivreg2也可以用于使用与官方回归和newey相同的命令语法的普通最小平方(OLS)估计。

ivreg2报告的标准误差和测试统计可以使得与i.i.d假设的各种违反一致。 错误。 当这些选项与gmm2s或cue选项(见下文)组合时,所报告的参数估计器在存在相同违反i.i.d的情况下也是高效的。
3,xtivreg2手册翻译

xtivreg2实现了具有可能的内源性回归的固定效应和一阶差分面板数据模型的IV / GMM估计。 它本质上是ivreg2的包装器,必须安装xtivreg2才能运行(Stata 9需要ivreg2版本2.1.11或更高版本; Stata 8.2需要ivreg28)。 xtivreg2支持ivreg2的所有估计和报告选项; 有关完整的描述和示例,请参阅帮助ivreg2。 特别地,xtivreg2还支持ivreg2(异方差,簇和自相关 - 鲁棒协方差矩阵和标准误差,过度识别和正交性测试,第一阶段和弱/不足识别统计等)提供的所有统计数据,并将报告 具有面板数据估计所需的任何自由度调整。

这里关键问题是:“包装器”怎么理解?是否可以理解为ivreg2可以做的,xtivreg2也可以做,反之则不行。
xtivreg2不能用于有虚拟变量的方程估计,因为差分掉了?是这样吗?
但是ivreg2却可以,因为不需要差分,或者说不能差分,因为ivreg2允许有时间效应(即适用于混合面板),而xtivreg2只能做固定效应,所以也不能研究具有虚拟变量的问题,是这样吗?
因此又演化出xtbond等可以做时间效应的面板工具命令,是这样吗?

我估计这一个问题就筛掉一大批伪博士。
二维码

扫码加我 拉你入群

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

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

全部回复
2017-1-11 18:12:08
我没特别比较过,虽然都是利用工具变量处理内生性问题,但 xtivreg2 特别试用于面板资料!
二维码

扫码加我 拉你入群

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

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

2017-1-11 18:25:32
黃河泉 发表于 2017-1-11 18:12
我没特别比较过,虽然都是利用工具变量处理内生性问题,但 xtivreg2 特别试用于面板资料!
那你看看下面的结果,为何虚拟变量全部出现共线呢?命令应该怎样写呢
xi:xtivreg2  profit profit_1  lnwz   ( lnbor lninv =lnarate lncjl   lnfeestr2   i.safe2 i.cu  i.ll i.pp ),fe first
i.safe2           _Isafe2_1-6         (naturally coded; _Isafe2_1 omitted)
i.cu              _Icu_1-3            (naturally coded; _Icu_1 omitted)
i.ll              _Ill_1-6            (naturally coded; _Ill_1 omitted)
i.pp              _Ipp_0-1            (naturally coded; _Ipp_0 omitted)
Warning - collinearities detected
Vars dropped:       _Isafe2_2 _Isafe2_3 _Isafe2_4 _Isafe2_5 _Isafe2_6 _Icu_2
                    _Icu_3 _Ill_2 _Ill_3 _Ill_4 _Ill_5 _Ill_6

FIXED EFFECTS ESTIMATION
------------------------
Number of groups =        79                    Obs per group: min =        11
                                                               avg =      19.1
                                                               max =        33
Warning - collinearities detected
Vars dropped:  _Isafe2_2 _Isafe2_3 _Isafe2_4 _Isafe2_5 _Isafe2_6 _Icu_2 _Icu_3
               _Ill_2 _Ill_3 _Ill_4 _Ill_5 _Ill_6

First-stage regressions
-----------------------


FIXED EFFECTS ESTIMATION
------------------------
Number of groups =        79                    Obs per group: min =        11
                                                               avg =      19.1
                                                               max =        33

First-stage regression of lnbor:

Statistics consistent for homoskedasticity only
Number of obs =                   1506
------------------------------------------------------------------------------
       lnbor |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lnarate |  -.2580607   .0739022    -3.49   0.000    -.4030298   -.1130915
       lncjl |   1.014545   .0260508    38.94   0.000     .9634427    1.065647
   lnfeestr2 |  -.5609088   .0181967   -30.82   0.000    -.5966041   -.5252135
   _Isafe2_2 |          0  (omitted)
   _Isafe2_3 |          0  (omitted)
   _Isafe2_4 |          0  (omitted)
   _Isafe2_5 |          0  (omitted)
   _Isafe2_6 |          0  (omitted)
      _Icu_2 |          0  (omitted)
      _Icu_3 |          0  (omitted)
      _Ill_2 |          0  (omitted)
      _Ill_3 |          0  (omitted)
      _Ill_4 |          0  (omitted)
      _Ill_5 |          0  (omitted)
      _Ill_6 |          0  (omitted)
      _Ipp_1 |   .0920488   .0899191     1.02   0.306    -.0843396    .2684371
    profit_1 |  -.0407056   .0552689    -0.74   0.462    -.1491231    .0677119
        lnwz |  -2.601228    .408739    -6.36   0.000    -3.403024   -1.799431
------------------------------------------------------------------------------
F test of excluded instruments:
  F(  4,  1421) =   553.35
  Prob > F      =   0.0000
Sanderson-Windmeijer multivariate F test of excluded instruments:
  F(  3,  1421) =  1360.97
  Prob > F      =   0.0000


FIXED EFFECTS ESTIMATION
------------------------
Number of groups =        79                    Obs per group: min =        11
                                                               avg =      19.1
                                                               max =        33

First-stage regression of lninv:

Statistics consistent for homoskedasticity only
Number of obs =                   1506
------------------------------------------------------------------------------
       lninv |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lnarate |   .0579601   .0641956     0.90   0.367    -.0679682    .1838885
       lncjl |   .6363782   .0226292    28.12   0.000     .5919879    .6807685
   lnfeestr2 |    .246972   .0158067    15.62   0.000      .215965    .2779789
   _Isafe2_2 |          0  (omitted)
   _Isafe2_3 |          0  (omitted)
   _Isafe2_4 |          0  (omitted)
   _Isafe2_5 |          0  (omitted)
   _Isafe2_6 |          0  (omitted)
      _Icu_2 |          0  (omitted)
      _Icu_3 |          0  (omitted)
      _Ill_2 |          0  (omitted)
      _Ill_3 |          0  (omitted)
      _Ill_4 |          0  (omitted)
      _Ill_5 |          0  (omitted)
      _Ill_6 |          0  (omitted)
      _Ipp_1 |  -.0233949   .0781088    -0.30   0.765    -.1766157     .129826
    profit_1 |   .0007914   .0480097     0.02   0.987    -.0933862    .0949689
        lnwz |  -2.207571   .3550537    -6.22   0.000    -2.904057   -1.511085
------------------------------------------------------------------------------
F test of excluded instruments:
  F(  4,  1421) =   293.19
  Prob > F      =   0.0000
Sanderson-Windmeijer multivariate F test of excluded instruments:
  F(  3,  1421) =   516.13
  Prob > F      =   0.0000



Summary results for first-stage regressions
-------------------------------------------

                                           (Underid)            (Weak id)
Variable     | F(  4,  1421)  P-val | SW Chi-sq(  3) P-val | SW F(  3,  1421)
lnbor        |     553.35    0.0000 |     4100.14   0.0000 |     1360.97
lninv        |     293.19    0.0000 |     1554.92   0.0000 |      516.13

Stock-Yogo weak ID F test critical values for single endogenous regressor:
                                    5% maximal IV relative bias    16.85
                                   10% maximal IV relative bias    10.27
                                   20% maximal IV relative bias     6.71
                                   30% maximal IV relative bias     5.34
                                   10% maximal IV size             24.58
                                   15% maximal IV size             13.96
                                   20% maximal IV size             10.26
                                   25% maximal IV size              8.31
Source: Stock-Yogo (2005).  Reproduced by permission.
NB: Critical values are for Sanderson-Windmeijer F statistic.
二维码

扫码加我 拉你入群

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

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

2017-1-11 18:34:15
zuohanchen 发表于 2017-1-11 18:25
那你看看下面的结果,为何虚拟变量全部出现共线呢?命令应该怎样写呢
xi:xtivreg2  profit profit_1  l ...
会出现 omitted 的情况,大概就是 multicollinearity 所造成的!以你的情况,在面板资料的固定效果下,我"猜测"那些被 omitted 的变量 (categorical variables) 应该是与个别公司的固定效果有共线性所导致的!你可以检查看看,针对每一公司,这些变量不同年的值是不是都一样(不变)!
二维码

扫码加我 拉你入群

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

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

2017-1-11 19:10:20
黃河泉 发表于 2017-1-11 18:34
会出现 omitted 的情况,大概就是 multicollinearity 所造成的!以你的情况,在面板资料的固定效果下,我 ...
我检查了,不存在其他变量有重复的情况,应该就是命令语句的问题
二维码

扫码加我 拉你入群

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

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

2017-1-11 19:16:08
zuohanchen 发表于 2017-1-11 19:10
我检查了,不存在其他变量有重复的情况,应该就是命令语句的问题
你愿意的话,资料发给我 river@mail.tku.edu.tw ,我可以帮忙看看!
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群