# Balanced Multi-Way Mixed-Effect Model

## Unrestricted Model

### Setup

Do StatANOVA Balanced ANOVA:

#### Session Output

```ANOVA: drop versus temperature, pressure, speed

Factor       Type    Levels  Values
temperature  fixed        3  60, 75, 90
pressure     random       3  50, 75, 85
speed        random       4  150, 200, 225, 300

Analysis of Variance for drop

Source                      DF       SS      MS      F      P
temperature                  2  1023.36  511.68   2.30  0.171 x
pressure                     2     7.19    3.60   0.06  0.938 x
speed                        3   423.82  141.27   0.63  0.616 x
temperature*pressure         4   137.89   34.47   2.49  0.099
temperature*speed            6  1211.97  202.00  14.59  0.000
pressure*speed               6   209.47   34.91   2.52  0.081
temperature*pressure*speed  12   166.11   13.84   0.65  0.788
Error                       36   770.50   21.40
Total                       71  3950.32

x Not an exact F-test.

S = 4.62631   R-Sq = 80.50%   R-Sq(adj) = 61.53%

Expected Mean Square for Each
Variance  Error  Term (using unrestricted
Source                     component   term  model)
1 temperature                               *  (8) + 2 (7) + 6 (5) + 8 (4) +
Q[1]
2 pressure                      -2.164      *  (8) + 2 (7) + 6 (6) + 8 (4) +
24 (2)
3 speed                         -4.544      *  (8) + 2 (7) + 6 (6) + 6 (5) +
18 (3)
4 temperature*pressure           2.579      7  (8) + 2 (7) + 8 (4)
5 temperature*speed             31.359      7  (8) + 2 (7) + 6 (5)
6 pressure*speed                 3.512      7  (8) + 2 (7) + 6 (6)
7 temperature*pressure*speed    -3.780      8  (8) + 2 (7)
8 Error                         21.403         (8)

* Synthesized Test.

Error Terms for Synthesized Tests

Synthesis of
Source         Error DF  Error MS  Error MS
1 temperature      6.97    222.63  (4) + (5) - (7)
2 pressure         5.98     55.54  (4) + (6) - (7)
3 speed            7.09    223.06  (5) + (6) - (7)

Means

temperature   N     drop
60           24  -2.6250
75           24   5.6667
90           24  -2.0000
```

The following R session shows an example of approx F test using Satterthwaite approximation. The same can be accomplished in MINITAB using CalcCalculator and CalcProbability Distributions. Note that all calculations are based on the above MINITAB outputs (with MS's already rounded off). The example shows the approx F test for the fixed effect `temp`. The result is quite comparable to the reported F and P value in MINITAB output.

#### R Session Output

```> MS <- c(A=511.68, AB=34.47, AC=202.00, ABC=13.84)
> DF <- c(A=2, AB=2*2, AC=2*3, ABC=2*2*3)
> dof <- function(ms, d) sum(ms)^2 / sum(ms^2/d)
> dof(MS[c("A","ABC")], DF[c("A","ABC")]) -> r1
> r1   # numerator d.o.f.
[1] 2.109399
> r2 <- dof(MS[c("AB","AC")], DF[c("AB","AC")])
> r2   # denominator d.o.f.
[1] 7.878322
> FA <- sum(MS[c("A","ABC")]) / sum(MS[c("AB","AC")])
> FA   # approx F statistic
[1] 2.222354
> pf(FA, r1, r2, lower=FALSE)   # P-val using approx F
[1] 0.1708550
```

## Restricted Model

### Setup

Do as in unrestricted model except for `Options`. Click `Options` button and select Restricted Model:

#### Session Output

```ANOVA: drop versus temperature, pressure, speed

Factor       Type    Levels  Values
temperature  fixed        3  60, 75, 90
pressure     random       3  50, 75, 85
speed        random       4  150, 200, 225, 300

Analysis of Variance for drop

Source                      DF       SS      MS      F      P
temperature                  2  1023.36  511.68   2.30  0.171 x
pressure                     2     7.19    3.60   0.10  0.904
speed                        3   423.82  141.27   4.05  0.069
temperature*pressure         4   137.89   34.47   2.49  0.099
temperature*speed            6  1211.97  202.00  14.59  0.000
pressure*speed               6   209.47   34.91   1.63  0.167
temperature*pressure*speed  12   166.11   13.84   0.65  0.788
Error                       36   770.50   21.40
Total                       71  3950.32

x Not an exact F-test.

S = 4.62631   R-Sq = 80.50%   R-Sq(adj) = 61.53%

Variance  Error  Expected Mean Square for Each
Source                      component   term  Term (using restricted model)
1  temperature                                *  (8) + 2 (7) + 6 (5) + 8 (4) +
24 Q[1]
2  pressure                       -1.305      6  (8) + 6 (6) + 24 (2)
3  speed                           5.909      6  (8) + 6 (6) + 18 (3)
4  temperature*pressure            2.579      7  (8) + 2 (7) + 8 (4)
5  temperature*speed              31.359      7  (8) + 2 (7) + 6 (5)
6  pressure*speed                  2.252      8  (8) + 6 (6)
7  temperature*pressure*speed     -3.780      8  (8) + 2 (7)
8  Error                          21.403         (8)

* Synthesized Test.

Error Terms for Synthesized Tests
Synthesis of
Source         Error DF  Error MS  Error MS
1 temperature      6.97    222.63  (4) + (5) - (7)

Means

temperature   N     drop
60           24  -2.6250
75           24   5.6667
90           24  -2.0000
```