# Re: st: Bootstrap question

 From May Boggess To statalist@hsphsun2.harvard.edu Subject Re: st: Bootstrap question Date 15 Feb 2005 08:40:00 -0600

```On Tuesday, Raoul asked about bootstrap:

> I run a probit regression model such as
> probit job age educat
> I use predictnl to predict special cases, e.g. for age==32 and educat=3.
> Predictnl xb= _b[age]*32+_b[educat]*3
> Now, I want to get bootstrapped CI's for the point estimate of xb.
> I read the manual but I do not understand how to handle the scalar xb?
>

First of all, it would a good idea for Raoul to check the formula he
used above for xb. Here is an example:

clear
set obs 100
set seed 12345
gen job=uniform()>0.5
gen age=uniform()*50+5
gen educat=uniform()*12+1
probit job age educat
replace age=32
replace educat=3
predict xb,xb
gen myxb=_b[age]*32+_b[educat]*3+_b[_cons]
sum xb myxb

So we see that Raoul forgot the constant term in xb. Before moving on to
-bootstrap-, we can use -predictnl- to obtain the standard error via the
delta method. To do so we can rely on Stata to predict xb for us, so
there is no chance of an arithmetic mistake:

clear
set obs 100
set seed 12345
gen job=uniform()>0.5
gen age=uniform()*50+5
gen educat=uniform()*12+1
probit job age educat
replace age=32
replace educat=3
predictnl xb=predict(xb), se(se)
list xb se in 1

To get the boostrapped standard error we need to write a program that
returns xb in the r() results:

capture program drop myboot
program myboot, rclass
probit job age educat
return scalar xb=_b[age]*32+_b[educat]*3+_b[_cons]
end

clear
set obs 100
set seed 12345
gen job=uniform()>0.5
gen age=uniform()*50+5
gen educat=uniform()*12+1
bootstrap "myboot" xb=r(xb), reps(100)

-- May
mboggess@stata.com

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