# \donttest{
set.seed(123)
y<- rnorm(100)+0.1
nB<- 1e5
Tstat<- rep(NA,nB)
for (i in 1:nB){
Tstat[i]<-mean( sample(y,replace=TRUE) )
}
# two-sided bootstrap percentile p-value
# that mean is different from 0
percpval(Tstat,theta0=0)
# 95% percentile interval
percci(Tstat)
# compare to t-test
t.test(y)
# to show that the functions are close to compatiable
# set confidence level to 1-pvalue
pval<-percpval(Tstat,theta0=0)
confLevel<- 1-pval
pval
# then lower limit should be close to 0
percci(Tstat, conf.level=confLevel)
# }
Run the code above in your browser using DataLab