Determining the confidence interval for a non-normal distribution

I have a set of data I ran on a simulation using R with a population size (N) of 1000, sample mean of 64.93, and a standard deviation of 27.61. The distribution is positively skewed and a Wilks-Shapiro test done in JMP shows that the data is not normally distributed. I need the confidence intervals of this data to be able to test some experimental data I have.

I have learned that using the boot.ci() function in R can give me confidence intervals using bootstrapping.

As shown in http://www.statmethods.net/advstats/bootstrapping.html, the boot function requires: bootobject <- boot(data= , statistic= , R=), where data is the data of interest, statistic is a function that produces the statistic to be bootstrapped, and R is the number of times to do it.

My data is simply a vector of 1000 samples. I am not sure what statistic I should do. All the examples I have read online require two data sets to make a correlation statistic or a linear regression statistic.

Any help on this issue would be greatly appreciated.

• What exactly do you want confidence intervals for? For the estimate of the mean of your data? What do you want to be able to test about 'some experimental data you have'? Nov 15, 2011 at 11:00
• I don't think you necessarily need to try a bootstrap confidence interval. Tests of Normality will say the data come from a non-Normal distribution often when your CI method is robust to that assumption. You have a large sample size, meaning a CI based on the t distribution will be fairly unaffected by any non-Normality. Nov 15, 2011 at 14:05
• @Firefeather is quite right. A subtler problem is that comparing experimental data to confidence intervals is usually not valid; at best, it may be valid but is inferior to more standard comparisons of the experimental data to the simulation. In effect, you do have two data sets: the experimental results and the simulated results.
– whuber
Nov 15, 2011 at 15:19
• I am testing for copy number differences of genes in an organism. I have experimental data where I take a single organism from a sample when it enters exponential population growth phase and put it into new media. I do a single cell each transfer to reduce any chance of selection occurring. I quantified the DNA at the start of the experiment. Then again after 6 months (~200 generations). Nov 15, 2011 at 16:18
• Normal theory-based confidence intervals (e.g., using the $t$ distribution) are symmetric. When the data are very asymmetric so should be the confidence interval. The confidence interval based on $t$ may have the right coverage overall but be wrong in both tails. I would use the bootstrap in any case, which also works if the data happened to be Gaussian (normal). Dec 15, 2011 at 14:02

If you want to just do a simple bootstrap of a median CI then all you need is a median function that accepts indices.

med <- function(y, indices) median(y[indices])

Then you can just...

b <- boot(dat, med, 1000)
boot.ci(b)

(you might want to plot(b) to examine your boostrap)

But in your case, assuming your simple exponential model described the data well, I would just be tempted to let the entire simulation speak for itself in a figure. Plot your data distribution and overlay your simulation. If you use density curves your simulation can have a much higher N than the data.

densDat <- density(dat)
plot(densDat)
densSim <- density(sim)
lines(densSim, col = 'red')

(You might want to adjust the bw argument in density to smooth the curve.)