Dan Bolser
2005-Jan-04 16:20 UTC
[R] boot and variances of the bootstrap replicates of the variable of interest?
I want to use boot.ci to generate confidence intervals over the bootstrapped mean(s) of a group of observations (i.e. I have 10 observations and I want to know how confident I can be on the value for the mean). I don't know (or want to know) the details of bootstrapping - I just have the simplistic idea of taking samples, measuring a statistic on the sample, and getting some confidence in the result based on the variance of the sample statistics. I am not sure which "type of interval [is] required", so I wanted to try "studentized intervals", because some of my groups have a small number of samples (like one or two). However, "variance estimates are required for studentized intervals". I can generate the variance for the statistic like this.. # Shame the 'mean' function dosn't work with boot mean.x <- function(xx,ii) mean(xx[ii]) # Don't know how (or why) to pick a value for this. nboot <- 1000 # The 10 or so observations (in this case) boot.sub <- boot(data=shabby.sub$a, statistic=mean.x, R=nboot) # Variance of the statistic over the 1000 replicates my.var.t <- var(boot.sub$t) # t: A matrix with 'R' rows each of which is a bootstrap replicate # of 'statistic'. However, I need the variance for each R statistic... I think... It is a shame that boot and boot.ci cant work more together better, without me (a patent idiot) having to pass values (correctly) from the results of boot into boot.ci. Any help with the above would be appreciated, as I am about to weep horrible tears (once more) at the alter of R. (not really :) Dan.