Monte Carlo Club

From QiuLab
Revision as of 18:28, 9 February 2017 by imported>Weigang (→‎Feb 10, 2017 "Dating" (Due 2/17/2017))
Jump to navigation Jump to search

Feb 3, 2017 "US Presidents" (Due 2/10/2017)

  • Download : 1st column is the order, 2nd column is the name, the 3rd column is the year of inauguration; tab-separated
  • Your job is to create an R, Perl, or Python script called “us-presidents”, which will
  1. Read the table
  2. Store the original/correct order
  3. Shuffle/permute the rows and record the new order
  4. Count the number of matching orders
  5. Repeat Steps 3-4 for a 1000 times
  6. Plot histogram or barplot (better) to show distribution of matching counts
  7. Hint: For R, use the sample() function. For Perl, use the rand() function.

Feb 10, 2017 "Dating" (Valentine's Day Special; Due 2/17/2017)

  • Source: Paul Nahin (2008), "Digital Dice". Problem #20: "An Optimal Stopping Problem"
  • Problem: What is the optimal time point when one should stop dating more people and settle on a mate choice (and live with the decision)
  • Your best strategy is to date an initial sample of N individuals, rejecting all, and marry the next one ranked higher than any of your N individuals. The question is what is the optimal number for N.
  1. The problem could be investigated by simulating a pool of 100 individuals, ranked from 1-100 (most desirable being 1) and then take a sample of N
  2. You may only date one individual at a time
  3. You cannot go back to reach previously rejected candidates
  4. Simulate N from 0 to 10 (zero means marry the first date, a sample size of zero)
  5. For N, obtain the probability of finding the perfect mate (ranked 1st) from a simulated search for 1000 times
  6. Plot barplot of probability versus sample size N.

Feb 17, 2017 "Birthdays" (Due 2/24/2017)

  1. Randomly select N individuals and record their B-days
  2. Count the B-days shared by two or more individuals
  3. Repeat (for each N) 100 times
  4. Vary N from 10 to 100, increment by 10
  5. Plot matching counts (Y-axis) versus N (x-axis), with either a stripchart or boxplot, or both