# Random sampling of 100 data points from a binomial population

This is my question I need to answer: Generate a random sample of 100 data points from a binomial population B(40, 0.4).

I'm pretty sure that n=100 and my mean is 40 and standard deviation is .4, but I just do not know how to find the random sample?

-
Presumably you have access to a random number generator, which produces pseudo-random numbers in the interval $[0,1)$. Call something between $0$ and $0.4$ a success. Repeat $40$ times, count the number of successes. That will give you one data point. Repeat $100$ times. –  André Nicolas Dec 12 '13 at 0:30

## 2 Answers

I generated in Mathematica, here are one sample data:

13, 16, 14, 18, 13, 10, 15, 15, 22, 9, 18, 18, 13, 17, 14, 10, 18, 16, 15, 18, 12, 16, 13, 12, 12, 9, 13, 17, 14, 13, 25, 16, 20, 23, 15, 10, 23, 14, 16, 18, 19, 22, 13, 16, 20, 16, 15, 12, 12, 13, 17, 15, 18, 13, 13, 17, 15, 15, 20, 15, 13, 16, 14, 18, 15, 15, 19, 17, 16, 21, 17, 20, 19, 14, 16, 16, 17, 19, 17, 23, 14, 20, 17, 13, 15, 21, 21, 23, 17, 22, 9, 11, 21, 12, 20, 15, 22, 15, 20, 15

-
You said 40 is the mean..so let me redo again. 40 should be the number of trial. –  LorenMt Dec 12 '13 at 0:37
OP had indeed said $40$ is the mean, but that is not true. –  André Nicolas Dec 12 '13 at 0:39
I have changed the data. –  LorenMt Dec 12 '13 at 0:41

You need a random number generator. If you have excel, you can simply use the following formula: BINOM.INV(40,0.4,RAND()) and copy it into 100 cells. Each time you pres F9, you will get a new set of observations.

-