Minitab Computer Simulation


We will use the computer to simulate this process of random assignment much more quickly and efficiently.  The following instructions will step you through how to use Minitab to perform the simulation.  In particular you will learn how to write a Minitab micro to repeatedly run a simulation.  Open Minitab and follow the directions below:

  1. First make sure you have a Minitab prompt (i.e. MTB>) in your session window.  If you don’t have a prompt then go to Edit|Preferences.  The Preferences window should appear.  Click on Session Window, then click Select.  The Session Window Preferences window should appear.  Click the Enable button for Command Language and click on the OK button.  Now click the Save button in the Preferences window.  A prompt should now appear in your session window.

  2. Use Minitab to simulate one random assignment of the 11 winners and 12 losers to groups A and B by first entering the data:

    MTB> set c1

    DATA> 11(1) 13(0)

    DATA> end

    with 1 representing a winner and 0 denoting a loser.  Note that you now have eleven ones and thirteen zeros in column c1.

  3. Now take a random sample of 12 of these 23 subjects to form group A:

    MTB> sample 12 c1 c2

    Here Minitab has randomly selected 12 of the subjects in column c1 and placed them into column c2 (which represents the subjects assigned to group A).

  4. Finally, calculate the number of winners randomly assigned to group A:

    MTB> sum c2

  5. Count the number of winners in column c2.  It should be the same as the number you just computed via Minitab.  Record how many “winning” subjects were randomly assigned to group A in this repetition.

  6. Use Minitab to keep track of these results from repetition to repetition by first setting up and initializing a counter variable and then collecting your first result into a new column:

    MTB> let k1=1

    MTB> let c3(k1)=sum(c2)

    Here k1 counts the number of samples and c3 stores the number of “winning” subjects randomly assigned to group A.  You might want to name this column to make sure that it is clearly identified:

    MTB> name c3 ‘numAwins’

    Note: You can also name c3 by clicking on the row above one and typing in the name. 

  7. Now increment the counter:

    MTB> let k1=k1+1

    and take another random sample of 12 of these 23 subjects:

    MTB> sample 12 c1 c2

    and again calculate the number of winners randomly assigned to group A and continue to collect them:

    MTB> let c3(k1)=sum(c2)

  8. Use Minitab to repeatedly take samples in this manner by incrementing the counter and then repeating the sampling and summing commands.  In other words, you can repeatedly copy and paste the following commands:

    MTB> let k1=k1+1

    MTB> sample 12 c1 c2

    MTB> let c3(k1)=sum(c2)

    Do this for a total of 25 repetitions. 

  9. Now use Minitab to produce a tally of the results:

    MTB> tally c3

    and to compute the descriptive statistics for the results (note: you can also use the Stats pull down menu here):

    MTB> describe c3

    What are the mean and standard deviation for your empirical distribution?

  10. Now produce a dotplot and histogram of the distribution:

    MTB> %Dotplot c3 (It may be easier to choose “Dotplot” from the “Graph” menu.)

    MTB> hist c3

    Reproduce by hand (or print out) your histogram and manually indicate the mean and standard deviation on your distribution histogram.  Is this distribution similar to what you found with the card simulation?  In how many of these 25 random assignments were 3 or fewer winners assigned to GroupA?

  11. While this Minitab simulation is more efficient than shuffling and dealing cards, we can make it run much more quickly by writing a macro (a series of Minitab commands). We can create a Minitab macro that allows for quickly this random assignment for these data a large number of times.  To do this first re-initialize the counter and clear the output columns:

    MTB> let k1=1

    MTB> erase c2 c3

    Then copy into a text file (open Notepad under “Accessories”) the following commands:

    sample 12 c1 c2

    let c3(k1)=sum(c2)

    let k1=k1+1

    Save the text file as “friendly.mtb”.  Be sure to use the “mtb” extension and put quotes around the file name, and remember where you put it.  (Save it to your disk if you have one.)  Then within Minitab, select File> Other Files> Run an Exec…, tell it to execute 1000 times, click on “Select file” and choose the “friendly.mtb” file that you just created. 

  12. When the macro has finished running, ask Minitab for a tally, descriptive statistics, and a histogram of the results (remember that the results represent the number of winners randomly assigned to group A under the assumption that the observer’s incentive has no effect).  Write a few sentences describing the distribution, and record the distribution in the table:

      0 1 2 3 4 5 6 7 8 9 10 11
    tally                        
  13. In how many of these 1000 repetitions were the results as extreme as in the researchers’ actual data?  Based on this larger simulation, what is the approximate probability of obtaining a sample result as extreme as the researchers’ actual data (note: this probability is also called the p-value of this test)?  Are the sample data pretty unlikely to occur by chance variation alone if the observer’s incentive had no effect?  Do the sample data provide reasonably strong evidence in favor of the researchers’ conjecture?  Explain.