University of Exeter

Department of Psychology

please read our copyright and disclaimer notice

Doing ANOVAs using MINITAB


jump to Commands, Data storage, Command syntax (basic, subcommands, specifying the design: between subjects, within subjects, mixed mode), Example

The Minitab statistics package includes an Anova package which will meet most of the needs of most psychologists. This was introduced in Release 5 and was consolidated in Release 7.1. The only serious limitations we have yet found are (i) you have to work out contrasts for yourself and (ii) it cannot handle unequal cell sizes or missing data (note that unequal cell sizes can sometimes be dealt with by using the Minitab GLM command). As Minitab is much simpler to use than the bigger stats packs (SPSS etc), and fully interactive, this is probably the system to learn if you are needing to do anovas by computer for the first time, or the first time recently.

Unfortunately, the commands are not dealt with in the standard introductions to Minitab (Ryan, Joiner & Ryan, 1985, Minitab handbook 2nd edn, 1990 reprint; Monk, 1991, Exploring statistics with Minitab; West, 1991, Computing for Psychologists: Statistical analysis using SPSS and MINITAB); and the on-line help facility has been proved by several people's experience to be inadequate. So I have written these notes to try and stop you having to come and ask me how to do it. They don't cover all features of the commands, just those which I have already had to use, with a concentration on the points that have caused me and others difficulty.

