The matching problem. Suppose that N items labeled 1, 2, , N are shuffled so that they
Question:
The matching problem. Suppose that N items labeled 1, 2, …, N are shuffled so that they are in random order. Of interest is how many of these will be in their “correct” positions (e.g., item #5 situated at the 5th position in the sequence, etc.) after shuffling.
a. Write program that simulates a permutation of the numbers 1 to N and then records the value of the variable X = number of items in the correct position.
b. Set N = 5 in your program, and use at least 10,000 simulations to estimate
E(X), the expected number of items in the correct position.
c. Set N = 52 in your program (as if you were shuffling a deck of cards), and use at least 10,000 simulations to estimate E(X). What do you discover? Is this surprising?
Step by Step Answer:
Modern Mathematical Statistics With Applications
ISBN: 9783030551551
3rd Edition
Authors: Jay L. Devore, Kenneth N. Berk, Matthew A. Carlton