Math 362 - Computer Lab #1 - Fall 2002
Introduction
to Probability Theory
Computer Lab 1: MINITAB
We will start learning how to use MINITAB by simulating the tossing of 10 fair coins.
We will then save this simulation as a macro, which can be used repeatedly.
Finally, you will be asked to devise your own MINITAB code to simulate the
drawing of colored objects from a bag.
- Open MINITAB
- In Windows, from the taskbar, choose
- Start -> Programs -> Minitab 13 for Windows -> MINITAB
- Simulate 10 tossings of a coin
To this end, we will generate 10 random numbers, uniformly distributed between 0 and 1.
Each number will be associated with a symbol, H for heads if the number is less
than 0.5 and T for tails if the number is larger than 0.5.
- Create a collection of 10 random numbers
- In the Calc menu, select Random Data -> Uniform...
- Fill in the appropriate fields, in order to generate 10 rows of data,
to be stored in column C1. Each row will contain a number
randomly distributed between 0 (Lower endpoint) and 1 (Upper endpoint).
- Assign a symbol to each number
- In the Manip menu, select Code -> Numeric to Text...
- Then, code data from Column C1 into Column C2, according to the
following rule
- Original values 0:0.5 become H
- Original values 0.5:1 become T
- Count the number of heads and tails
You can count by hand since there are only 10 entries in Column C2.
You can also use MINITAB:
- In the Stat menu, choose Tables -> Tally...
- Enter C2 in the Variables field and click OK.
- The result is displayed in the Session window and should of course agree
with your hand count. You can also display the percentage of heads and tails by
checking Percents as well as Counts under Display in the
Tally... dialog box.
- Plot a histogram of the data
- We first need to assign a numeric value to each symbol. For that, use
Code -> Text to Numeric... in the Manip menu. Code the data
of Column C2 into Column C3, so that H corresponds to say
1 and T to 2.
- In the Graph menu, choose Histograms...
- Enter C3 in the Variables field and click OK
- Create a Macro to perform the above operations
- In the Project Manager window, open the History folder. This
contains all of the commands you have performed, in chronological order. Select
and copy the commands corresponding to the steps described above (do not copy the
first line which reads like Results for: Worksheet 1 nor any line that is not
a MINITAB command).
- Open a text editor (e.g. WordPad: Start -> Programs ->
Accessories -> WordPad)
- Paste the commands from the history folder into the text file
- Save the text file as a text document, with the extension MTB (e.g. MyProgram.MTB).
This simple command file is called an "Exec".
- Repeat the above experiment
- To invoke your macro, choose Other Files -> Run an Exec... in the
File menu, select the number of times you want to repeat the macro (1 in this
case) and select the corresponding file (e.g. MyProgram.MTB). You may need to replace
*.MTB by *.* in order to see the file in the Run an Exec
browsing window.
- Run the macro 10 times and record the number of heads and tails obtained in each case.
Run # | Number of Heads | Number of Tails |
1 | ... | ... |
2 | ... | ... |
3 | ... | ... |
4 | ... | ... |
5 | ... | ... |
6 | ... | ... |
7 | ... | ... |
8 | ... | ... |
9 | ... | ... |
10 | ... | ... |
- Can you use the outcome of any of these 10 experiments to determine the probability
of obtaining a head or a tail? Why or why not?
- How could you modify the above to obtain a more accurate estimate of each probability?
- Use MINITAB to create a macro which simulates the drawing of objects of different
colors from a bag, as we did in Lab #1
- Answer: The macro Drawings.MTB simulates
1000 drawings from a bag which contains 30% of Blue tiles, 30% of Red tiles and 40% of
Yellow tiles. You may try and modify it at your convenience.
Back to Math 362