Question: The R command S=expand.grid(X1=1:6, X2=1:6) generates the sample space of two die rolls. The additional R command attach(S); Y=(X1==6)+(X2==6) generates the number of times a six occurs for each of the 36 outcomes in the sample space. Finally, the additional R commands pr=table(Y)/36; pr generates the probability mass function for the experiment that records the number of times a six occurs in two rolls of a die.
(a) Use the PMF obtained and R commands similar to those given in (2.3.7) to simulate 10 replications of the experiment that records the number of times a six occurs in two die rolls.
(b) Use the PMF obtained and R commands similar to those given in (2.3.8), namely x= sample(0:2, size=10000, replace=T, prob=pr); table(x)/10000, to obtain the relative frequencies for each outcome in the sample space of the experiment that records the number of times a six occurs in two die rolls, based on 10,000 replications.
(c) Use the R command hist(x,seq(-0.5, 2.5, 1), freq=F); lines(0:2, pr, type="p", col="red"); lines(0:2, pr, type="h", col="red") to construct a histogram of the relative frequencies and line graph of the probability mass function. This figure provides empirical verification of which property?