# The Anova Operator

Sometimes comparisons can take place between two or more groups (or levels).    Comparisons can also take place using one or more factors.     We will first look at One-Way ANOVA where we compare three or more groups and at other designs when there are more than one factor.  These include blocked designs, Latin-Square designs, two-and three factor designs with fixed factors, random factors and mixed factors, factorial designs, then complete and fractional  factorial designs, and finally nested designs.O

1. One Way Anova. Three or more groups, confidence intervals and pairwise comparisons.
2. The Randomized Complete Block Design: One factor of interest, one blocking factor.
3. The Latin Square Design: One factor of interest, two blocking factors.
4. Factorial Designs:  One two or three factors of interest
5. Random and Mixed Models:
6. 2*K Factorial Designs
7. Nested Designs

The following table shows the various designs handled by the anova operator:

 Design Operand Left Argument Right Argument Result One Factor; 3 or more groups; sample sizes may vary oneWay None Vector of numeric vectors 2-item Vector of database variables NameSpace NameList Anova Table R-Squared/S Group Means Confidence Intervals LSD Analysis Blocked Replications blocked None Numeric Matrix, blocks are columns Numeric Array; blocks in last dimension Anova Table R-Squared/S Treatments and 2 blocks latinSquare Square Character Matrix (Optional) Square Numeric Matrix (n x n) Anova Table R-Squared/S Balanced Factorial Design; 1, 2 or 3 factors factor Numeric Scalar: 1, 2 or 3 Numeric Matrix Numeric Array Anova Table R-Squared/S If left arg=1, same as oneWay Random Factors  (2 random factors) factor Numeric Vector:   0 2 Numeric Array Anova Table R-Squared/S Mixed Factors (One Fixed, one random) factor Numeric Vector: 1 1 Numeric Array Anova Table R-Squared/S 2k   Factorial factorial2k None Vector of length 2*K Matrix (2*K),R Anova Table R-Squared/S Fractional 2k   Factorial factorial2k Alias - Character Vector Vector of length 2*K Matrix (2*K),R Anova Table R-Squared/S Nested Design; 2 or 3 factors; last factor nested within previous. nested Factor Names (Optional) Numeric Array Anova Table R-Squared/S

## One Way Anova

Suppose we wish examine three or more populations.    Our null hypothesis for three populations would be  H0

The alternative hypothesis would be that at least one of the populations has a different mean.   It would not be: , rather it would be:

In general the null hypothesis for three or more populations would be:

And the alternative hypothesis would be:        (The symbols ∀ and ∃ mean “for all” and “there exists” respectively).

A pharmaceutical company wants to investigate the effectiveness of a new drug.  A single-factor experiment was conducted with three dosage levels:  20, 30 and 40 grams.  Four replications were applied to each level.

`    G20←24 28 37 30  ⍝ Dosage = 20 grams; n1=4`
`    G30←37 44 31 35  ⍝ Dosage = 30 grams; n2=4 `
`    G40←42 47 52 38  ⍝ Dosage = 40 grams; n3=4`

`    NS←oneWay anova G20 G30 G40 `

`    NS.AnovaTable`
` SOURCE           SS  DF            MS           F              P `
` A       450.6666667   2  225.3333333   7.03555941  0.01446379777 `
` Error   288.25        9   32.02777778  0           0             `
` Total   738.9166667  11    0           0           0   `

`     NS.Means`
` Group  N  Mean       StdDev `
` 1      4 29.75  5.439056291 `
` 2      4 36.75  5.439056291 `
` 3      4 44.75  6.075908711`

If you want to label the levels, you can list the namespace followed by the variable names in quotes:

`      NS← oneWay anova ## 'G20 G30 G40'`
`      NS.Means`
` Group  N  Mean       StdDev `
` G20    4 29.75  5.439056291 `
` G30    4 36.75  5.439056291 `
` G40    4 44.75  6.075908711 `

A printable report consists of the anova table with R-Squared data, group means and confidence intervals, and a comparison between treatment means using the least significant difference method.

