楼主: 5039899
10865 5

[学科前沿] XTIVREG2: Stata module to perform extended IV2SLS, GMM and ACHAC, LIML and k-cla [推广有奖]

  • 1关注
  • 3粉丝

已卖:709份资源

博士生

34%

还不是VIP/贵宾

-

威望
0
论坛币
823206 个
通用积分
3.3610
学术水平
2 点
热心指数
3 点
信用等级
2 点
经验
7231 点
帖子
320
精华
0
在线时间
144 小时
注册时间
2005-5-12
最后登录
2024-11-5

楼主
5039899 发表于 2006-5-9 16:37:00 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
XTIVREG2unrecognized command:  XTIVREG2 not defined by XTIVREG2.ado
r(199);
. ssc install XTIVREG2
checking xtivreg2 consistency and verifying not already installed...
installing into c:\ado\plus\...
installation complete.
. help xtivreg2
. use http://fmwww.bc.edu/ec-p/data/macro/abdata.dta
(Layard & Nickell, Unemployment in Britain, Economica 53, 1986 from Ox dist)
. tsset id year
       panel variable:  id, 1 to 140
        time variable:  year, 1976 to 1984

. xtivreg2 ys k (n=l2.n l3.n), fe small
Error - must have ivreg2 version 2.1.15 or greater installed
r(601);
. ssc install IVREG2
checking ivreg2 consistency and verifying not already installed...
installing into c:\ado\plus\...
installation complete.
. xtivreg2 ys k (n=l2.n l3.n), fe small
FIXED EFFECTS ESTIMATION
------------------------
Number of groups =       140                    Obs per group: min =         4
                                                               avg =       4.4
                                                               max =         6
Instrumental variables (2SLS) regression
----------------------------------------
                                                      Number of obs =      611
                                                      F(  2,   469) =   117.48
                                                      Prob > F      =   0.0000
Total (centered) SS     =  2.817151731                Centered R2   =   0.3569
Total (uncentered) SS   =  2.817151731                Uncentered R2 =   0.3569
Residual SS             =  1.811578915                Root MSE      =   .06215
------------------------------------------------------------------------------
          ys |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |    .105914   .0865132     1.22   0.221    -.0640873    .2759154
           k |   .1352526   .0638731     2.12   0.035     .0097397    .2607655
------------------------------------------------------------------------------
Anderson canon. corr. LR statistic (identification/IV relevance test):  31.692
                                                   Chi-sq(2) P-val =    0.0000
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           6.089
                                                   Chi-sq(1) P-val =    0.0136
------------------------------------------------------------------------------
Instrumented:         n
Included instruments: k
Excluded instruments: L2.n L3.n
------------------------------------------------------------------------------
. xtivreg ys k (n=l2.n l3.n), fe small
Fixed-effects (within) IV regression         Number of obs      =          611
Group variable: id                           Number of groups   =          140
R-sq:  within  = 0.3569                      Obs per group: min =            4
       between = 0.0020                                     avg =          4.4
       overall = 0.0082                                     max =            6
                                                F(142,469)      =      117.48
corr(u_i, Xb)  = -0.9897                        Prob > F        =       0.0000
------------------------------------------------------------------------------
          ys |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |    .105914   .0865132     1.22   0.221    -.0640873    .2759154
           k |   .1352526   .0638731     2.12   0.035     .0097397    .2607655
       _cons |   4.558421   .1159595    39.31   0.000     4.330556    4.786285
-------------+----------------------------------------------------------------
     sigma_u |  .34516869
     sigma_e |  .06215015
         rho |  .96859745   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F  test that all u_i=0:     F(139,469) =     2.48         Prob > F    = 0.0000
------------------------------------------------------------------------------
Instrumented:   n
Instruments:    k L2.n L3.n
. xtivreg2 ys k (n=l.n l2.n), fd small first
FIRST DIFFERENCES ESTIMATION
----------------------------
Number of groups =       140                    Obs per group: min =         4
                                                               avg =       4.4
                                                               max =         6
First-stage regressions
-----------------------
First-stage regression of D.n:
Ordinary Least Squares (OLS) regression
---------------------------------------
                                                      Number of obs =      611
                                                      F(  3,   607) =    73.78
                                                      Prob > F      =   0.0000
Total (centered) SS     =  12.59997848                Centered R2   =   0.2672
Total (uncentered) SS   =  15.45414725                Uncentered R2 =   0.4026
Residual SS             =  9.233071905                Root MSE      =    .1233
------------------------------------------------------------------------------
         D.n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           k |
         D1. |    .450355   .0331934    13.57   0.000     .3851672    .5155429
           n |
        L2D. |  -.0269218   .0402855    -0.67   0.504    -.1060376     .052194
         LD. |   .1077116   .0380126     2.83   0.005     .0330595    .1823637
       _cons |  -.0304262   .0056794    -5.36   0.000    -.0415798   -.0192725
