# 4.4.3 Bootstrap estimate of bias

Let $\hat{\boldsymbol {\theta }}$ be the estimator based on the original sample $D_N$ and

$$\hat{\theta }_{(\cdot )}=\frac{\sum _{b=1}^ B \hat{\theta}_{(b)}}{B}$$

Since $\text {Bias}[\hat{\boldsymbol {\theta}}]=E[\hat{\boldsymbol {\theta }}]-\theta$, the bootstrap estimate of the bias of the estimator $\hat{\boldsymbol {\theta }}$ is obtained by replacing $E[\hat{\boldsymbol {\theta }}]$ with $\hat{\theta }_{(\cdot )}$ and $\theta$ with $\hat{\theta }$:

$$\text {Bias}_{\text {bs}}[\hat{\boldsymbol {\theta }}]=\hat{\theta }_{(\cdot )}-\hat{\theta }$$

Then, since

$$\theta =E[\hat{\boldsymbol {\theta }}]-\text{Bias}[\hat{\boldsymbol {\theta }}]$$

the bootstrap bias corrected estimate is

$$\hat{\theta }_{\text {bs}}=\hat{\theta }-\text{Bias}_{\text {bs}}[\hat{\boldsymbol {\theta }}]= \hat{\theta}-(\hat{\theta }_{(\cdot )}-\hat{\theta })=2\hat{\theta }- \hat{\theta }_{(\cdot )}$$

### R script

The following script shows the estimation of bias and variance in the case of the patch data example.

R code
## script patch.R

placebo<-c(9243,9671,11792,13357,9055,6290,12412,18806)
oldpatch<-c(17649,12013,19979,21816,13850,9806,17208,29044)
newpatch<-c(16449,14614,17274,23798,12560,10157,16570,26325)

data<-data.frame(placebo,oldpatch,newpatch)

N<-nrow(data)

B<-400  ## number of bootstrap repetitions

theta.hat<-abs(mean(data[,"newpatch"])-mean(data[,"oldpatch"]))/
(mean(data[,"oldpatch"])-mean(data[,"placebo"]))

thetaB<-numeric(B)
for (b in 1:B){
Ib<-sample(N,N,replace=TRUE)  ## sampling with replacement
Db<-data[Ib,]
thetaB[b]<-(mean(Db[,"newpatch"])-mean(Db[,"oldpatch"]))/
(mean(Db[,"oldpatch"])-mean(Db[,"placebo"]))
}

hist(thetaB,
main=paste("Bias=", round(abs(theta.hat-mean(thetaB)),2),
"; Stdev=", round(sd(thetaB),2)))
abline(v=theta.hat,col="red")

print(paste("Probability that theta.hat >0.2=",sum(thetaB>0.2)/B))

$\bullet$