QUANTITATIVE METHODS PRACTICAL 1
Handling data in MINITAB 13

Aim of practical

The aim of this practical is to become familiar with entering, manipulating and saving data in the MINITAB statistical package. Version 13 includes a new Project feature, allowing you to keep data, commands, and output as tables or graphs, together in one file, which can be saved and reopened later. Work in pairs, switching frequently so that both get to use the computer.

  1. Introduction to MINITAB: Follow a tutorial exercise to learn the basics of manipulating and saving data.
  2. Introduction to EXCEL: Use a simulation program to obtain a set of data. Learn how to manipulate data in Excel.
  3. Using MINITAB: Learn how to import data into MINITAB and perform some simple operations.

Part I: MINTAB Tutorial

Instructions are labelled * below, comments are unlabelled. In general things to click on are shown in bold, and keyboard entries in square brackets. Minitab is not case sensitive, so c1 is the same as C1 for example. Clicking is by the left button unless noted otherwise. This part is based on the Minitab Basics tutorial session, which is also available at Help>Tutorials>Session one.

Step 1: Start MINITAB and open a Worksheet

* Double-click the MINITAB icon.

When you start MINITAB you begin a new, empty project with a session window in the top half of the screen and a data window below. You can add data to your project most easily by opening a worksheet. Note that you are only copying the data from the worksheet to the project; any changes that you make to the data added to your project will not affect the original file.

* Activate the Project Manager by clicking the Project Manager button (11th from the left) or pressing [Control]+[i].

All MINITAB worksheets have the extension .MTW; in this tutorial you will use the file POPLAR1.MTW, which has data on the diameter, height and weight of poplar trees.

* Right-click on the Worksheets folder in the Project Manager and choose Open Worksheet. Make sure the file type is Minitab (*.mtw) and Look in: My Computer>C:>Program Files>MTBWIN>Data.

* Click on Poplar1.MTW and click Open. Click on OK to the message ‘A copy of the content of this file will be added to the current project’. Minimise the Project Manager window by clicking on the minus in the top right corner.

Step 2: Enter data from the keyboard

This worksheet contains three variables, labelled Diameter, Height, and Weight. Each variable contains 15 observations. Enter five new rows.

* Using the mouse, position the cursor on the first blank cell in row 16 and click. You can reach row 16 by scrolling down using the down arrow to the right of the data window. Type the following data, pressing [Enter] after each value.

Note that you do not need to type leading zeros. It is simplest to enter data one column at a time, as the active cell moves downwards each time you enter a value. If you make a mistake, click on the cell, type the correct value, and [enter].

DiameterHeightWeight
1.522.9.07
4.515.27.79
1.182.2.03
3.174.93.44
3.334.89.52

If you type text (e.g. a letter O) rather than numbers into any of the numbered rows, that column is converted into a "text" column. You cannot do statistics on text columns. It will be obvious that you have turned a column into a text column as the column heading will have changed, for example from C1 to C1-T. If you accidentally type text into a numerical column, then:

* Click on the cell and overwrite the text with the correct number. Then choose Manip>Change Data Type>Text to Numeric, enter the appropriate column number (as both old and new columns), and press OK. The column heading will be changed back, for example from C1-T to C1.

Minitab 13 has the safeguard that text data can only be entered into the first row of a new column. If you attempt to enter text into an existing numeric column, it will be rejected automatically.

Step 3: Enter patterned data

You can also enter repeated values easily. For example, create a new variable Site to code data from two sites, with ten observations for each site.

* Go to the top of column C4 and select (by clicking on) the blank grey Label cell, directly under the column number. Type Site and press [enter].

* Click on the empty cell in row 1 and type [1]. Now place the cursor over the square handle in the lower right corner of the selected cell. The crosshair cursor should change from white to solid black, which indicates that you are in Autofill mode.

* Left-click and hold down while dragging the cursor to row 10, and release. Autofill will automatically fill the selected cells with 1s. Now do the same from row 11, typing 2 and filling rows down to row 20.

The new Site column appears in the Data window and in the Columns folder in the Project Manager. To view column information, get the Project Manager from the taskbar and click on the Columns folder.

Step 4: Save your project

It is a good idea to save your work frequently, for example just after you have entered data.

* In the Project Manager, right-click on the top-most folder (labelled Untitled) and choose Save Project As…

* In File name, enter your name for the name of the project. MINITAB will automatically add the extension .MPJ to the project file. Click the menu arrow on the Save in: window and select G: >TEMP>Qmethods.

* Click Save. You may see a message asking if you want to replace an existing file. This means that someone else is using the same name, so click No and try something else. Minimise the project manager.

Step 5: Compute descriptive statistics

There are many statistical tests available in MINITAB. We will now look at the most basic of these, simple descriptive statistics such as the mean, median, and standard deviation. You can choose to look at the data in one or more whole columns, or in parts of a column, selected on the basis of codes in another column.

* Choose Stat>Basic Statistics>Display Descriptive Statistics. In the variable list box click Diameter and drag the cursor down to highlight Height and Weight as well. Then click on Select and on OK. The procedure selected and the results appear in the Session window above the data. Note that the results are for N=20, that is for the complete columns.

* Next look at the data for sites 1 and 2 separately. Choose Stat>Basic Statistics>Display Descriptive Statistics. Diameter-Weight should already be in the variables window – if not, select them again. Click the check box By variable, click in the box next to this, then click on Site in the variable list and then on Select again. Site should appear after By variable: Then click OK.

The new procedure selected and the results appear in the Session window below the last results; note this time the descriptive statistics are for diameter, height and weight by Site. The results are now given separately for sites 1 and 2, with N=10 for each. The use of coding variables such as Site is fundamental to most tests in MINITAB and other statistical packages.

Step 6: Perform arithmetic

Now we can try to predict how much the poplar trees would weigh, to compare with the observed weight. The formula is the square of the diameter multiplied by the height. We can perform this with the MINITAB calculator, saving the result in a new variable.

* Choose Calc>Calculator. The new variable will be called D2H for diameter squared times height. In Store result in variable, type D2H.

* Click in the box Expression and type C1**2*c2 and click OK. You could also use the **, 2 and * keys on the calculator. (In this case it’s not a great time saving; the function names in the Function box are more useful.)

The normal rules of maths apply, exponentiation (**) before multiplication (*) before addition or subtraction. You can use parentheses to make an expression clearer, or to force a different order of calculations. The Data window shows the new variable D2H that you just created. Now save the project changes:

* Choose File>Save Project or click the disk icon on the toolbar.

Step 7: Create a scatter plot

The final step is to see how good the predicted weight D2H is at actually predicting the weight of the trees. This would be done statistically, but for now we will just plot a graph of the data, to show the graphics capability of MINITAB.

* Choose Graph>Plot. Click on Weight in the variable list and then on Select; it will be placed in the Y graph variable. Then do the same for D2H and it will be placed in the X graph variable. (You can also type the variable names or column numbers such as C3 and C5 into the Graph variable boxes.)

* Press the OK box. The result will appear in a new graph window. There is a positive linear relationship between weight and D2H, although there is one unusual data point. This comes from the POPLAR1.MTW file – a good lesson to always check your data first before doing any analysis. We all make mistakes, and they are best found as soon as possible. The odd data point is in row 15, possibly a typo of 0.07 instead of 0.70! Now minimise the graph window.

Step 8: Command prompts

You can also do many of the same tasks using DOS-type command prompts. This was the original form in MINITAB, but has become rather inconvenient in version 13. Nevertheless, they have featured in past examination papers so it is worth remembering the common tasks in this form.

* Choose Edit>Command Line Editor. The Command Line Editor window appears. You can type your instructions into this window, and they are executed when you click Submit Commands (pressing [enter] only brings you to a new line). The old MTB> prompt has disappeared, just type your commands in the window.

* Calculations are straightforward, the result can either be sent to a new variable, or can overwrite an existing variable. Type in the command line window:

Let c6=c1**2*c2 [enter]
Let c7=(c1**2)*c2 [enter]
Let c8=c1**(2*c2)

And press Submit Commands. C6 and c7 should be the same as c5, but c8 is different, the order of precedence being overridden by the parentheses.

* Get the Command Line Editor window again, delete the old commands (highlight with the cursor and press [Del]) and type:

Let c6=c1+c2 [enter]
Let c7=c7-c6

And press Submit Commands. The data in c6 have been replaced by new values, and these have been subtracted from those that were in c7, giving new values in c7 as well. Note that the = is used as in programming (become equal to), not as in mathematics (is equal to).

* Get the Command Line Editor window again, delete, and type:
Erase c6-c8

And press Submit Commands. This erases whole columns. You can also do this by choosing Manip>Erase Variables, click on the variables you want to erase and press Select and then OK. Note that the Delete command in Minitab is now restricted to rows within columns, not whole columns.

* Get the Command Line Editor window again, delete, and type:

DESC C1-C3

And press Submit Commands. This repeats the analysis of descriptive statistics for diameter, height and weight that you did earlier, for the whole columns. You will be given commands for other statistics in the next practicals.

