Question

In: Statistics and Probability

R Exercise 1. (a) Simulate the rolling of two dice 10,000 times. (b) Identify which rolls...

R Exercise 1. (a) Simulate the rolling of two dice 10,000 times. (b) Identify which rolls of the dice are in the event A, the dice add up to a perfect square (4 or 9). Determine what proportion of the 10,000 rolls are in A. (c) Identify which rolls of the dice are in the event B, the dice add up to an even number. Determine what proportion of the 10,000 rolls are in B. (d) Find out which rolls are in A ∩ B. Find the proportion that are in A ∩ B. How does that compare to the proportion in A multiplied by the proportion that are in B? (e) Of the rolls in which B occurs that you identified in part (c), what proportion of those rolls are also in A. How does this compare to the proportion you computed in part (b)? (f) Do your results in this R exercise match what you would expect based on the answers you got in problem (4) of the previous sectio

Solutions

Expert Solution

(a)

Simulate the rolling of two dice 10,000 times D1 and D2 are the 10,000 results of roll of dice 1 and dice 2.

D1 = sample(c(1:6), 10000, replace = TRUE)
D2 = sample(c(1:6), 10000, replace = TRUE)

Sum = D1 + D2

(b)

The event A, the dice add up to a perfect square (4 or 9).

A = Sum[Sum == 4 | Sum ==9]

Proportion of A, P(A) = 0.189

length(A) / length(Sum)

(c)

The event B, the dice add up to an even number.

B = Sum[Sum %% 2 == 0]

Proportion of B, P(B) = 0.5049

length(B) / length(Sum)

(d)

The  rolls are in A ∩ B (common to both A and B)

> intersect(A,B)
[1] 4

The proportion that are in A ∩ B is 0.0792

length(Sum[Sum == 4]) / length(Sum)

P(A) * P(B) = 0.189 * 0.5049 = 0.0954

The proportion in A multiplied by the proportion that are in B is not equal to P(A ∩ B)

(e)

Of the rolls in which B occurs, the proportion of those rolls are also in A is 0.4190476

length(Sum[Sum == 4]) / length(A)

This proportion is greater than the P(A) calculated in part (b).


Related Solutions

1. Let’s use Excel to simulate rolling two dice and finding the rolled sum. • Open...
1. Let’s use Excel to simulate rolling two dice and finding the rolled sum. • Open a new Excel document. • Click on cell A1, then click on the function icon fx and select Math&Trig, then select RANDBETWEEN. • In the dialog box, enter 1 for bottom and enter 6 for top. • After getting the random number in the first cell, click and hold down the mouse button to drag the lower right corner of this first cell, and...
Consider rolling two 6-sided dice. What is the probability that at least two of the rolls...
Consider rolling two 6-sided dice. What is the probability that at least two of the rolls have a sum that exceeds 6? at least 7 of the rolls have a sum that is even? exactly three rolls have a sum that equals 5?
Write a Java program to simulate the rolling of two dice. The application should use an...
Write a Java program to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12. Your application should roll the dice 36,000,000 times. Store the results of each roll...
Rolling a dice 15 times, find the probability of 6 consecutive rolls have 6 distinct numbers....
Rolling a dice 15 times, find the probability of 6 consecutive rolls have 6 distinct numbers. (i.e. 423123456..., 45612335626..., etc.)
Java Programming Activity Description: This lab requires you to simulate the rolling of two dice. Two...
Java Programming Activity Description: This lab requires you to simulate the rolling of two dice. Two dice consisting of 6 sides are rolled. Write a program that simulates this. The user will be asked if he/she wishes to continue the roll of dice. If the answer is, “Y” or “y”, then your application will continue to roll the two dice. Each roll of the dice must occur 6 times, each time the user agrees to continue (see sample output). Use...
dice-rolling results (Aim for 240rolls, 40 rolls per line)
dice-rolling results (Aim for 240rolls, 40 rolls per line)
1. Many games require rolling 2 dice and adding the rolls together. Fill in the table...
1. Many games require rolling 2 dice and adding the rolls together. Fill in the table below with the sum of the two die rolls. The first few cells have been completed as an example. Sum of Die Rolls First Die Roll 1 2 3 4 5 6 Second Die Roll 1 2 3 4 2 3 3 4 5 6 a. We assume die rolls are all equally likely. There are 36 possible outcomes (6x6) when we give them...
Lets use Excel to simulate rolling two 8-sided dice and finding the rolled sum. • Open...
Lets use Excel to simulate rolling two 8-sided dice and finding the rolled sum. • Open a new Excel document. • Click on cell A1, then click on the function icon fx and select Math&Trig, then select RANDBETWEEN. • In the dialog box, enter 1 for bottom and enter 8 for top. • After getting the random number in the first cell, click and hold down the mouse button to drag the lower right corner of this first cell, and...
You are rolling a pair of balanced dice in a board game. Rolls are independent. You...
You are rolling a pair of balanced dice in a board game. Rolls are independent. You land in a danger zone that requires you to roll doubles (both faces show the same number of spots) before you are allowed to play again. 1. What is the probability of rolling doubles on a single toss of the dice? A) 25/36 B) 5/36 C) 1/6 D) 1/36 2. What is the probability that you do not roll doubles on the first toss,...
Simulate the experiment of rolling two dices for 1000 times. Generate the probability mass distributionfunction(PMF) for...
Simulate the experiment of rolling two dices for 1000 times. Generate the probability mass distributionfunction(PMF) for the sum of the two dices and plot the result using histogramcommand. Use two different methods for your simulations: Using for loops Using vectors and matrices in MATLAB
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT