Subject: RESAMPLING SOLUTIONS TO PROBLEMS

From: [email-masked] (Ghermay Araya)
Date: 30 Sep 1993 21:32:51 GMT

SOLUTIONS AND PROBLEMS TO PREVIOUS POSTING:

 Resampling, (bootstrapping, etc.), is revolutionizing the practice of  
statistic, and the way it is taught.  For articles, and information on  
software + books, results of classroom trails, and descriptions of pending  
projects in which teachers can become involved, contact the University of  
Maryland's Resampling Project. We are especially interested in class  
testers.  Contact:
	 Resampling Project,
	 attn. P.G. Bruce
	 College of Business
	 University of Maryland,
	 College Park, MD  20742. 
          Phone: 703-522-2713
	 FAX 703-522-5846
	 email [email-masked] 
	 
	 (mark attn. P. C. Bruce). 
         please provide  both  postal and email address.

SOLUTIONS:

Solution, Puzzle 1:
        
1.  Three urns - "0,0"; "0,1"; "1,1".
        
2.  Choose an urn at random. [Can do this on the computer 
        
with random selection of urn numbers, and then "If"]
        
3.  Choose the first element in the chosen urn's vector.  If 
        
"1", stop trial and make no further record.  If "0", continue.
        
4.  Record the second element in the chosen urn's vector on 
        
the scoreboard.  
        
5.  Repeat (2 - 5), and calculate the proportion "0s" on 
        
scoreboard. (Answer should be 2/3.)

NUMBERS (1 2 3) a         '"1" denotes a selection of urn 1 (u1),
                          '"2" urn 2, "3" urn 3
NUMBERS (6 6) u1          '"u1" has two pennies (6's)
NUMBERS (7 7) u2          '"u2" has two nickels (7's)
NUMBERS (6 7) u3          '"u3" has one penny & one nickel
REPEAT 1000
  SAMPLE 1 a b            'Select an urn at random
  IF b =1                 'If urn selector says urn 1
    SHUFFLE u1 u1         'shuffle urn 1
    TAKE u1 1 c11         'take one coin from urn 1, call it c11
    IF c11=6              'if the coin is a penny
      TAKE u1 2 c12       'take the second coin
      IF c12=6            'if the second coin is a penny
        SCORE 6 z         'keep track of the second coin result
      END                 'end IF conditions
    END
  END
  
  IF b =2                 'if urn selector says urn 2
    SHUFFLE u2 u2         'etc. as above
    TAKE u2 1 c21
      IF c21=6
        TAKE u2 2 c22
        IF c22=6
          SCORE 6 z
        END
      END
    END
        
    IF b =3
      SHUFFLE u3 u3
      TAKE u3 1 c31
      IF c31=6
        TAKE u3 2 c32
        IF c32=6
          SCORE 6 z
        END
      END
    END
 
END                        'End the experiment, go back and
                           'repeat until 1000 repetitions
                           'are complete
COUNT z = 6 k
DIVIDE k 1000 kk
PRINT kk

Answer:        KK       =       0.34

Solution:  Puzzle 2
 
1.  Put a white ball (later have the computer call it "7" to 
        
avoid confusion) or black (call it "8") in the urn with 
        
probability .5.
        
2.  Put in a white and shuffle the two balls.
        
3.  Take out a ball.  If black, stop and make no record.  
        
4.  (If result of (3) is white):  Take out the remaining 
        
ball, examine, and record its color.
        
5.  Repeat steps 1-4 (say) until 1000 trials (with 1000 
        
recordings) have been completed.  (Alternatively, one can divide 
        
the number of repetitions by the number of records in the 
        
scoreboard).  
        
6.  Count the number and compute the proportion of whites 
        
(7s) among the trials where the result of step (3) is white.  
        
Carroll gives the answer as 2/3 (p. 32).
        
COPY (7 8) A        '7=WHITE COUNTER, 8=BLACK COUNTER.
        
REPEAT 1000
  SHUFFLE A B       'SHUFFLE THE TWO COUNTERS
  TAKE B 1 C        'TAKE A COUNTER FOR THE BAG
  CONCAT C 7 D      'JOIN A WHITE COUNTER TO THE BAG
  SHUFFLE D E       'SHUFFLE THE BAG
  TAKE E 1 F        'TAKE OUT A COUNTER
  IF F =7           'IF THE COUNTER YOU TAKE OUT IS WHITE
    TAKE E 2 G      'TAKE THE OTHER ONE
    SCORE G Z       'RECORD THIS SECOND ONE'S COLOR
  END
END                 'END THE REPEAT LOOP, GO BACK AND REPEAT
COUNT Z =7 K        'COUNT HOW MANY TIMES SECOND ONE WAS WHITE
DIVIDE K ZZ KK      'EXPRESS AS A PROPORTION OF THE NUMBER OF
                    'TRIALS ON WHICH THE FIRST ONE WAS WHITE.
PRINT KK
        
Answer:         KK       =    0.66356

FROM PREVIOUS MESSAGE:
PROBLEMS:

Two Puzzles:  Does your reasoning lead you astray on the following  
puzzles?  Most people's does.  Here are resampling (simulation) solutions  
that illustrate how such an approach, though less sophisticated than a  
formulaic one, yields correct answers and offers fewer opportunities to go  
wrong. 

1)  "Three identical boxes each contain two coins. In one 
box both are pennies, in the second both are nickels, 
and in the third there is one penny and one nickel. 
        
A man chooses a box at random and takes out a coin.  If 
the coin is a penny, what is the probability that the 
other coin in the box is also a penny?"   [from Goldberg, 
1960, p. 99]

2)  A bag contains one counter, known to be either white or black. A white  
counter is put in, the bag shaken, and a counter drawn out, which proves  
to be white.  What is now the chance of drawing a white counter?  From  
Lewis Carroll's PILLOW PROBLEMS (1895/1958) (p. 2, via Martin Gardner)