Question
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
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started