[R] Bootstrap library(boot) "boot.ci" function

varin sacha varinsacha at yahoo.fr
Sat Jan 17 21:27:26 CET 2015


Hi dear R-experts,
I want to compare the bootstrap percentile interval, the Z interval, the T interval, etc.So I use a function (I have modified a few things) I have found on stats.stackexchange.
simfun <- function(n=20) {x <- rnorm(n)m.x <- mean(x)s.x <- sd(x)z <- m.x/(1/sqrt(n))t <- m.x/(s.x/sqrt(n))b <- replicate(1000, mean(sample(x, replace=TRUE)))c( t=abs(t) > qt(0.975,n-1), z=abs(z) > qnorm(0.975),z2 = abs(t) > qnorm(0.975), b= (0 < quantile(b, 0.025)) | (0 > quantile(b, 0.975))) } out <- replicate(1000, simfun())rowMeans(out)
     t          z        z2     b.2.5%  0.045  0.052  0.061  0.070 
I still have the bootstrap percentile interval. Now, starting from this function here above, I would like to calculate all the other intervals (t-studentized, BCa, etc.) using the boot package and the boot.ci function (type="all"). How can I do ?
Thanks for your help.
Best,
SV

	[[alternative HTML version deleted]]



More information about the R-help mailing list