Statalist


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

st: Problem with a small program for bootstrapping st errors of average partial effects


From   Paul Noroski <pjnoroski@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Problem with a small program for bootstrapping st errors of average partial effects
Date   Wed, 22 Jul 2009 02:14:33 -0400

Hello Statalisters,

I am calculating average partial effects (APEs) 'by hand' after a
reoprob (random effects ordered probit) estimation.  The problem I
have is with bootstrapping the standard errors of the average partial
effects.  (I'M USING STATA 9.2 by the way).  Below is the program that
runs the reoprob.  The dependent variable (sah) takes on 5 values, and
the APEs are the effect on the probability of highest sah: p(5).  It's
meant to return the APE.


******************************************
capture program drop reoboot
program reoboot, rclass
tsset newid time
reoprob sah inc bach, i(newid)
predict double yf, xb
gen double pe1 = 0
replace pe1 = 1-norm([_cut4]_b[_cons]-yf-_b[bach]) -
(1-norm([_cut4]_b[_cons]-yf)) if bach == 0
replace pe1 = 1-norm([_cut4]_b[_cons]-yf) -
(1-norm([_cut4]_b[_cons]-yf+_b[bach])) if bach == 1
summarize pe1, meanonly
return scalar ape1=r(mean)
drop yf pe1
end
********************************************

Then, I try to bootstrap the errors with the following command:

bootstrap r(ape1), noisily reps(20) seed(123) idcluster(newid)
cluster(id): reoboot


And here is the output

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

 tsset id time
       panel variable:  id (unbalanced)
        time variable:  time, 1 to 4, but with gaps

. run "C:\DOCUME~1\MASTER~1\LOCALS~1\Temp\STD01000000.tmp"

. bootstrap r(ape1), noisily reps(20) seed(123) idcluster(newid)
cluster(id): reoboot
bootstrap: First call to reoboot with data as is:

. reoboot
       panel variable:  newid (unbalanced)
        time variable:  time, 1 to 4, but with gaps

Fitting constant-only model:

Iteration 0:   log likelihood = -881.38547
Iteration 1:   log likelihood = -817.95194
Iteration 2:   log likelihood = -817.16693
Iteration 3:   log likelihood = -817.16481
Iteration 4:   log likelihood = -817.16481

Fitting full model:

Iteration 0:   log likelihood = -873.78919
Iteration 1:   log likelihood = -816.91118
Iteration 2:   log likelihood = -814.17467
Iteration 3:   log likelihood = -814.12129
Iteration 4:   log likelihood = -814.12116
Iteration 5:   log likelihood = -814.12116

Random Effects Ordered Probit                     Number of obs   =        681
                                                  LR chi2(2)      =       6.09
Log likelihood = -814.12116                       Prob > chi2     =     0.0477

------------------------------------------------------------------------------
         sah |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
eq1          |
         inc |   .0000484   .0000205     2.35   0.019     8.08e-06    .0000886
        bach |   .3883541   .3454631     1.12   0.261    -.2887412    1.065449
-------------+----------------------------------------------------------------
_cut1        |
       _cons |   -2.89182   .2200774   -13.14   0.000    -3.323164   -2.460477
-------------+----------------------------------------------------------------
_cut2        |
       _cons |  -1.870913   .1778789   -10.52   0.000    -2.219549   -1.522277
-------------+----------------------------------------------------------------
_cut3        |
       _cons |  -.4119187   .1464737    -2.81   0.005    -.6990019   -.1248354
-------------+----------------------------------------------------------------
_cut4        |
       _cons |   .8092503    .143649     5.63   0.000     .5277033    1.090797
-------------+----------------------------------------------------------------
rho          |
       _cons |   .6568721   .0386152    17.01   0.000     .5811876    .7325565
------------------------------------------------------------------------------
(611 real changes made)
(70 real changes made)

Bootstrap replications (20)
repeated time values within panel
the most likely cause for this error is misspecifying the cluster(),
idcluster(), or
group() option
r(451);

.
**********************************************************************************

Any help would be greatly appreciated.

yours,
Paul
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index