`report  NS`
`──────────────────────────────────────────────────────────────────────────────`
`  ANOVA Table                                                                                                           `
`                                                                                                                        `
`  SOURCE              SS    DF              MS         F         P  F(⍺=.05)                                            `
`  ------ --------------- ----- --------------- --------- --------- ---------                                            `
`  A               450.67     2          225.33      7.04   0.01446      4.26                                            `
`  Error           288.25     9           32.03                                                                          `
`  ------ --------------- ----- --------------- --------- ---------                                                      `
`  Total           738.92    11                                                                                          `

`  S =    5.65931  R-Sq =  60.99%  R-Sq(adj) =   52.32%                                                                  `

`  Group  N  Mean       StdDev                                                                                           `
`  G20    4 29.75  5.439056291                                                                                           `
`  G30    4 36.75  5.439056291                                                                                           `
`  G40    4 44.75  6.075908711                                                                                           `

` Confidence Interval                                                                                                    `

` 95% G20(23.349,36.151)       (------------*-----------)                                                                `
` 95% G30(30.349,43.151)                     (------------*-----------)                                                  `
` 95% G40(38.349,51.151)                                     (------------*-----------)                                  `
`                       +---------+---------+---------+---------+---------+---------+-`
`                                25        30        35        40        45        50        `
`                                                                                                                        `
`Treatment   Mean Difference  DF      SE        T      P    LSD                                                        `
`  G20 vs G30               ¯7   1  4.0017  ¯1.7492 0.1142 9.0526                                                        `
`  G20 vs G40              ¯15   1  4.0017  ¯3.7484 0.0046 9.0526                                                        `
`  G30 vs G40               ¯8   1  4.0017  ¯1.9991 0.0767 9.0526                                                        `
`─────────────────────────────────────────────────────────────────`

We would like to examine probabilities relating to two categorical variables: Sex and Political Party. There are two sexes: M=Male and F=Female; and three parties: D=Democrat, I=Independent and R=Republican. We first create a contingency table with row and column headings and populated with frequencies:

## The Randomized Complete Block Design

The randomized complete block design is an extension of the paired t-test to more than two groups.   We want to test whether four different tips produce different hardness readings on a machine.  The tips are pressed into a metal specimen and the depth of the impression is measured.    There is also some variation in the metal specimens.   To remove this excess variation, we test each of the four tips on each of four specimens.  The measurements are as follows:

 Tip Specimen  1 Specimen 2 Specimen 3 Specimen 4 1 9.3 9.4 9.6 10.0 2 9.4 9.3 9.8 9.9 3 9.2 9.4 9.5 9.7 4 9.7 9.6 10.0 10.2

The right argument for a randomized complete blocked design is a numeric matrix; the rows represent treatments and the columns represent blocks.

`      X←4 4⍴9.3 9.4 9.6 10 9.4 9.3 9.8 9.9 9.2 9.4 9.5 9.7 9.7 9.6 10 10.2`

`9.3 9.4  9.6 10  `
`9.4 9.3  9.8  9.9`
`9.2 9.4  9.5  9.7`
`9.7 9.6 10   10.2`

To generate a blocked design, we use the blocked operand:

`     report blocked anova X`
`───────────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                                   `
`                                                                               `
` SOURCE                  SS    DF              MS         F         P  F(⍺=.05)`
` ------     --------------- ----- --------------- --------- --------- ---------`
` Treatments          0.3850     3          0.1283     14.44   0.00087      3.86`
` Blocks              0.8250     3          0.2750                              `
` Error               0.0800     9          0.0089                              `
` ---------- --------------- ----- --------------- --------- ---------          `
` Total               1.2900    15                                              `

` S =    0.09428  R-Sq =  93.80%  R-Sq(adj) =   89.66%                          `
`───────────────────────────────────────────────────────────────────────────────`

## The Latin Square Design

When there are two extraneous sources of variation, we can using a special blocking design known as the Latin Square Design.    A Latin Square contains the same number of rows and columns, where each cell contains a letter designation, where each letter occurs once and only once in each row and column.   A cyclic Latin Square shifts each row by one letter.  An example of a 4 x 4 cyclic Latin square is:

`       LS←0 1 2 3 4⌽5 5⍴'ABCDE'`
`      `
`BCDEA`
`CDEAB`
`DEABC`
`EABCD`

The letters in a Latin Square represent the Treatments; the rows and columns are the blocks.  To use a Latin Square design in TamStat, set up the right argument as an N x N square matrix of measurements.   The left argument is a simple character matrix representing the Latin Square.  If the left argument is omitted, the default is a cyclic Latin Square of the same shape as the right argument.

Five different formulations of an explosive mixture used in dynamite are being studied. We label these A, B, C, D and E.  There are 5 batches of raw material and 5 operators.   25 experiments are conducted; each row represents a batch of raw material, while each column represents an operator.   The results of the experiment are:

`     X←5 5⍴24 20 19 24 24 17 24 30 27 36 18 38 26 27 21 26 31 26 23 22 22 30 20 29 31`

`     LS{⍺ '=' ⍵}¨X`
` A= 24  B= 20  C= 19  D= 24  E= 24 `
` B= 17  C= 24  D= 30  E= 27  A= 36 `
` C= 18  D= 38  E= 26  A= 27  B= 21 `
` D= 26  E= 31  A= 26  B= 23  C= 22 `
` E= 22  A= 30  B= 20  C= 29  D= 31 `

To generate an ANOVA table, use the latinSquare function

`     latinSquare X`
` Treatments  330  4 82.5        7.734375 0.02974249554`
` Rows         68  4 17          0        0            `
` Columns     150  4 37.5        0        0            `

` Error       128 12 10.66666667 0        0   `

To get a printable report, enter the following:

`report latinSquare anova X`
`───────────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                                   `

` SOURCE                  SS    DF              MS         F         P  F(⍺=.05)`
` ------     --------------- ----- --------------- --------- --------- ---------`
` Treatments          330.00     4           82.50      7.73   0.00254      3.26`
` Rows                 68.00     4           17.00                              `
` Columns             150.00     4           37.50                              `
` Error               128.00    12           10.67                              `
` ---------- --------------- ----- --------------- --------- ---------          `
` Total               676.00    24                                              `

` S =    3.26599  R-Sq =  81.07%  R-Sq(adj) =   62.13%                          `
`───────────────────────────────────────────────────────────────────────────────`

## Factorial Designs

When the effects of more than one factor are being studied, we can use a factorial design.  Factorial designs are most effective when they are balanced, i.e. each treatment combination has the same number of replications.   TamStat currently handles one, two and three-factor factorial designs.  One-factor designs are equivalent to using the oneWay operand except that the sample size for each level must be the same.  The right argument can be a matrix or higher-rank array.   The last dimension(s) are assumed to be replications.  The left argument is 1, 2 or 3, depending upon the number of factors.  Normally the rank of the right argument is one more that the left argument.  If the rank equals the right argument, then a factorial design with a single replicate is performed.  If the rank of the right argument minus the left argument is two or more, the trailing axes will be catenated together.

Material type and temperature can affect the maximum output voltage of a battery.  An experiment is conducted with three materials, three temperatures (50, 60 and 80 degrees F) ,and four replications.  The following are the results of the experiment:

`   X←130 155 74 180,34 40 80 75, 20 70 82 58`
`   X,←150 188 159 126, 136 122 106 115, 25 70 58 45`
`   X,←138 110 168 160, 174 120 150 139, 96 104 82 60`

`   X←3 3 4⍴X`

`   ('Material' 'Type1' 'Type2' 'Type3'),'50 deg F' '65 deg F' '80 deg F'⍪↓X`

` Material  50 deg F         65 deg F         80 deg F     `
` Type1     130 155 74 180   34 40 80 75      20 70 82 58  `
` Type2     150 188 159 126  136 122 106 115  25 70 58 45  `
` Type3     138 110 168 160  174 120 150 139  96 104 82 60 `

`     report 2 factor anova X`
`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                               `

` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` A               10,684     2           5,342      7.91   0.00198      3.35`
` B               39,119     2          19,559     28.97  <0.00001      3.35`
` AB               9,614     4           2,403      3.56   0.01861      2.73`
` Error           18,231    27             675                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total           77,647    35                                              `

` S =   25.98486  R-Sq =  76.52%  R-Sq(adj) =   69.56%                      `

`───────────────────────────────────────────────────────────────────────────  `

If you wish to label the factors, you can replace the “2” with a 2-item vector of factor names:

`      report 'Material' 'Temp' factor anova X`
`─────────────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                                     `

` SOURCE                    SS    DF              MS         F         P  F(⍺=.05)`
` ------       --------------- ----- --------------- --------- --------- ---------`
` Material              10,684     2           5,342      7.91   0.00198      3.35`
` Temp                  39,119     2          19,559     28.97  <0.00001      3.35`
` MaterialTemp           9,614     4           2,403      3.56   0.01861      2.73`
` Error                 18,231    27             675                              `
` ------------ --------------- ----- --------------- --------- ---------          `
` Total                 77,647    35                                              `

` S =   25.98486  R-Sq =  76.52%  R-Sq(adj) =   69.56%                            `
`─────────────────────────────────────────────────────────────────────────────────`

A soft drink bottler wants to obtain more uniform fill heights;  the factors of interest are (A) % carbonation, (B) operating pressure, and (C) line speed.   Carbonation levels are 10, 12 and 14%.   Pressure is at two levels:  25 and 30 psi.  And Line speed are 200 and 250 bottles per minute.  The fill heights are displayed below in row major order (negative heights are below target, positive heights are above target.)

`     Y←¯3 ¯1 ¯1 0 ¯1 0 1 1 0 1 2 1 2 3 6 5 5 4 7 6 7 9 10 11`

`     report 3 factor anova 3 2 2 2⍴Y`
`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                            `
` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` A               252.75     2          126.38    178.41  <0.00001      3.89`
` B                45.38     1           45.38     64.06  <0.00001      4.75`
` C                22.04     1           22.04     31.12   0.00012      4.75`
` AB                5.25     2            2.63      3.71   0.05581      3.89`
` AC                0.58     2            0.29      0.41   0.67149      3.89`
` BC                1.04     1            1.04      1.47   0.24859      4.75`
` ABC               1.08     2            0.54      0.76   0.48687      3.89`
` Error             8.50    12            0.71                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total           336.63    23                                              `
`                                                                           `
` S =    0.84163  R-Sq =  97.47%  R-Sq(adj) =   95.16%                      `
`───────────────────────────────────────────────────────────────────────────`

## Random and Mixed Models

When one or more of the factors are random, the calculation of the test statistics (F values) may not always use the mean square error (MSE).   In the random model, both factors are random.  In the mixed model, the first factor (A) is fixed, and the second factor (B) is random.   In both these models, we can still use the factor operand; however, the left argument is now a two-item vector consisting of the number of fixed factors followed by the number of random factors.

Using the battery voltage in the previous example, assume that material types and temperatures were randomly selected from a larger population.   Since both factors are random, the left argument is 0 2 indicating no fixed factors and 2 random factors:

`     report 0 2 factor anova X`
`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                               `

` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` A               10,684     2           5,342      2.22   0.22434      3.35`
` B               39,119     2          19,559      8.14   0.03892      3.35`
` AB               9,614     4           2,403      3.56   0.01861      2.73`
` Error           18,231    27             675                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total           77,647    35                                              `

` S =   25.98486  R-Sq =  76.52%  R-Sq(adj) =   69.56%                      `
`───────────────────────────────────────────────────────────────────────────`

Sometimes, one factor is fixed and the other is random.   In the previous example suppose that the materials  (A) are fixed, but the temperatures (B) are random.  The left argument would be 1 1:  one fixed factor followed by one random factor:

`     report 1 1 factor anova X`
`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                               `

` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` A               10,684     2           5,342      2.22   0.22434      3.35`
` B               39,119     2          19,559     28.97  <0.00001      3.35`
` AB               9,614     4           2,403      3.56   0.01861      2.73`
` Error           18,231    27             675                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total           77,647    35                                              `

` S =   25.98486  R-Sq =  76.52%  R-Sq(adj) =   69.56%   `