These notes assume that you are using Minitab Release 7 on a computer with a unix operating system, but later releases (and Macintosh or PC versions) should be at least compatible, and may make some things easier. They also assume you know the basics of using Minitab (if you don't, get hold of Ryan et al, Monk, or West), and of the analysis of variance (if you don't you shouldn't be using it anyway, stick to discourse analysis).
  1. The commands
    Two commands are used for anovas: ANOVA and ANCOVA. (All Minitab command names are written in capitals in these notes, for clarity, but in actual use they can be typed lower case or as a mixture. The same goes for Minitab variable names.) ANOVA does analysis of variance. ANCOVA does analysis of co-variance, i.e. analyses in which as well as design variables with discrete levels, there are continuous variables which may also be determining the results (co-variates); it's a cross between analysis of variance and multiple regression. ANCOVA will do almost everything that ANOVA will do and take the co-variates into account as well, but if you don't have co-variates, use ANOVA. If you can handle ANOVA, the way ANCOVA works should be obvious by extension, so these notes don't discuss it further. Neither ANOVA nor ANCOVA can cope with missing values, and if you give them data containing missing values, they will produce fairly incomprehensible error messages, usually "Unequal cell counts".

  2. Data storage
    The first consideration is that all the values of the dependent variable need to be held in a single column. So if, for example, we have scores for one group of subjects in column C1, and scores for a second group in column C2, we will have to use command STACK to get them into a single column (C11, say). HELP STACK should give you enough information to do this.
    Having achieved this, we have to set up an additional column for each factor, which will contain to contain the level of that factor corresponding to each value of the dependent variable. Suppose now that we have dependent variable values in C1, and there are two factors, both of them between- rather than within-subjects. Then we need to set up two additional columns (let's say, C2 and C3), to hold the levels of these factors. The columns holding the factor levels must be the same length as the column holding the dependent variable; so a row, taken across all the columns concerned, would give (for a single observation) its dependent variable value and the values of each factor. This is the same system as is used in SPSS and many other statistical packages.
    For example, the data for a 2x3 analysis with four observations in each cell of the design might look like this:
    row C1 C2 C3
      1 11  1  1
      2 15  1  1
      3 17  1  1
      4  9  1  1
      5  9  1  2
      6 11  1  2
      7  7  1  2
      8 10  1  2
      9  7  1  3
     10  8  1  3
     11 12  1  3
     12  6  1  3
     13 19  2  1
     14 23  2  1
     15 26  2  1
     16 22  2  1
     17 18  2  2
     18 15  2  2
     19 22  2  2
     20 17  2  2
     21 24  2  3
     22 29  2  3
     23 21  2  3
     24 31  2  3
    
    There is a convenient way of setting up the factor levels by using repeating factors in the SET command. You can find out how by using HELP SET. For example, in the case above, C2 and C3 could be set up by:
    MTB> SET C2
    DTA> 12(1 2)
    DTA> END
    MTB> SET C3
    DTA> 4(1:3)2
    DTA> END
    MTB>
    
    It's quite difficult to remember when the repeat factors should come before or after the parentheses, so it is important always to look at what you have done (e.g. with PRINT C2 C3 in the example above), and check that you have got the right pattern of values. This is easy enough to do.
    In this example, it was not necessary to have a column specifying subject numbers. For mixed designs (involving both between- and within-subject factors), however, we will need such a column, for reasons spelled out below. This leads to a tricky point. It would be logical if each subject had a distinct number. So if the above 2_x_3 design with 4 subjects per cell involved two between-subject factors, subject numbers would run up to 24; while if it involved two within-subject factors, they would only run up to 4. Indeed, with this information, the package would be able to work out which factors were within and which between. Logical and desirable though such an arrangement would be, it isn't what Minitab ANOVA does. Instead, the subjects in a particular design cell are all numbered from 1 up to the size of the cell (even when subject 1 in one cell has nothing to do with subject 1 in another cell). So in the above example, subject numbers would run from 1 to 4 regardless of the nature of the factors, and we have to have another way of telling the command about the experimental design.

  3. Command syntax


The following example shows the analysis is of a two-between, two-within design, which illustrates most of what you need to know. The dependent variable is 'affect' and in in C1; there are two between-subjects variables, 'drug' in C3 and 'NHS/priv' in C4, and two within-subject factors, 'trial' in C2 and 'am/pm' in C6. It isn't absolutely guaranteed in the sense that I couldn't find a worked example of this complexity in a text book (if anyone knows of one, please inform me, I didn't search very far), though I have frequently met them in real research life.
MTB > ANOVA C1=C3 C4 C3*C4 SUBJECTS(C3 C4) C2 C2*C3 C2*C4 C2*C3*C4  &
CONT> C2*SUBJECTS(C3 C4) C6 C6*C3 C6*C4 C6*C3*C4 C6*SUBJECTS(C3 C4) &
CONT> C2*C6 C2*C6*C3 C2*C6*C4 C2*C6*C3*C4;
SUBC> RANDOM SUBJECTS(C3 C4).

Factor                     Type Levels Values
drugs                     fixed      2     1     2
NHS/priv                  fixed      2     1     2
subjects(drugs NHS/priv) random      5     1     2     3     4     5
trials                    fixed      6     1     2     3     4     5     6
am/pm                     fixed      2     1     2

Analysis of Variance for affect
Source                             DF         SS         MS       F      P
drugs                               1      3.554      3.554    1.23  0.284
NHS/priv                            1      0.932      0.932    0.32  0.578
drugs*NHS/priv                      1      0.288      0.288    0.10  0.757
subjects(drugs NHS/priv)           16     46.270      2.892       *
trials                              5     18.914      3.783    0.86  0.512
drugs*trials                        5     17.080      3.416    0.78  0.569
NHS/priv*trials                     5     44.212      8.842    2.01  0.086
drugs*NHS/priv*trials               5     21.215      4.243    0.96  0.445
trials*subjects(drugs NHS/priv)    80    351.912      4.399    2.01  0.000
am/pm                               1     49.115     49.115   29.00  0.000
drugs*am/pm                         1      2.710      2.710    1.60  0.224
NHS/priv*am/pm                      1      0.220      0.220    0.13  0.724
drugs*NHS/priv*am/pm                1      0.240      0.240    0.14  0.712
am/pm*subjects(drugs NHS/priv)     16     27.095      1.693    0.77  0.709
trials*am/pm                        5      8.227      1.645    0.75  0.586
drugs*trials*am/pm                  5      8.380      1.676    0.77  0.576
NHS/priv*trials*am/pm               5     21.933      4.387    2.01  0.086
drugs*NHS/priv*trials*am/pm         5      9.938      1.988    0.91  0.479
Error                              80    174.836      2.185
Total                             239    807.069
* no exact F-test can be calculated
Stephen Lea
revised 8th February 1996


University of Exeter
Department of Psychology
Washington Singer Laboratories
Exeter EX4 4QG
United Kingdom
Tel +44 1392 264626
Fax +44 1392 264623

Send questions and comments to the departmental administrator (Liz Hewitt) or to the author of this page

This information has been looked at Visitor Status Bartimes.
Goto home page for: Stephen Lea | University of Exeter | Department of Psychology | Staff | Students | Research | Teaching | Miscellaneous