# Two-Way Mixed-Effect Model

### Auto Assembly Example

Assume that there are three methods of assembly of a transmission in an automobile assembly plant. A random sample of machine operators is taken from a large pool of operators and each operator is observed with each method of assembly twice in a completely crossed experiment. The response is the output of production.

#### Program Listing

```OPTIONS LS=72 NODATE NONUMBER NOCENTER;

DATA auto (DROP=rep);
DO assembly = 1 TO 3;   /* 3 assembly methods (fixed) */
DO operator = 1 TO 4;  /* 4 operators (random) */
DO rep = 1 TO 2;      /* 2 replicates */
INPUT prod @@;
OUTPUT;
END;
END;
END;
DATALINES;
21 23   26 25   14 17   24 27
30 27   27 26   19 24   33 31
24 18   19 22   18 23   26 21
;

TITLE1 'Two-Way Mixed-Effect Model';
TITLE2 'Auto Assembly Example';
PROC GLM DATA=auto;
TITLE3 'ANOVA Table';
CLASS assembly operator;
MODEL prod = assembly operator assembly*operator;
RANDOM operator assembly*operator / TEST;
RUN;
TITLE3 'Hypothesis Test';
TEST H=assembly    E=assembly*operator;
RUN;
TITLE3 'Least Square Means';
LSMEANS assembly/PDIFF E=assembly*operator;
RUN;
TITLE3 'Treatment Means';
MEANS assembly/LSD E=assembly*operator;
RUN;
QUIT;
```

#### Output Listing

```Two-Way Mixed-Effect Model
Auto Assembly Example
ANOVA Table

The GLM Procedure

Class Level Information

Class         Levels    Values
assembly           3    1 2 3
operator           4    1 2 3 4

Number of Observations Used          24
Two-Way Mixed-Effect Model
Auto Assembly Example
ANOVA Table

The GLM Procedure

Dependent Variable: prod
Sum of
Source                     DF        Squares    Mean Square   F Value
Model                      11    417.4583333     37.9507576      5.80
Error                      12     78.5000000      6.5416667
Corrected Total            23    495.9583333

Source                 Pr > F
Model                  0.0026
Error

Corrected Total

R-Square     Coeff Var      Root MSE     prod Mean
0.841721      10.86443      2.557668      23.54167

Source                     DF      Type I SS    Mean Square   F Value
assembly                    2    156.3333333     78.1666667     11.95
operator                    3    189.4583333     63.1527778      9.65
assembly*operator           6     71.6666667     11.9444444      1.83

Source                 Pr > F
assembly               0.0014
operator               0.0016
assembly*operator      0.1764

Source                     DF    Type III SS    Mean Square   F Value
assembly                    2    156.3333333     78.1666667     11.95
operator                    3    189.4583333     63.1527778      9.65
assembly*operator           6     71.6666667     11.9444444      1.83

Source                 Pr > F
assembly               0.0014
operator               0.0016
assembly*operator      0.1764

Two-Way Mixed-Effect Model
Auto Assembly Example
ANOVA Table

The GLM Procedure

Source                Type III Expected Mean Square
assembly              Var(Error) + 2 Var(assembly*operator) +
Q(assembly)
operator              Var(Error) + 2 Var(assembly*operator) + 6
Var(operator)
assembly*operator     Var(Error) + 2 Var(assembly*operator)

Two-Way Mixed-Effect Model
Auto Assembly Example
ANOVA Table

The GLM Procedure
Tests of Hypotheses for Mixed Model Analysis of Variance

Dependent Variable: prod
Source                     DF    Type III SS    Mean Square   F Value
assembly                    2     156.333333      78.166667      6.54
operator                    3     189.458333      63.152778      5.29
Error                       6      71.666667      11.944444
Error: MS(assembly*operator)

Source                 Pr > F
assembly               0.0311
operator               0.0403
Error
Error: MS(assembly*operator)

Source                     DF    Type III SS    Mean Square   F Value
assembly*operator           6      71.666667      11.944444      1.83
Error: MS(Error)           12      78.500000       6.541667
Source                 Pr > F
assembly*operator      0.1764
Error: MS(Error)

Two-Way Mixed-Effect Model
Auto Assembly Example
Hypothesis Test

Dependent Variable: prod

Tests of Hypotheses Using the Type III MS
for assembly*operator as an Error Term

Source                     DF    Type III SS    Mean Square   F Value
assembly                    2    156.3333333     78.1666667      6.54

Tests of Hypotheses Using the
Type III MS for
assembly*operator
as an Error Term

Source                 Pr > F
assembly               0.0311

Two-Way Mixed-Effect Model
Auto Assembly Example
Least Square Means

Least Squares Means
Standard Errors and Probabilities Calculated Using the Type III MS for
assembly*operator as an Error Term
LSMEAN
assembly     prod LSMEAN      Number
1             22.1250000           1
2             27.1250000           2
3             21.3750000           3

Least Squares Means for effect assembly
Pr > |t| for H0: LSMean(i)=LSMean(j)

Dependent Variable: prod
i/j              1             2             3
1                      0.0276        0.6794
2        0.0276                      0.0159
3        0.6794        0.0159

NOTE: To ensure overall protection level, only probabilities associated
with pre-planned comparisons should be used.

Two-Way Mixed-Effect Model
Auto Assembly Example
Treatment Means

t Tests (LSD) for prod

NOTE: This test controls the Type I comparisonwise error rate, not the
experimentwise error rate.

Alpha                            0.05
Error Degrees of Freedom            6
Error Mean Square            11.94444
Critical Value of t           2.44691
Least Significant Difference   4.2284

Means with the same letter are not significantly different.

t

G
r
o
u
p
i
n
g          Mean      N    assembly

A        27.125      8    2

B        22.125      8    1
B
B        21.375      8    3
```