# Q&A

1.      Generate 1000 independent samples from N(0; 1); call them ~x = (x1; x2; : : : ; x1000). Also generate 1000 independent samples from N(1; 1); call them ~y = (y1; y2; : : : ; y1000).Write down what software you are using, the code you used to generate the samples, and the first 10 samples of each. You do not need to write down all the samples.
2.      Suppose someone gave you two lists of numbers without telling you which one is ~x and which one is ~y. Procedure A is to compare a pair of corresponding numbers xi and yi from the two lists, and guess that the larger is yi and the smaller is xi. Explain intuitively why Procedure A gives the correct answer more than half the time.

3.      Apply Procedure A to each of the 1000 pairs of numbers you generated. For how many pairs was the guess from Procedure A correct? Write down your answer and your code.

4.      Compute the theoretical probability that Procedure A gives the correct answer for one comparison, and the expected number of correct answers for 1000 comparisons.

5.      Procedure A doesn't use all the available information available - we don't know which list is which, but we do know that all the numbers from one list come from the same distribution. We can take advantage of that.

Procedure B is to compute the sample means for the two lists, and guess that the one with higher sample mean is ~y and the one with lower sample mean is ~x. Note that Procedure B will either guess all 1000 numbers correctly or guess 0 correctly. Apply Procedure B to your two lists of numbers. For how many pairs (1000 or 0) was the guess from Procedure B correct? Write down your answer and your code.

6.      Repeat Procedure B 9 more times (using new lists of random numbers). Out of the 10 applications, how many times did you guess all 1000 pairs of numbers correctly?

7.      Compute the theoretical probability that Procedure B gives the correct answer for all 1000 pairs, and the expected number of correct answers among the 1000 pairs.

8.      You should have found that Procedure B is much better than Procedure A. Can you explain why in words that someone who didn't take Math 218 can understand?