3
$\begingroup$

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.

The data can be downloaded from: http://ktdllc.com/data/simp2.csv

Any help on this issue would be greatly appreciated.

$\endgroup$
  • 4
    $\begingroup$ 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'? $\endgroup$ – Nick Sabbe Nov 15 '11 at 11:00
  • 2
    $\begingroup$ 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. $\endgroup$ – Firefeather Nov 15 '11 at 14:05
  • $\begingroup$ @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. $\endgroup$ – whuber Nov 15 '11 at 15:19
  • $\begingroup$ 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). $\endgroup$ – Kevin Nov 15 '11 at 16:18
  • 2
    $\begingroup$ 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). $\endgroup$ – Frank Harrell Dec 15 '11 at 14:02
3
$\begingroup$

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.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.