Input program. Loop #i = 1 to 25. *The function rv.uniform(1,1) draws a uniformly (flat) distributed random number between 0 and 1. * Decide on a door. Compute door = rv.uniform(0,1). *Decide on the winner. Compute winner = rv.uniform(0,1). Recode door, winner (lowest thru .3333 = 1) (.33334 thru .6666 = 2) (.6667 thru highest = 3). *Decide on Switching. String switch (A3). compute x = rv.uniform(0,1). If (x le .5) Switch = 'No'. If (x gt .5) Switch = 'Yes'. *Now carry out the switch if necessary--though not very elegantly. * If you guess the right door and switch, it is not important which door you switch to. If (Switch = 'Yes' and door = 1 and winner = 1) door = 2. If (Switch = 'Yes' and door = 1 and winner = 2) door = 2. If (Switch = 'Yes' and door = 1 and winner = 3) door = 3. If (Switch = 'Yes' and door = 2 and winner = 1) door = 1. If (Switch = 'Yes' and door = 2 and winner = 2) door = 3. If (Switch = 'Yes' and door = 2 and winner = 3) door = 3. If (Switch = 'Yes' and door = 3 and winner = 1) door = 1. If (Switch = 'Yes' and door = 3 and winner = 2) door = 2. If (Switch = 'Yes' and door = 3 and winner = 3) door = 2. String win (A3). If door eq winner win = 'Yes'. If door ne winner win = 'No'. End Case. End Loop. End File. End Input Program. *Now let's table all the results and see what we get. Crosstabs /Tables = switch by win /Cells = count row /Statistics = chisq.