Step 9: Save your work and exit MINITAB

When you save your project, you save all your work at once: all the data, all the output in the session window, and all the open Graph windows. When you reopen the project, all that information can be accessed again.

* Choose File>Save Project

* Choose File>Exit.

Part II: Introduction to Excel

In this part you will use a physiology simulation to generate some data. The simulation program is rather crude (DOS-based), but generates exactly the sort of data you would obtain from a real experiment. You then edit this data in Excel so that it can be imported into MINITAB, a common task in research.

The simulation is of body temperatures of the pigmy mouse Baiomys taylori at 20 C. This mouse undergoes daily torpor at low ambient temperature, with body temperature decreasing from about 7.00-12.00 h, as a means of energy saving.

Step 1: Start the simulation

* Double-click the DATASIM icon. This produces a DOS command window, with the question Simulation file on disk in which drive (A-F)? Press [C]. The program then asks Do you want to see a list of simulation files (Y/N)? Press [Y]. You will then be given a list of the available simulations, and a prompt to choose one. Type DIELTEMP and [enter] this.

* You are now ready to run the pigmy mouse body temperature simulation. The program generates data for body temperatures of pigmy mice at intervals through the day-night (diel) cycle. Press [enter] to start the simulation, and [enter] again to confirm that the variable being examined is Time in hours. Then type 12 [enter] in answer to the question How many different levels of time?

* Then type in the times, from 2 to 24 at 2 hour intervals, in answer to the prompt Enter values of time in hours, Level: (i.e. type 2 [enter] 4 [enter] 6 [enter] 8 [enter] …20 [enter] 22 [enter] 24 [enter]).

* Next type 5 [enter] in answer to the question How many observations for each of the 12 levels of time? This simulates 5 values at each time; for the purpose of this exercise we will assume that the same 5 mice are used at each time, in the same order, so that one row of data will be for one individual. Type [N] in answer to the question Do you want data sent to a printer (Y/N)?

* Press the [space bar] to run the simulation, and [Y] to see a graphical display of the results. Press [enter] to select the "High resolution display" (bearing in mind this is from the DOS era!) You will then see a crude graph of the data. Our aim is to import these data into MINITAB to produce a high quality graph, in which each individual mouse will be identified, and perform calculations on them.

Step 2: Save the data

* Do not print the graph screen, but press the [space bar] to continue analysis. Next press [enter] over Analysis of simulated data, move the highlighting down with the down arrow, and press [enter] again over SAVE simulated data to disk. You are then asked Disk in which drive (A-F)? and should type [C].

* You are next asked for a file name; type MOUSE [enter]. The next question is Which format to save MOUSE; type [1] for ASCII (a file of numbers suitable for importing into spreadsheets). Finally press [enter] in response to Return to main menu, move the highlighting down and press [enter] again to End program.

You should now be back to Windows (relief), with the file MOUSE.ASC on drive C, in the folder crusty which also holds the simulation program.

Step 3: Edit the data in Excel

The output from the simulation is unsuitable to use straight away in MINITAB, as it has text and is oriented the wrong way. We will solve these problems using the Excel program.

* Double click on the Microsoft Excel icon. Then choose Data>Get External Data>Import Text File. In the file window (Look in: ) use the menu arrow, and choose My Computer >hard disk (C: )>crusty. In the Files of type: menu click on All files to show all file extensions, click on MOUSE.ASC, and then on the Import button to select this file.

* Next you have to specify how the data are stored in MOUSE.ASC. Choose the Delimited radio button and click on Next. Then select the Comma checkbox and again click on Next. Then click on Finish and OK. You have now told Excel that the numbers in the MOUSE.ASC file are separated by commas, so it can read them properly.

* Click on the number 1 at the left of row 1, and drag the cursor down to number 2. Then select Edit>Delete. The first two rows, of text, will then be deleted. Then do the same for row 7, the row of squares ending the data. Lastly click on the border between the labels A and B at the top of the table, and drag the cursor to the left to resize the table. You are now left with just the desired data.

* These are still in the wrong orientation to be of much use, however. We need to transpose the table so that each individual is in one column, and each row is for one time. Select the table to transpose by clicking the cursor in cell A1, holding down, moving to cell L6 and releasing. The table is now marked.

* Click the Copy icon (8 from the left) and the borders of the table will become active. Place the cursor outside this area, say in cell A8 and click there. Then choose Edit>Paste Special, tick the Transpose check box, and click on OK. The table should now appear in cells A8 to F19.

* Next delete the original table and blank rows by clicking number 1 at the left margin, holding down and moving to number 7 and releasing. Then choose Edit>Delete. The transposed table should now start in cell A1.

