# st: xtabond and e(sample)

 From Joly.Patrick@ic.gc.ca To statalist@hsphsun2.harvard.edu Subject st: xtabond and e(sample) Date Tue, 24 Sep 2002 11:44:59 -0400

```I am getting some strange behaviour on the part of -xtabond- when trying to
restrict the estimation sample of subsequent regressions.  My objective is
to drop a lag of one of the pre-determined variable while restricting the
sample of the second estimation to that of the previous one using the
e(sample) function.  E.g.

xtabond def5tot ggdpind mktsh4d_ii herf2i_ii, lags(1) pre(l1rdtota,
lag(4,.)) twostep, if sic2d=="36"
xtabond def5tot ggdpind mktsh4d_ii herf2i_ii, lags(1) pre(l1rdtota,
lag(3,.)) twostep, if sic2d=="36" & e(sample)

(I could have omitted the -sic2d=="36"- in the second regression but I kept
it, to be safe.)

As the output below indicates, the first set of estimates used 143
observations on 32 firms whereas the second one drew from 180 observations
on 38 firms.  To see how many observations are really included in the
e(sample) function, I called -count if e(sample)- after the first regression
and Stata returned a count of 180 observations, i.e.

. qui xtabond def5tot ggdpind mktsh4d_ii herf2i_ii, lags(1) pre(l1rdtota,
lag(4,.)) twostep, if sic2d=="36"

. count if e(sample)
180

Looking at xtabond.ado (*! version 3.5.1   29May2002), my guess would be
that -markout- isn't quite successful at setting `touse'=0 for certain
observation in the block

markout `touse'   L(1/`lags')D.`depvar' /*
*/ `indeps_o'  `prevars_o' `inst_o'

if "`small'" != "" {
local dofm " dof( `df' ) "
}
est post `b' `V', depname(`depvar') obs(`NT') `dofm' /*
*/ esample(`touse')

but exactly which observations are at fault escapes me at this time.

Output
======
. xtabond def5tot ggdpind mktsh4d_ii herf2i_ii, lags(1) pre(l1rdtota,
lag(4,.)) twostep, if sic2d=="36"

Arellano-Bond dynamic panel data                Number of obs      =
143
Group variable (i): firm                        Number of groups   =
32

Wald chi2(9)       =
4687.71

Time variable (t): year                         min number of obs  =
1
max number of obs  =
9
mean number of obs =
4.46875

Two-step results
----------------------------------------------------------------------------
--
def5tota     |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
def5tota     |
LD |  -.2843774   .0290648    -9.78   0.000    -.3413433
-.2274114
l1rdtota     |
D1 |   2.391021   .1233131    19.39   0.000     2.149332
2.63271
LD |   .6619784    .162422     4.08   0.000     .3436373
.9803196
L2D |   .0620613   .3464511     0.18   0.858    -.6169703
.7410929
L3D |   1.330603   .2330873     5.71   0.000     .8737608
1.787446
L4D |   .3113902   .1615955     1.93   0.054     -.005331
.6281115
ggdpind      |
D1 |   .0021814   .0004022     5.42   0.000     .0013932
.0029696
mktsh4d_ii   |
D1 |  -.0051892    .002003    -2.59   0.010     -.009115
-.0012633
herf2i_ii    |
D1 |  -.0310469   .0235543    -1.32   0.187    -.0772125
.0151186
_cons        |  -.0115135   .0034722    -3.32   0.001    -.0183189
-.0047081
----------------------------------------------------------------------------
--
Warning: Arellano and Bond recommend using one-step results for
inference on coefficients

Sargan test of over-identifying restrictions:
chi2(156) =    22.21     Prob > chi2 = 1.0000

Arellano-Bond test that average autocovariance in residuals of order 1 is 0:
H0: no autocorrelation   z =  -0.02   Pr > z = 0.9819
Arellano-Bond test that average autocovariance in residuals of order 2 is 0:
H0: no autocorrelation   z =  -1.19   Pr > z = 0.2332

. xtabond def5tot ggdpind mktsh4d_ii herf2i_ii, lags(1) pre(l1rdtota,
lag(3,.)) twostep, if sic2d=="36" & e(sam
> ple)

Arellano-Bond dynamic panel data                Number of obs      =
180
Group variable (i): firm                        Number of groups   =
38

Wald chi2(8)       =
78279.22

Time variable (t): year                         min number of obs  =
1
max number of obs  =
10
mean number of obs =
4.736842

Two-step results
----------------------------------------------------------------------------
--
def5tota     |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
def5tota     |
LD |  -.4287407   .0056001   -76.56   0.000    -.4397166
-.4177647
l1rdtota     |
D1 |   .6607953   .0150069    44.03   0.000     .6313823
.6902083
LD |  -.6613175   .0823001    -8.04   0.000    -.8226226
-.5000123
L2D |  -.7272684    .089698    -8.11   0.000    -.9030732
-.5514636
L3D |    1.20427   .0424572    28.36   0.000     1.121055
1.287484
ggdpind      |
D1 |  -.0015926   .0002275    -7.00   0.000    -.0020385
-.0011467
mktsh4d_ii   |
D1 |  -.0099554   .0017563    -5.67   0.000    -.0133977
-.0065131
herf2i_ii    |
D1 |  -.1146986    .009055   -12.67   0.000    -.1324461
-.096951
_cons        |   .0013375   .0016637     0.80   0.421    -.0019233
.0045984
----------------------------------------------------------------------------
--
Warning: Arellano and Bond recommend using one-step results for
inference on coefficients

Sargan test of over-identifying restrictions:
chi2(165) =    31.63     Prob > chi2 = 1.0000

Arellano-Bond test that average autocovariance in residuals of order 1 is 0:
H0: no autocorrelation   z =  -0.90   Pr > z = 0.3691
Arellano-Bond test that average autocovariance in residuals of order 2 is 0:
H0: no autocorrelation   z =  -1.41   Pr > z = 0.1579

Patrick Joly
joly.patrick@ic.gc.ca
pat.joly@utoronto.ca

*
*   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/
```