In this case, the statistics  FA=MSA /MSAB and  FB.= MSB /MSE  .

## 2*K Factorial Designs

When each factor has exactly two levels, there are no limits to the number of factors in TamStat.  The sum of squares calculations in   Factorial designs are much simpler.

Instead of creating a k-dimension array as required by the factor operand, the factorial2k operand allows us to use  a vector of shape 2*K or a matrix of shape (2*K),R where R is the number of replications.   Each item or row of the vector or matrix respectively corresponds to a particular treatment combination.  The treatment combinations must be in standard order.  Since there are only two levels for each factor – high(+) and low(-), each treatment combination can be described with a list of lower-case letters representing which factors are run at the higher level.   For example  (1) means all factors are set to the low level (-); a means that factor A is set to the high level and all the others are at the low level, ac means that factors A and C are at the high level and factor B (and any others)  are set at the low level. For a 2*3 factorial design, standard order is:

(1), a, b, ab, c, ac, ab, abc

The TamStat function standardOrder generates a list of treatment combinations in standard order.  The right argument is a list of factors set to the high (+) level.

`       standardOrder 'ab'          ⍝ Two factors `
` (1)  a  b  ab `

`standardOrder 'abc'         ⍝ Three factors `
` (1)  a  b  ab  c  ac  bc  abc `
`      standardOrder 'abcd'         ⍝ Four factors `
` (1)  a  b  ab  c  ac  bc  abc  d  ad  bd  abd  cd  acd  bcd  abcd`

Note that the first four items of  three factors and four factors are the same as two factors.

The effects are indicated with capital letters, e.g.    A is the main effect for factor A, AB is the interaction effect.   I represents the sum of al treatment combinations.  To show the relationship between treatment combinations and effects for a 3-factor factorial design, use the hadamard function.

`     hadamard show 3`
`     I A  B  AB  C  AC  BC  ABC `
` (1) + -  -  +   -  +   +   -   `
` a   + +  -  -   -  -   +   +   `
` b   + -  +  -   -  +   -   +   `
` ab  + +  +  +   -  -   -   -   `
` c   + -  -  +   +  -   -   +   `
` ac  + +  -  -   +  +   -   -   `
` bc  + -  +  -   +  -   +   -   `
` abc + +  +  +   +  +   +   +   `

In the fill volume example in the previous section, suppose only two levels are carbonation  10% and 12% are used.  This would make this a 2*3 factorial design.   Arranging the data in standard order (in columns to save space):

 Replicate (1) a b ab c ac bc abc 1 -3 0 -1 2 -1 2 1 6 2 -1 1 0 3 0 1 1 5

`     X←8 2⍴¯3 ¯1 0 1 ¯1 0 2 3 ¯1 0 2 1 1 1 6 5 ⍝ Rows = treatment combinations`

`     report   factorial2k anova X `
`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                               `

` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` A               36.000     1          36.000     57.60   0.00006      5.32`
` B               20.250     1          20.250     32.40   0.00046      5.32`
` C               12.250     1          12.250     19.60   0.00221      5.32`
` AB               2.250     1           2.250      3.60   0.09435      5.32`
` AC               0.250     1           0.250      0.40   0.54474      5.32`
` BC               1.000     1           1.000      1.60   0.24150      5.32`
` ABC              1.000     1           1.000      1.60   0.24150      5.32`
` Error            5.000     8           0.625                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total           78.000    15   `

Here we see that the three main effects are significant, but none of the interactions are.

### A Single Repliccation of a 2*K Design

When there are a large number of factors, the number of replications is limited and in many cases only a single replication is necessary.   A factorial experiment is conducted to study the factors affecting the filtration rate of a chemical product.  The four factors are (A) temperature (B) pressure, (C) reactant concentration, and (D) stir rate The results of the single-replicate experiment are shown in the following table:

 Filtration Data from Experiment C0 C1 D0 D1 D0 D1 A0 B0 45 43 68 75 B1 48 45 80 70 A1 B0 71 100 60 86 B1 65 104 65 96

In the above chart A0 is the lower level and A1 is the upper level of factor A.    For example, the treatment combination  ac = 60 and the treatment combination d = 43.      When there is a single replicate, we use a vector of length 2*K.     Since standard order is not the same as row major order used in factorial designs, it can be tedious to construct a vector in standard order from the above table.    We would start with (1), a, b ab, …   Note that (1)  = 45     a = 71,     b= 48,  and ab = 65.     These values are scattered in the above table.   Since there is a single replicate, we can enter the data in vector format.  Let’s enter them directly from the table in row major order

`      FiltrationRate←45 43 68 75 48 45 80 70 71 100 60 86 65 104 65 96`

We can easily convert the data to standard order using  the following utility.   Note that the first four items match the treatment combinations (1), a, b, and ab respectively:

`X←rowmajor2std`` FiltrationRate`
`45 71 48 65 68 60 80 65 43 100 45 104 75 86 70 96`

The following shows all the treatment combinations and the results of each in standard order:

`     ↑(standardOrder 'abcd')X `
` (1)   a   b  ab   c  ac  bc  abc   d   ad  bd  abd  cd  acd  bcd  abcd `
`  45  71  48  65  68  60  80   65  43  100  45  104  75   86   70    96`

We are now ready to perform the analysis of variance:

`    report factorial2k anova X`

`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                               `

` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` A              1,870.6     1         1,870.6     73.18   0.00036      6.61`
` B                 39.1     1            39.1      1.53   0.27130      6.61`
` C                390.1     1           390.1     15.26   0.01134      6.61`
` D                855.6     1           855.6     33.47   0.00217      6.61`
` AB                 0.1     1             0.1             0.96248      6.61`
` AC             1,314.1     1         1,314.1     51.41   0.00082      6.61`
` AD             1,105.6     1         1,105.6     43.25   0.00122      6.61`
` BC                22.6     1            22.6      0.88   0.39061      6.61`
` BD                 0.6     1             0.6      0.02   0.88787      6.61`
` CD                 5.1     1             5.1      0.20   0.67491      6.61`
` Error            127.8     5            25.6                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total          5,730.9    15                                              `

` S =    5.05594  R-Sq =  97.77%  R-Sq(adj) =   93.31%                      `
`───────────────────────────────────────────────────────────────────────────`

The results show that main effects A, C and D and  interactions AC and AD are significant.

### Fractional Factorial Designs

A fractional factorial design allows one to ignore high-order interactions and concentrate on main effects and two-factor interactions.    In particular main effects are confounded with high order interactions, This results in running fewer experiments; e.g. a one-half fractional factorial design requires half the experiments as a full factorial.      To accomplish this, we need to create an alias structure.   The alias is determined by generators which equal the identity element I.   To analyze a fractional factorial design in TamStat, simply provide  the generator) as the optional left argument.  In the previous example, we had 16 runs.   A ½ fractional factorial design will let us use only 8 runs.   We will use I=ABCD as the defining relation, so the generator is simply ABCD.

`    report   'ABCD' factorial2k anova 45 100 45 65 75 60 80 96`
`──────────────────────────────────────────────────────────────────────────────`
` Fractional Factorial Design                                                             `

`  Variable  Alias  Contrast  Effect     SS     Pct                                       `
`  [A]       A+BCD        76    19    722    23.506                                       `
`  [B]       B+ACD         6     1.5    4.5   0.147                                       `
`  [C]       C+ABD        56    14    392    12.762                                       `
`  [D]       D+ABC        66    16.5  544.5  17.727                                       `
`  [AB]      AB+CD        ¯4    ¯1      2     0.065                                       `
`  [AC]      AC+BD       ¯74   ¯18.5  684.5  22.286                                       `
`  [BC]      BC+AD        76    19    722    23.506                                       `

` Normal Probability Plot                                                                 `
`           │                                                                             `
`           │                                                                             `
`           │                                                                             `
`           │                                                                             `
`          2┤                                                                             `
`           │                                                                             `
`           │                                                                             `
`           │                                       *                                     `
`           │                                                                             `
`          1┤                                                                             `
`           │                                       *                                     `
`           │                                                                             `
`           │                                     *                                       `
`           │                                                                             `
`          0┤                                  *                                          `
`           │                                                                             `
`           │                      *                                                      `
`           │                                                                             `
`           │                   *                                                         `
`         ¯1┤                                                                             `
`           │                                                                             `
`           │  *                                                                          `
`           │                                                                             `
`           │                                                                             `
`         ¯2┼─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬       `
`         ¯20       ¯10         0        10        20        30        40          `

