# R Exercise 1. (a) Simulate the

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 diceadd up to a perfect square (4 or 9). Determine what proportion ofthe 10,000 rolls are in A. (c) Identify which rolls of the dice arein the event B, the dice add up to an even number. Determine whatproportion of the 10,000 rolls are in B. (d) Find out which rollsare in A ∩ B. Find the proportion that are in A ∩ B. How does thatcompare to the proportion in A multiplied by the proportion thatare in B? (e) Of the rolls in which B occurs that you identified inpart (c), what proportion of those rolls are also in A. How doesthis compare to the proportion you computed in part (b)? (f) Doyour results in this R exercise match what you would expect basedon the answers you got in problem (4) of the previous sectio

(a)

Simulate the rolling of two dice 10,000 times D1 and D2 are the10,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 Bis not equal to P(A ∩ B)

(e)

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

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

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

##### "Our Prices Start at \$11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

Pages (275 words)
Standard price: \$0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

## Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
\$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.