Step 4: Exporting the data

* To save these data choose File>Save As. In the file window Save in: select My Computer>G: >TEMP>Qmethods. For File type: select Text (tab delimited) and enter your name as the file name, and press Save. Answer OK and Yes to the next two information messages. Then choose File>Exit and No to exit Excel. You should now have saved the data in a file YOURNAME.TXT.

Part III: Plotting Mouse Data

In this part you will import the data into MINITAB, and plot the data in three ways after manipulation and calculation:

  1. As seen in the simulation, but at high quality.
  2. After identifying each individual mouse.
  3. As mean values.

Step 1: Importing the data

* Open MINITAB (double-click on the icon), and choose File>Other Files>Import Special Text to read the mouse data. Type C1-C6 in the box Store data in columns: and press OK. In the file window Look in: select G: > TEMP>Qmethods. For Files of type: select Text Files (*.TXT), click on your name in the file menu window and click Open.

* The data should be in columns 1-6. Label the empty cell under C1 as Time, and the next 5 cells as mouse1 to mouse5. These data are now suitable for statistical analysis or, in our case, graphics.

Step 2: Plotting combined data

* To plot the data in the same form as seen in the simulation, we need to combine data from all five individuals. This is easily done by stacking the data. Choose Manip>Stack>Stack Columns. Then click on mouse1, hold down and move the cursor to mouse5, release and then Select these columns, which should appear in the Stack the following columns box.

* Click the Column of current worksheet radio button and type c7 in its text box. Then type C8 in the box Store subscripts in. Uncheck the checkbox Use variable names in subscript column. Then press OK. The data from mice 1 to 5 should now be combined in column c7, and the number of each mouse in column c8. You can label these columns Body Temp and Mouse respectively.

* Now stack the time values from column 1 five times in column 9. This is the same as for the mouse data, but click on Time and Select this five times, enter c9 in Column of current worksheet window, delete c8 from the box Store subscripts in, and press OK. The times should now be repeated five times in column 9, which you can label Time (hours).

* To reproduce the simulation graph, choose Graph>Plot and Select c7 as Y and c9 as X. Press OK and you should see this graph in high quality form. Minimise this window.

Step 3: Plotting separate data

So far we have only improved the quality of the output. Our real aim in this exercise it to do things that the simulation program could not do. We will now plot the data, identifying each mouse separately, as an alternative to statistical analysis.

* Choose Graph>Plot. The choices should appear as before, but this time click on the arrow for the menu For each and select Group. Then type c8 in the box Group variables. You are instructing MINITAB to use a different symbol for each group of data, not for the graph as a whole, and to identify these groups on the basis of the codes in column 8 (which correspond to mice 1-5). Then press OK.

* Before printing this graph you need to give it a title to identify it as your own in the printer queue. This is done in the graph editor mode. Either double-click the graph, or choose Editor>Edit. The Tools and Attributes palettes should now appear to the right of the graph. If they do not, choose Editor>Show Tool Palette and Editor>Show Attribute Palette.

* To add a title, click on the text tool T, the top right button of the Tools palette. Then click on a blank area at the top of the graph where you want one corner of your title, hold down and drag the cursor to the opposite corner of the title and release. This defines the area where the title will appear.

* The Text box now automatically appears. Type your title (in this case your names) into the box and click OK.

* To enlarge the title, click on the title (while still in Edit mode). Then click the size tool on the Attribute palette, the third button down on the right side TT. Then pick a size from the menu. Clicking on 1.5 increases the size to 1.5 times the default, which is about right. Click on Other to see the effect of making the title even larger, then go back to 1.5 times for printing.

* To print the graph choose File>Print Graph>Print. Then close the graph editor by choosing Editor>View and the palettes should disappear. Finally close the graph window by minimising it (minus sign in the top right corner). Do NOT delete it by clicking on the x as it will be permanently lost.

* Check that the graph has not been lost by retrieving it. Choose Window>Plot (axes), where (axes) will be the axes of your graph, for example Body Temp * Time (hours). There will be a choice if you have already plotted several graphs in the current project. Finally, minimise the graph window again.

Step 4: Calculating and plotting the means

You should now know enough to be able to calculate the mean body temperature of the 5 mice at each time period, and to plot this mean against time. Hint: use the calculator to give the mean of c2-c6 into a new column Mean, and plot this against the times in c1. You will need to choose For each>Graph to be able to plot a single symbol type again. Show the result on the screen to a demonstrator together with your printed copy of the previous graph. Then save the project and exit from MINITAB.