A find the chance that the 5th card is the queen of spades


In R, write code to simulate the answers to both parts a) and b) of problem B4 based on 100,000 replications. (Note that R won't work if you leave the comma in a large number.) Suggestions: First write a line of code that will simulate drawing 5 cards from a "deck" with box model where the queen of spades has the value 1 and the other 51 cards have the value 0, then replicate that line 100,000 times using the replicate() function. The rep() function might be useful in constructing the "deck." Assign the output of the 100,000 replications to something, it should be a vector of length 100,000. If it's taking a long time (10 seconds or so) you can test with 1000 replications while you're trying things out, then do 100,000 after you are confident that you have the right idea. After you do that you can sum up the results and divide by 100,000. You have the answer in the back of the book, so you can compare the results of the simulation to the true value, they should be fairly close.

You can submit the code (probably 2 lines though you could do it in one line if you want) written in with your HW. 

B4. Five cards are dealt off the top of a well-shuffled deck. 

  • (a) Find the chance that the 5th card is the queen of spades.
  • (b) Find the chance that the 5th card is the queen of spades, given that the first
  • 4 cards are hearts. 

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: A find the chance that the 5th card is the queen of spades
Reference No:- TGS02903524

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)