The following is taken from Chapter 19: Distribution of Random Sample Means from the book: Illuminating Statistical Analysis Using Scenarios and Simulations.

Fifty random monkeys, each randomly pick a number from the following list of values. 1 2 3 4 5 6 7 Then you add up the 50 numbers and calculate the sample mean. Say you do this 1000 times and put the 1000 sample means in a histogram. What will the histogram look like?

In an attempt to recreate the histogram of the distribution of sample means I tried the following code:

Histogram[Table[Mean[RandomVariate[DiscreteUniformDistribution[{1, 7}], 50]], 1000]]

My question is: is the above procedure to create a distribution of sample means correct? Is there a better alternative?

P.S. This is not an assignment question. I am just reading the book on my own.

  • 2
    $\begingroup$ you can also use Histogram[ Mean@RandomVariate[DiscreteUniformDistribution[{1, 7}], {50, 1000}]] ` $\endgroup$
    – kglr
    Dec 12, 2021 at 3:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.