`  ────────────────────────────────────────────────────────────────────────────`

Notice that the TamStat output is somewhat different.   Fractional factorial designs usually contain a single replicate so it is not possible to generate a traditional ANOVA table until we can determine which effects are significant and which are not.   The normal probability plot may give some clues as to which effects are significant.

Parts manufactured in an injection molding process show excessive shrinkage, which causes problems in assembly operations downstream. A designed experiment to reduce shrinkage involves 6 factors:—mold temperature A, screw speed B, holding time C, cycle time D, gate size E, and holding pressure F—each at two levels:

 Run A B C D E=ABC F=BCD Shrinkage x 10 1 - - - - - - 6 (1) 2 + - - - + - 10 ae 3 - + - + + + 32 bef 4 + + - - - + 60 abf 5 - - + - + + 4 cef 6 + - + - - + 15 acf 7 - + + - - - 26 bc 8 + + + - + - 60 abce 9 - - - + - + 8 df 10 + - - + + + 12 adef 11 - + - + + - 34 bde 12 + + - + - - 60 abd 13 - - + + + - 16 cde 14 + - + + - - 5 acd 15 - + + + - + 37 bcdf 16 + + + + + + 52 abcdef

`X ← 6 10 32 60 4 15 26 60 8 12 34 60 16 5 37 52`

`     report 'ABCE' 'BCDF' factorial2k anova X `

`──────────────────────────────────────────────────────────────────────────────`
` Fractional Factorial Design                                                             `
`                                                                                         `
`  Variable  Alias            Contrast  Effect        SS     Pct                          `
`  [A]       A+BCE+DEF+ABCDF       111  13.875   770.063  11.563                          `
`  [B]       B+ACE+CDF+ABDEF       285  35.625  5076.563  76.231                          `
`  [C]       C+ABE+BDF+ACDEF        ¯7  ¯0.875     3.063   0.046                          `
`  [D]       D+BCF+AEF+ABCDE        11   1.375     7.563   0.114                          `
`  [E]       E+ABC+ADF+BCDEF         3   0.375     0.563   0.008                          `
`  [F]       F+BCD+ADE+ABCEF         3   0.375     0.563   0.008                          `
`  [AB]      AB+CE+ACDF+BDEF        95  11.875   564.063   8.47                           `
`  [AC]      AC+BE+ABDF+CDEF       ¯13  ¯1.625    10.563   0.159                          `
`  [AD]      AD+EF+BCDE+ABCF       ¯43  ¯5.375   115.563   1.735                          `
`  [BC]      BC+AE+DF+ABCDEF       ¯15  ¯1.875    14.063   0.211                          `
`  [BD]      BD+CF+ACDE+ABEF        ¯1  ¯0.125     0.063   0.001                          `
`  [CD]      CD+BF+ABDE+ACEF        ¯1  ¯0.125     0.063   0.001                          `
`  [DE]      DE+AF+ABCD+BCEF         5   0.625     1.563   0.023                          `
`  [ABD]     ABD+CDE+ACF+BEF         1   0.125     0.063   0.001                          `
`  [ACD]     ACD+BDE+ABF+CEF       ¯39  ¯4.875    95.063   1.427                          `
`                                                                                         `
`Normal Probability Plot                                                                 `
`           │                                                                             `
`           │                                                                             `
`           │                                                                             `
`           │                                                                             `
`          2┤                                                                             `
`           │                                              *                              `
`           │                                                                             `
`           │                                                                             `
`           │                        *                                                    `
`          1┤                      *                                                      `
`           │           *                                                                 `
`           │           *                                                                 `
`           │          *                                                                  `
`           │          *                                                                  `
`          0┤          *                                                                  `
`           │          *                                                                  `
`           │          *                                                                  `
`           │         *                                                                   `
`           │        *                                                                    `
`         ¯1┤        *                                                                    `
`           │     *                                                                       `
`           │                                                                             `
`           │                                                                             `
`           │     *                                                                       `
`         ¯2┼─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬       `
`         ¯10         0        10        20        30        40        50  `