------------------------------------------------------------------------------
Partial R-squared of excluded instruments:   0.0131
Test of excluded instruments:
  F(  2,   607) =     4.02
  Prob > F      =   0.0185
Summary results for first-stage regressions
-------------------------------------------
                Shea
Variable    | Partial R2    |    Partial R2    F(  2,   607)    P-value
D.n         |   0.0131      |      0.0131           4.02         0.0185
Underidentification tests:
                                                 Chi-sq(2)      P-value
Anderson canon. corr. likelihood ratio stat.        8.03         0.0180
Cragg-Donald N*minEval stat.                        8.09         0.0175
Ho: matrix of reduced form coefficients has rank=K-1 (underidentified)
Ha: matrix has rank>=K (identified)
Weak identification statistics:
Cragg-Donald (N-L)*minEval/L2 F-stat       4.02

Anderson-Rubin test of joint significance of
endogenous regressors B1 in main equation, Ho:B1=0
  F(2,607)=      7.58      P-val=0.0006
  Chi-sq(2)=     15.26     P-val=0.0005
Number of observations N           =        611
Number of regressors   K           =          3
Number of instruments  L           =          4
Number of excluded instruments L2  =          2

Instrumental variables (2SLS) regression
----------------------------------------
                                                      Number of obs =      611
                                                      F(  2,   608) =     3.32
                                                      Prob > F      =   0.0369
Total (centered) SS     =  1.866255328                Centered R2   =  -1.0071
Total (uncentered) SS   =  2.621579375                Uncentered R2 =  -0.4288
Residual SS             =  3.745785431                Root MSE      =   .07849
------------------------------------------------------------------------------
        D.ys |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |
         D1. |   -.388672   .2245474    -1.73   0.084    -.8296547    .0523107
           k |
         D1. |   .2215772   .1074186     2.06   0.040     .0106207    .4325337
       _cons |  -.0455629   .0084215    -5.41   0.000    -.0621016   -.0290243
------------------------------------------------------------------------------
Anderson canon. corr. LR statistic (identification/IV relevance test):   8.033
                                                   Chi-sq(2) P-val =    0.0180
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           4.319
                                                   Chi-sq(1) P-val =    0.0377
------------------------------------------------------------------------------
Instrumented:         D.n
Included instruments: D.k
Excluded instruments: L2D.n LD.n
------------------------------------------------------------------------------
.
. ivreg2 d.ys d.k (d.n=ld.n ld2.n), small first
First-stage regressions
-----------------------
First-stage regression of D.n:
Ordinary Least Squares (OLS) regression
---------------------------------------
                                                      Number of obs =      611
                                                      F(  3,   607) =    73.78
                                                      Prob > F      =   0.0000
Total (centered) SS     =  12.59997848                Centered R2   =   0.2672
Total (uncentered) SS   =  15.45414725                Uncentered R2 =   0.4026
Residual SS             =  9.233071905                Root MSE      =    .1233
------------------------------------------------------------------------------
         D.n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           k |
         D1. |    .450355   .0331934    13.57   0.000     .3851672    .5155429
           n |
         LD. |   .0807898    .049081     1.65   0.100    -.0155993     .177179
        LD2. |   .0269218   .0402855     0.67   0.504     -.052194    .1060376
       _cons |  -.0304262   .0056794    -5.36   0.000    -.0415798   -.0192725
------------------------------------------------------------------------------
Partial R-squared of excluded instruments:   0.0131
Test of excluded instruments:
  F(  2,   607) =     4.02
  Prob > F      =   0.0185
Summary results for first-stage regressions
-------------------------------------------
                Shea
Variable    | Partial R2    |    Partial R2    F(  2,   607)    P-value
D.n         |   0.0131      |      0.0131           4.02         0.0185
Underidentification tests:
                                                 Chi-sq(2)      P-value
Anderson canon. corr. likelihood ratio stat.        8.03         0.0180
Cragg-Donald N*minEval stat.                        8.09         0.0175
Ho: matrix of reduced form coefficients has rank=K-1 (underidentified)
Ha: matrix has rank>=K (identified)
Weak identification statistics:
Cragg-Donald (N-L)*minEval/L2 F-stat       4.02

Anderson-Rubin test of joint significance of
endogenous regressors B1 in main equation, Ho:B1=0
  F(2,607)=      7.58      P-val=0.0006
  Chi-sq(2)=     15.26     P-val=0.0005
