# Re: st: AW: Bootstrap and p-values

 From Giulio Rizzoli <[email protected]> To [email protected] Subject Re: st: AW: Bootstrap and p-values Date Sun, 20 Sep 2009 12:04:02 +0200

```Martin wrote:
```
```The bias is the difference btw the coefficient
estimate of your chosen estimator and the mean of the bootstrap estimates.
The standard error is the standard deviation of those bootstrap estimates,
as seen in this code:
```
```
Dear Martin thanks so much.
```
I understand it now : bias relates to the _b coefficient estimate, not as I wrongly thought to the standard error. Coming to the p-value of the bootstrapped estimates I was initially interested in.
```I must calculate it using the normaly distributed zeta = _b[var] / se[var]
or as zeta= ( _b[var]-bias[var] ) / se[var]

```
```code:
*************
sysuse auto, clear
//get bs estimates
bs, reps(200) saving(myfile, /*
*/ replace) seed(1020): /*
*/ reg pr we le he
//store coeffs in -local-s
foreach var of varlist  weight length headroom{
loc `var'coeff=_b[`var']
}
//get saved file of bs estimates
u myfile, clear
//calculate bias and bs standard error
foreach var in weight length headroom{
qui su _b_`var'
di in red "Coeff `var', Bias (Mean of Bootstraps-Original): "  /*
*/ r(mean)-``var'coeff' _n  /*
*/ "Bootstrap se: " r(sd) _n
}
//compare to official results
estat boot, all
*************
HTH
Martin
```
```

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