# Monte Carlo / Nonparametric confidence intervals for mean estimate

I have 2x2 design with n = 3 (averages) for each group (see here). I am not sure that my data follows any particular distribution, but I would like to use confidence intervals as error bars in a dot plot. Thus I can't really use sd, se or bootstrapping from a distribution. The approach I am after is described in this article. My initial feeling is that I should use boot package. I have 3 replicates, which consist of different number of measurements. I would like to use averages of these replicates to calculate the confidence intervals. Something like:

x1 <- rnorm(50, 14,3)
x2 <- rnorm(35, 7,1)
x3 <- rnorm(40, 15,9)

d <- c(mean(x1), mean(x2), mean(x3))
b <- boot(d, function(u,i) mean(u[i]), R = 999, sim = "ordinary")
boot.ci(b, type = c("all"))


The help file for boot()function says "For the nonparametric bootstrap, possible resampling methods are the ordinary bootstrap, the balanced bootstrap, antithetic resampling, and permutation". Without background in statistics, I am having hard time understanding what do these different options do and what would be the most suitable for this case. boot.ci() function gives 5 different answers, which all seem to differ considerably. I am pretty confused. Could anyone clarify following related questions:

1. Is this a right approach?
2. Which combination should I use in this case?
3. Why so many options?
• Ok, I wasn't sure which forum to use, since it includes R stuff too. Maybe someone could kindly move it there? – Mikko Apr 27 '12 at 13:47
• Your question is not directed towards programming, you already found the package and the code. Your question relates to the statistics, which is the subject of CrossValidated. There are also a lot of R savy people there. – Paul Hiemstra Apr 27 '12 at 13:48
• I agree with the stackexchange suggestion. I hope someone there will tell you that with 3 data points, there's really extremely little point using fancy methods to compute confidence intervals. Without making assumptions about the distribution, it will be almost impossible to nail down confidence intervals. What do you think the 95% confidence intervals are of {1,2,13} ... ??? – Ben Bolker Apr 27 '12 at 14:23
• @BenBolker: sideways-eight. – Joshua Ulrich Apr 27 '12 at 14:30
• Just show the points! Add a horizontal bar at the mean if you really care about that. – Aniko Apr 27 '12 at 14:40

d=c(x1,x2,x3)

• If you have a more complex design you will need to incorporate that into the object you create. Perhaps you need something like: d<-data.frame( X <- c(rnorm(50, 14,3), rnorm(35, 7,1), rnorm(40, 15,9)), idx=rep(c("X","Y","Z"), each=c(50,35,40))). The principle is to make data in the same form as would be occuring in the experiment, .... before the analysis. – DWin Apr 27 '12 at 15:09