using minitab exec files

13
Using Minitab Exec Files Prof. Tom Willemain 05/13/22 1 T. R. Willemain

Upload: julio-gonzalez-sanz

Post on 15-Aug-2015

55 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Using minitab exec files

Using Minitab Exec Files

Prof. Tom Willemain

04/15/23 1T. R. Willemain

Page 2: Using minitab exec files

Why Use Exec Files?

• You can do many Monte Carlo simulations without Exec files.

• Usually, this means putting each simulation replication in one row of the Data Window.

• But you soon run out of space for both data and results, so you can only do relatively small problems.

• Exec files free you to do bigger problems and use more of the features of Minitab.

04/15/23 T. R. Willemain 2

Page 3: Using minitab exec files

Typical Simulation using Exec files• Put (possibly lots of) data in columns, not

rows.• Compute a statistic using Calc>Column

Statistics or Calc>Calculator.• Store the statistic in an (invisible) location

called a “constant” (e.g., K1, K2,…)• “Stack” the results, moving them from the

constant into a single column holding results.• Analyze the results column.

04/15/23 T. R. Willemain 3

Page 4: Using minitab exec files

How It’s Done: Creating an Exec1. Create the first simulation replication manually. All your

menu choices and dialog box inputs are recorded in the form of Minitab commands in the History folder of the Project Management window.

2. Compute the result statistic from the simulation using Calc>Column Statistics and store it in constant K1.

3. Open the Notepad using Tools>Notepad.4. Open the History folder, highlight the commands you

want to repeat, and copy/paste them into the Notepad.5. Manually add one more line in the Notepad to Stack the

result statistics in a column of the data window.6. Save the Exec file from the Notepad to your hard drive

using File>Save As>All Files. Save it as an xxx.mtb file.

04/15/23 T. R. Willemain 4

Page 5: Using minitab exec files

How It’s Done: Running an Exec

• In Minitab, select File>Other Files>Run an Exec• In the Run an Exec dialog box, enter the number of

additional replications you want. (It’s safer to first ask for just 2 replications to see that everything is working ok. Then you can add more replications.)

• In response to the prompt, select the Exec file you want to run. Exec files have names like foo.mtb.

• Minitab will run the Exec file the desired number of times and stack the results into the column you selected.

• Finish the problem by analyzing the column of results.

04/15/23 T. R. Willemain 5

Page 6: Using minitab exec files

Example: Inter-point Distances• The next slide show how to estimate the

distribution of the distance between two points whose X and Y coordinates have unit exponential distributions.

• Note that you need 5 columns: 4 coordinates and one distance. Without an Exec file, and with a 10,000 number limit in the Minitab Student 14 Edition, you could do a maximum of 2,000 replications (2,000 = 10,000/5).

• But with an Exec file, you can do as many as 9,995 replications.

04/15/23 T. R. Willemain 6

Page 7: Using minitab exec files

04/15/23 T. R. Willemain 7

Page 8: Using minitab exec files

04/15/23 T. R. Willemain 8

Page 9: Using minitab exec files

Example: A Matching Problem

• A class has 20 students, who take a quiz.• The professor collects the quizzes, shuffles

them well, and hands them back to students to grade.

• Some students may get their own quiz back to grade. The number of such “matches” is a discrete random variable ranging from 0 to 20.

• Estimate the p.m.f. using an Exec file.

04/15/23 T. R. Willemain 9

Page 10: Using minitab exec files

One Trial of the Matching Simulation

04/15/23 T. R. Willemain 10

1. List the 20 students by number.2. Create a set of 20 random

numbers.3. Create a list of 20 graders and

sort it by the random numbers.4. Compute a binary variable = 1 if

there is a match or else = 0.

Page 11: Using minitab exec files

The Exec File

04/15/23 T. R. Willemain 11

This last line is added to Notepad manually.

Page 12: Using minitab exec files

The Estimated P.M.F.

04/15/23 T. R. Willemain 12

Page 13: Using minitab exec files

Comment• We have estimated the p.m.f. by Monte Carlo simulation.• It is possible, though quite complicated, to work out the

answer analytically. This is always preferable, if possible.• Theory tells us that, asymptotically (as the # of cases

increases), the p.m.f. is Poisson with mean = 1.• The simulation suggests this, since the sample mean and

sample variance are both near 1.0. Sometimes simulation and analysis alternate in the search for knowledge: they are complementary approaches.– Theory first: Use simulation to check the correctness of your

theory.– Theory second: Use simulation to suggest a theoretical

approach.

04/15/23 T. R. Willemain 13