## Nested Designs

In nested designs, the levels of one factor are dependent upon another factor.  For example.  A company buys supplies from three different suppliers.  Four batches of raw material are randomly selected from each supplier, and three measurements(replications)  are taken on each batch.   The Suppliers represent factorA.   The batches represent factor B; however, there is no relationship between the batches for the first supplier and the other suppliers. The data are listed below:

 Supplier 1 2 3 Batches 1 2 3 4 5 6 7 8 9 10 11 12 Data 94 91 91 94 94 93 92 93 95 91 94 96 92 90 93 97 91 97 93 96 97 93 92 95 93 89 94 93 90 95 91 95 93 95 95 94

`    X2←94 92 93 91 90 89 91 93 94 94 97 93    ⍝ Supplier 1`
`    X2,←94 91 90 93 97 95 92 93 91 93 96 95   ⍝ Supplier 2`
`    X2,←95 97 93 91 93 95 94 92 95 96 95 94   ⍝ Supplier 3`

`       report nested anova 3 4 3⍴X2`
`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                               `

` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` A                15.06     2            7.53      0.97   0.41578      3.40`
` B(A)             69.92     9            7.77      2.94   0.01667      2.30`
` Error            63.33    24            2.64                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total           148.31    35                                              `
`                                                                           `
` S =    1.62447  R-Sq =  57.30%  R-Sq(adj) =   37.72%                      `
`─────────────────────────────────────────────────────────────────────────── `

`Notice that since B is nested within A we use the notation B(A) to represent the batches within supplier. `

`In the next example, we have three factors, and the third factor is nested within the second factor.`

An industrial engineer is trying to increase the assembly speed of electronic components.   He is looking at three assembly fixes and two workplace layouts.    Since the workplaces are in different locations, he cannot use the same operators, so operators are nested within workplace layouts.  There are four operators assigned to each treatment combination.

 `Layout 1` `Layout 2` `Operator` `1` `2` `3` `4` `5` `6` `7` `8` `Fixture 1` `22` `23` `28` `25` `26` `27` `28` `24` `24` `24` `29` `23` `28` `25` `25` `23` `Fixture 2` `30` `29` `30` `27` `29` `30` `24` `28` `27` `28` `32` `25` `28` `27` `23` `30` `Fixture 3` `25` `24` `27` `26` `27` `26` `24` `28` `21` `22` `25` `23` `25` `24` `27` `27`

`    X3←22 24 23 24 28 29 25 23 26 28 27 25 28 25 24 23`
`    X3,←30 27 29 28 30 32 27 25 29 28 30 27 24 23 28 30`
`    X3,←25 21 24 22 27 25 26 23 27 25 26 24 24 27 28 27`

`               report 'FLO' nested anova 3 2 4 2⍴X3`
`───────────────────────────────────────────────────────────────────────────`
` ANOVA Table                                                               `
`                                                                           `
` SOURCE              SS    DF              MS         F         P  F(⍺=.05)`
` ------ --------------- ----- --------------- --------- --------- ---------`
` F                82.79     2           41.40      7.55   0.00755      3.40`
` L                 4.08     1            4.08      0.34   0.58070      4.26`
` O(L)             71.92     6           11.99      5.14   0.00161      2.51`
` FL               19.04     2            9.52      1.74   0.21777      3.40`
` FO(L)            65.83    12            5.49      2.35   0.03604      2.18`
` Error            56.00    24            2.33                              `
` ------ --------------- ----- --------------- --------- ---------          `
` Total           299.67    47                                              `

` S =    1.52753  R-Sq =  81.31%  R-Sq(adj) =   63.40%                      `
`───────────────────────────────────────────────────────────────────────────`

`Observe that the left argument to nested can override the standard A, B, C levels,   We are using F to represent Fixture, L to represent Layout and O to represent Operator.    `