Session Ready
Exercise

Simulating central limit theorem

The cental limit theorem (CLT) implies that we can apply statistical methods that work for normal distributions to problems involving other types of distributions. Interviewers are eager to check your understanding of CLT, especially if your future position involves A/B testing.

You will show the mechanics behind CLT on the example of die rolls.

In the last exercise, you generated 1000 die rolls by setting the size parameter: sample(1:6, size = 1000, replace = TRUE).

In step 1 of this exercise, you will generate 1 die roll output in a loop with 1000 iterations which is equivalent to the above.

To visualize:

  • discrete data - you can use barplot(table(x)),
  • continuous data - you can use hist(x).

The die_outputs and mean_die_outputs vectors have already been initialized.

Instructions 1/2
undefined XP
  • 1
  • 2
  • In a loop with 1000 iterations, generate 1 random number from the range 1 to 6. Assign the results to the die_outputs vector.
  • Draw a bar chart to visualize the number of occurrences of each outcome.