Question: 2. For this item, you will simulate rolling a fair, six-sided die 600 times (recording the number rolled each time in the object dierolls) and

2. For this item, you will simulate rolling a fair, six-sided die 600 times (recording the number rolled each time in the object dierolls) and then create a histogram of the distribution of outcomes. (a) The sample function is used to generate a randomly generated list of numbers from a specified range of values. It is possible to place a probability distribution on the range of values (for instance, if you wanted to simulate a biased die where certain outcomes have higher probability than others). Because you are simulating a fair die, you will not need to enter a probability assignment. Enter: > dierolls = sample(1:6, 600, replace = T) (Note that the argument replace = T indicates that all six outcomes are available on each of the 600 rolls.) (b) The hist function is used to generate a histogram of a distribution. There are many arguments to the hist function, but for the purposes of this course you will mostly be interested in the general shape of the distribution, so you will omit most arguments and allow the default settings to apply. Enter: > hist (dierolls, breaks = c(0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5)) Print this histogram out and include it with your written responses. (c) (Written Response) When drawing a histogram for the theoretical results of 600 rolls of a fair die, what kind of distribution should you draw? What should the height of each bar in the histogram be? How well that histogram matches the theoretical histogram you stated should result. Explain
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