Number of observations N           =        611
Number of regressors   K           =          3
Number of instruments  L           =          4
Number of excluded instruments L2  =          2

Instrumental variables (2SLS) regression
----------------------------------------
                                                      Number of obs =      611
                                                      F(  2,   608) =     3.32
                                                      Prob > F      =   0.0369
Total (centered) SS     =  1.866255328                Centered R2   =  -1.0071
Total (uncentered) SS   =  2.621579375                Uncentered R2 =  -0.4288
Residual SS             =    3.7457855                Root MSE      =   .07849
------------------------------------------------------------------------------
        D.ys |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |
         D1. |   -.388672   .2245474    -1.73   0.084    -.8296547    .0523107
           k |
         D1. |   .2215772   .1074186     2.06   0.040     .0106207    .4325337
       _cons |  -.0455629   .0084215    -5.41   0.000    -.0621016   -.0290243
------------------------------------------------------------------------------
Anderson canon. corr. LR statistic (identification/IV relevance test):   8.033
                                                   Chi-sq(2) P-val =    0.0180
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           4.319
                                                   Chi-sq(1) P-val =    0.0377
------------------------------------------------------------------------------
Instrumented:         D.n
Included instruments: D.k
Excluded instruments: LD.n LD2.n
------------------------------------------------------------------------------

.
. xtivreg ys k (n=l.n l2.n), fd small
First-differenced IV regression                 Number of obs      =       611
Group variable: id                              Number of groups   =       140
R-sq:  within  = 0.1020                         Obs per group: min =         4
       between = 0.4446                                        avg =       4.4
       overall = 0.0001                                        max =         6
                                                F(2,608)           =      3.32
corr(u_i, Xb)  = -0.9771                        Prob > F           =    0.0369
------------------------------------------------------------------------------
        d.ys |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |
         D1. |   -.388672   .2245474    -1.73   0.084    -.8296547    .0523107
           k |
         D1. |   .2215772   .1074186     2.06   0.040     .0106207    .4325337
       _cons |  -.0455629   .0084215    -5.41   0.000    -.0621016   -.0290243
-------------+----------------------------------------------------------------
     sigma_u |  .24620855
     sigma_e |  .07849096
         rho |  .90774365   (fraction of variance due to u_i)
------------------------------------------------------------------------------
Instrumented:   n
Instruments:    k L.n L2.n
.
二维码

扫码加我 拉你入群

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

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

关键词:extended XTIVREG Perform module Extend command already

沙发
hbzhang 发表于 2006-5-29 08:02:00
谢谢!
80 字节以内
不支持自定义 Discuz! 代码

藤椅
offerlover 发表于 2008-6-8 07:32:00
ding

板凳
zhanguodian 发表于 2008-6-23 19:30:00

谢谢楼主,强人啊。我用的是stata10,运行上面的程序还是会有错误



. xtivreg2
unrecognized command:  xtivreg2
r(199);

. ssc install xtivreg2
connection timed out -- see help r(2) for troubleshooting
http://fmwww.bc.edu/repec/bocode/x/ either
  1)  is not a valid URL, or
  2)  could not be contacted, or
  3)  is not a Stata download site (has no stata.toc file).
r(2);

. help xtivreg2

.
.
.
. ssc install xtivreg2
checking xtivreg2 consistency and verifying not already installed...
installing into c:\ado\plus\...
installation complete.

.
.
.
. help xtivreg2

. use http://fmwww.bc.edu/ec-p/data/macro/abdata.dta
(Layard & Nickell, Unemployment in Britain, Economica 53, 1986 from Ox dist)

. edit
- preserve

. tsset id year
       panel variable:  id (unbalanced)
        time variable:  year, 1976 to 1984
                delta:  1 unit

. xtivreg2 ys k (n=12.n 13.n),fe small
12:  operator invalid
r(198);

. ssc install inreg2
ssc install: "inreg2" not found at SSC, type -findit inreg2-
(To find all packages at SSC that start with i, type -ssc describe i-)
r(601);

. ssc install ivreg2
checking ivreg2 consistency and verifying not already installed...
installing into c:\ado\plus\...
installation complete.

. xtivreg2 ys k (n=12.n 13.n), fe small
12:  operator invalid
r(198);

请问r(198)是什么错误啊,请问楼主用的是什么书啊,讲得这么全。谢谢

报纸
m8843620 发表于 2011-5-16 10:50:51
這是什麼東西啊

地板
richxu2010 发表于 2013-7-30 11:25:00
楼主把L2打成12了吧

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

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