# How can I make a continuous distribution out of simulation results in R?

I have run 10,000 random samples (910 data points each) on a data set of about 75,000 data points. I would like to make a continuous distribution out of this so that I can test the probability of getting the results of a particular non-random sample which I made based on theoretical concerns.

For each random sample (and for the "real" sample), I collected the number of hits, the number of hits + misses (this number varies somewhat for reasons which I don't think are important), and the relative frequency of hits (hits / hits+misses).

Ideally, I'd like to take the relative frequencies and turn it into a continuous distribution (I assume it will be roughly normal), so that I can then see how likely the "real" relative frequency would be (using something simple like a T-test). But I'm not sure how to go about doing that.

On the other hand, is there an easier way to test the probability of obtaining my actual results just given a long file of the results of each random sample?

I assume there's some kind of R function that would make this fairly straightforward. Any hints?

It sounds like what you're describing is a bootstrap simulation in order to estimate the distribution of a statistic (the relative frequencies).

The package I'd suggest you to look into is the boot package:

functions and datasets for bootstrapping from the book "Bootstrap Methods and Their Applications" by A. C. Davison and D. V. Hinkley (1997, CUP).

It should hold many functions needed for what (it seems to me) that you are trying to do.

Here are some tutorials on the boot package.

Best, Tal

Sounds like you want something like a Kernel Density Estimate of the distribution. In R I think you want density function.

• Hi John. I believe he might want it on a bootstrap sample. Commented Jan 25, 2011 at 7:48