BCamedci<-function(x,conflevel=0.95,nboots=120){ #This function will calculate the "BCa" # # confidence interval for the population median. # #nboots = B = number of bootstrap samples to take # #tstar will contain the median calculated for each # # bootstrap sample BH 02/29/04 version # ## #This method begins like the others we have seen# ## alpha<-1-conflevel tstar<-rep(0,nboots) for (b in 1:nboots){ tstar[b]<-median(sample(x,replace=T)) } tstar<-sort(tstar) ## #We must then calculate z0hat and ahat. #The thhat hat thhatdot are as in the formulas on page # # 186 of Eforn and Tishirani. The median on the z0hat # # line and thhat line are there because we are using # # making the CI about the median. The mean on the thhatdot # # line is part of the definition of thhatdot for any statstic. # ## z0hat<-qnorm(sum(tstar3)) success[i,2]<-((ci[i,1,2]<3)&(ci[i,2,2]>3)) success[i,3]<-((ci[i,1,3]<3)&(ci[i,2,3]>3)) } apply(success,2,mean)