Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: bootstrap mfx

From   "Austin Nichols" <>
Subject   st: bootstrap mfx
Date   Tue, 12 Dec 2006 17:10:21 -0500

Tying together two disparate threads:
On 12/9/06, Jacob Wegelin <> wrote:
Suppose, that, in some regression model, you want pointwise bootstrap
bca (bias-corrected, accelerated) confidence intervals for the predicted values.
On 12/11/06, Alejandro Delafuente
<> wrote:
Hi everyone, can someone tell me how to get the standard errors for the
marginal effects obtained after an ivprobit estimation.
On 12/11/06, Richard Williams <> wrote:
I don't quite understand the notion of bootstrapped predicted values
(for each obs in the data?) in Jacob's post, and I don't think that
using the force option with -mfx- after -ivprobit- is a good idea in
Alejandro's... but I think both Jacob and Alejandro could benefit from
figuring out how to do a manual bootstrap using the -simulate-
command.  One way to do that is as follows (this example with 10 reps
takes about 5 min to run, so a real application with 1000 reps might
take 8 hours):

cap pr drop _all
pr eachone, rclass
drop _all
use /out
bsample, cluster(idcode)
ivprobit work age ttl (msp=south nw)
mfx, predict(p)
mat mfx=e(Xmfx_dydx)
mat es=mfx[1,1..3]
return scalar msp=es[1,1]
return scalar age=es[1,2]
return scalar ttl=es[1,3]
webuse nlswork, clear
gen work=wks_w>0 if !mi(wks_w)
g nw=race>1
keep work age ttl msp south nw id
ren ttl ttl
save /out, replace
qui ivprobit work age ttl (msp=south nw)
mfx, predict(p) diagnostics(vce)
local n=e(N)
mat mfx_est=e(Xmfx_dydx)
mat est=mfx_est[1,1..3]
simulate msp=r(msp) age=r(age) ttl=r(ttl), reps(10) seed(12345): eachone
bstat, stat(est) n(`n')

Note -help bs- says "Type estat bootstrap, bca to display the BCa
confidence interval generated by the bootstrap command." whereas -help
bstat- shows an option accel(vector) specifying "the acceleration of
each statistic, which is used to construct BCa CIs."

Perhaps someone else will weigh in on whether the procedure I have
outlined above is appropriate... Stas K?  May Boggess or another
StataCorp expert?
*   For searches and help try:

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