Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: Re: RE: Stata11 cannot estimate xthtaylor with bootstrap SE


From   Rodolphe Desbordes <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: RE: Re: RE: Stata11 cannot estimate xthtaylor with bootstrap SE
Date   Mon, 24 Aug 2009 19:10:05 +0100

Mike,

If you were running the code, you would get the following output:


.
. estimates table  XTHTAYLOR IVREGDEF IVREGROB IVREGCL  ,b(%9.4f) se

--------------------------------------------------------------
    Variable | XTHTAYLOR   IVREGDEF    IVREGROB     IVREGCL
-------------+------------------------------------------------
         wks |    0.0009      0.0009      0.0009      0.0009
             |    0.0006      0.0006      0.0008      0.0009
       south |    0.0071      0.0071      0.0071      0.0071
             |    0.0325      0.0325      0.0534      0.0809
        smsa |   -0.0418     -0.0418     -0.0418     -0.0418
             |    0.0194      0.0194      0.0241      0.0294
          ms |   -0.0363     -0.0363     -0.0363     -0.0363
             |    0.0189      0.0189      0.0177      0.0265
         exp |    0.1130      0.1130      0.1130      0.1130
             |    0.0025      0.0025      0.0028      0.0040
        exp2 |   -0.0004     -0.0004     -0.0004     -0.0004
             |    0.0001      0.0001      0.0001      0.0001
         occ |   -0.0214     -0.0214     -0.0214     -0.0214
             |    0.0138      0.0138      0.0136      0.0190
         ind |    0.0188      0.0188      0.0188      0.0188
             |    0.0154      0.0154      0.0166      0.0227
       union |    0.0304      0.0304      0.0304      0.0304
             |    0.0149      0.0149      0.0166      0.0250
         fem |   -0.1368     -0.1368     -0.1368     -0.1368
             |    0.1273      0.1273      0.1183      0.1164
         blk |   -0.2818     -0.2818     -0.2818     -0.2818
             |    0.1766      0.1766      0.1633      0.1870
          ed |    0.1405      0.1405      0.1405      0.1405
             |    0.0659      0.0659      0.0617      0.0714
        cons |                2.8844      2.8844      2.8844
             |                0.8528      0.7996      0.9394
       _cons |    2.8844
             |    0.8528
--------------------------------------------------------------
                                                  legend: b/se


Rodolphe



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rodolphe Desbordes
Sent: lundi 24 août 2009 18:55
To: '[email protected]'
Subject: st: RE: Re: RE: Stata11 cannot estimate xthtaylor with bootstrap SE

Mike,

It may be simpler to program yourself the Hausman-Taylor estimator (see below for a rough code). You can obtain cluster-robust standard errors and you can take advantage of the various diagnostics and tests for weak instruments provided by -ivregress- or -ivreg2-.

Rodolphe


********************


webuse psidextract,clear

*** Time-demeaned and Time-averaged variables ***
foreach var of varlist lwage wks south smsa ms exp exp2 occ ind union fem blk  ed {
drop if `var'==.
}

global TVVARS " wks south smsa ms exp exp2 occ ind union "
global TIVARS "fem blk ed"
global EXOG "wks south smsa ms"

foreach var of varlist lwage $TVVARS $TIVARS{
egen P`var'=mean(`var'), by(id)
gen Q`var'=`var'-P`var'
}

*** First step ****

 xtreg lwage $TVVARS , fe

predict e,e


egen  sigmae=sum(e^2)
replace sigmae=sigmae/(e(N)-e(N_g))

 *gen double sigmae=e(rss)/(e(N)-e(N_g))

gen n=e(N_g)
predict d,u

*** Second step ****

ivreg2 d fem blk (ed= $EXOG )

gen double sigmas=e(rss)/n

gen obs=1

by id: gen double Ti = sum(obs)
 by id: replace Ti = . if _n!=_N
 summ Ti, meanonly
by id : gen double T_inv=1/Ti
summ T_inv, meanonly
 gen double Tbar = 1/r(mean)

by id: replace Ti = Ti[_N]

gen double sigmau= (sigmas-sigmae)/Tbar

*** Third step ****

gen  double theta = 1 -  sqrt(sigmae/(Ti*sigmau+sigmae))


foreach var of varlist lwage $TVVARS $TIVARS {
gen double theta`var'=`var'-(theta)*P`var'
gen temp`var'=`var'
replace `var'=theta`var'
}

gen double cons=1-theta


*** Fourth step ****

*DEFAULT SE*

ivregress 2sls  lwage wks south smsa ms fem blk ( exp exp2 occ ind union  ed  =  Pwks  Psouth  Psmsa  Pms  Qexp Qexp2 Qocc Qind Qunion   ) cons, small  nocons

estimates store IVREGDEF

*ROBUST SE*

ivregress 2sls  lwage wks south smsa ms fem blk ( exp exp2 occ ind union  ed  =  Pwks  Psouth  Psmsa  Pms  Qexp Qexp2 Qocc Qind Qunion   ) cons, small  nocons r

estimates store IVREGROB

*CLUSTER-ROBUST SE*

ivregress 2sls  lwage wks south smsa ms fem blk ( exp exp2 occ ind union  ed  =  Pwks  Psouth  Psmsa  Pms  Qexp Qexp2 Qocc Qind Qunion   ) cons, small  nocons r cl(id)

estimates store IVREGCL

foreach var of varlist lwage $TVVARS $TIVARS {
replace `var'=temp`var'
}


*XTHATYLOR*


xthtaylor lwage wks south smsa ms exp exp2 occ ind union fem blk  ed, endog(exp exp2 occ ind union ed) constant(fem blk ed)

estimates store XTHTAYLOR


estimates table  XTHTAYLOR IVREGDEF IVREGROB IVREGCL  ,b(%9.4f) se


*******************


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Mike Kim
Sent: lundi 24 août 2009 18:19
To: [email protected]
Subject: st: Re: RE: Stata11 cannot estimate xthtaylor with bootstrap SE

My data is panel data. So, I want to account for possible serial correlation
and heteroskedascity.

Mike.

----- Original Message -----
From: "Rodolphe Desbordes" <[email protected]>
To: <[email protected]>
Sent: Monday, August 24, 2009 12:04 PM
Subject: st: RE: Stata11 cannot estimate xthtaylor with bootstrap SE


Mike,

Are you using the bootstrap to obtain "robust" estimates of the standard
errors?

Rodolphe

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mike Kim
Sent: lundi 24 août 2009 16:58
To: [email protected]
Subject: st: Stata11 cannot estimate xthtaylor with bootstrap SE

Dear all,

I am estimating 'xthtaylor" with bootstrap standard error.

xthtaylor depvar indepvars, endog(vars) vce(boot)

Stata10 gives estimation results with the following notation.

Bootstrap replications (50)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.....xx....x..xx.x......x.x........xx.x...x....x..    50

However, Stata11 cannot estimate the model. It says:
o. operator not allowed
an error occurred when bootstrap executed xthtaylor
r(101);


http://www.stata.com/support/faqs/lang/post.html says:
"As of Stata 11, variables are no longer dropped because of collinearity.
Instead, these variables are omitted and are labeled with the "o." operator
in the column names of the resulting parameter vector."

My questions are:

1. What does "xx...x..xx" mean in Stata10?
2. Why can't Stata11 estimate the model with the same code?
3. What is the difference between "dropping" and "omitting" a variable due
to collinearity?

Thank you for your help in advance.

Mike.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index