Problem 1

There are three factors:

Ammonium: 2 levels, 2% and 30%; Stir Rate: 2 levels, 100 RPM and 150 RPM; Temperature: 2 levels, 8°C and 40°C

N=2*2*2*2=16

(a)

The full factorial model is

\[Y_{ijkl} = \mu+\alpha_i+\beta_j+\gamma_k +(\alpha\beta)_{ij} +(\alpha\gamma)_{ik} +(\beta\gamma)_{jk} +(\alpha\beta\gamma)_{ijk} +\epsilon_{ijkl}\]

where

\(\alpha_i\) = Ammonium effect

\(\beta_j\) = Stir Rate effect

\(\gamma_k\) = Temperature effect

\((\alpha\beta)_{ij}\) = Ammonium & Stir Rate interaction

\((\alpha\gamma)_{ik}\) = Ammonium & Temperature interaction

\((\beta\gamma)_{jk}\) = Stir Rate & Temperature interaction

\((\alpha\beta\gamma)_{ijk}\) = three-factor interaction

(b)

For three-factor interaction effec

library(GAD)

Ammonium <- c(2,2,30,30,2,2,30,30,2,2,30,30,2,2,30,30)

StirRate <- c(100,100,100,100,150,150,150,150,100,100,100,100,150,150,150,150)

Temperature <- c(8,8,8,8,8,8,8,8,40,40,40,40,40,40,40,40)

Density <- c(14.68,15.18,15.12,17.48,7.54,6.66,12.46,12.62,10.95,17.68,12.65,15.96,8.03,8.84,14.96,14.96)

Ammonium <- as.fixed(Ammonium)
StirRate <- as.fixed(StirRate)
Temperature <- as.fixed(Temperature)

model<- aov(Density ~ Ammonium * StirRate * Temperature
)

gad(model)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                               Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammonium                       1 44.389  44.389 11.1803 0.010175 * 
## StirRate                       1 70.686  70.686 17.8037 0.002918 **
## Temperature                    1  0.328   0.328  0.0826 0.781170   
## Ammonium:StirRate              1 28.117  28.117  7.0817 0.028754 * 
## Ammonium:Temperature           1  0.022   0.022  0.0055 0.942808   
## StirRate:Temperature           1 10.128  10.128  2.5510 0.148890   
## Ammonium:StirRate:Temperature  1  1.519   1.519  0.3826 0.553412   
## Residuals                      8 31.762   3.970                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Since pABC=0.553412>0.05,we fail to reject H0. Therefore, the three-factor interaction is not significant and is removed from the model.

For Ammonium & Stir Rate, Ammonium & Temperature, Stir Rate & Temperature interaction effect.

model.2 <- aov(
  Density ~ Ammonium + StirRate + Temperature +
    Ammonium:StirRate +
    Ammonium:Temperature +
    StirRate:Temperature)

gad(model.2)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                      Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammonium              1 44.389  44.389 12.0037 0.007109 **
## StirRate              1 70.686  70.686 19.1150 0.001792 **
## Temperature           1  0.328   0.328  0.0886 0.772681   
## Ammonium:StirRate     1 28.117  28.117  7.6033 0.022206 * 
## Ammonium:Temperature  1  0.022   0.022  0.0059 0.940538   
## StirRate:Temperature  1 10.128  10.128  2.7389 0.132317   
## Residuals             9 33.281   3.698                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

For Ammonium & Stir Rate p= 0.022206; for Ammonium & Temperature p=0.940538; for Stir Rate & Temperature p=0.132317. Since the least significant interaction is Ammonium × Temperature, so it is removed.

For Ammonium & Stir Rate, Stir Rate & Temperature interaction effect.

model.3 <- aov(
  Density ~ Ammonium + StirRate + Temperature +
    Ammonium:StirRate +
    StirRate:Temperature)

gad(model.3)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                      Df Sum Sq Mean Sq F value    Pr(>F)    
## Ammonium              1 44.389  44.389 13.3287 0.0044560 ** 
## StirRate              1 70.686  70.686 21.2250 0.0009696 ***
## Temperature           1  0.328   0.328  0.0984 0.7601850    
## Ammonium:StirRate     1 28.117  28.117  8.4426 0.0156821 *  
## StirRate:Temperature  1 10.128  10.128  3.0412 0.1117751    
## Residuals            10 33.303   3.330                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

For Ammonium × Stir Rate: p=0.0156821, For Stir Rate × Temperature: p=0.1117751. Since Stir Rate × Temperature is not significant, so it is removed.

For Ammonium & Stir Rate interaction effect.

model.4 <- aov(
  Density ~ Ammonium * StirRate + Temperature
)
gad(model.4)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                   Df Sum Sq Mean Sq F value   Pr(>F)   
## Ammonium           1 44.389  44.389 11.2425 0.006443 **
## StirRate           1 70.686  70.686 17.9028 0.001410 **
## Temperature        1  0.328   0.328  0.0830 0.778613   
## Ammonium:StirRate  1 28.117  28.117  7.1211 0.021851 * 
## Residuals         11 43.431   3.948                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The Ammonium × Stir Rate interaction is significant because p=0.021851 less than 0.05. Therefore, the effects of Ammonium and Stir Rate should not be interpreted independently. Temperature is not involved in a significant interaction and is not significant itself, so it can be removed.

The final hierarchical model is

\[Y = \mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+\epsilon\]

model.final <- aov(
  Density ~ Ammonium * StirRate
)

GAD::gad(model.final)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                   Df Sum Sq Mean Sq F value    Pr(>F)    
## Ammonium           1 44.389  44.389 12.1727 0.0044721 ** 
## StirRate           1 70.686  70.686 19.3841 0.0008612 ***
## Ammonium:StirRate  1 28.117  28.117  7.7103 0.0167511 *  
## Residuals         12 43.759   3.647                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The final p-values are p Ammonium=0.0044721; p StirRate=0.0008612; p Ammonium & StirRate=0.0167511. Therefore the significant terms in the final model are Ammonium, Stir Rate, and the Ammonium × Stir Rate interaction. Because the interaction is significant, the main effects of Ammonium and Stir Rate should not be interpreted separately. Instead, the interaction should be examined.

Interaction plot

interaction.plot(
  x.factor = StirRate,
  trace.factor = Ammonium,
  response = Density,
  xlab = "Stir Rate (RPM)",
  ylab = "Mean Density",
  trace.label = "Ammonium (%)"
)

A significant interaction exists between Ammonium and Stir Rate. The effect of increasing Stir Rate from 100 RPM to 150 RPM depends on the Ammonium level. At 2% Ammonium, density decreases substantially, while at 30% Ammonium, the decrease is much smaller.

Problem 2

There are two factors: Position: 2 levels Temperature: 3 levels, 800°C, 825°C, and 850°C

The factorial model is

\[Y_{ijk} = \mu+\alpha_i+\beta_j+(\alpha\beta)_{ij} +\epsilon_{ijk}\]

(a)

Position <- c(rep(1, 9),rep(2, 9))

Temperature <- rep(c(rep(800,3), rep(825,3), rep(850,3)), 2)

Density <- c(570,565,583,1063,1080,1043,565,510,590,528,547,521,988,1026,1004,526,538,532)

Position <- as.fixed(Position)
Temperature <- as.fixed(Temperature)

model.fixed <- aov(Density ~ Position * Temperature)
gad(model.fixed)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                      Df Sum Sq Mean Sq  F value   Pr(>F)    
## Position              1   7160    7160   15.998 0.001762 ** 
## Temperature           2 945342  472671 1056.117 3.25e-14 ***
## Position:Temperature  2    818     409    0.914 0.427110    
## Residuals            12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Since pAB=0.427110>0.05, the interaction is not significant; since pA=0.001762<0.05 and pB<0.05, both Position and Temperature are significant.

(b)

Position <- as.random(Position)
Temperature <- as.random(Temperature)

model.random <- aov(
  Density ~ Position * Temperature
)

gad(model.random)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                      Df Sum Sq Mean Sq  F value    Pr(>F)    
## Position              1   7160    7160   17.504 0.0526583 .  
## Temperature           2 945342  472671 1155.518 0.0008647 ***
## Position:Temperature  2    818     409    0.914 0.4271101    
## Residuals            12   5371     448                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Since pAB=0.4271101>0.05, the Position & Temperature interaction is not significant; since pA=0.0526583>0.05, Position is not significant; since pB=0.0008647<0.05, Temperature is significant.

(c)

Position <- as.fixed(Position)
Temperature <- as.random(Temperature)

model.mixed <- aov(
  Density ~ Position * Temperature
)

gad(model.mixed)
## $anova
## Analysis of Variance Table
## 
## Response: Density
##                      Df Sum Sq Mean Sq  F value   Pr(>F)    
## Position              1   7160    7160   17.504  0.05266 .  
## Temperature           2 945342  472671 1056.117 3.25e-14 ***
## Position:Temperature  2    818     409    0.914  0.42711    
## Residuals            12   5371     448                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Since pAB=0.42711>0.05, the Position × Temperature interaction is not significant; since pA=0.05266>0.05, Position is not significant; since pB<0.05, Temperature is significant.

(d)

The sums of squares and mean squares are the same for all three models because the data are unchanged. However, the F-tests differ because the appropriate denominator depends on whether the factors are fixed or random. As a result, Position is significant in the fixed-fixed model, but not significant when Temperature is treated as random. Temperature remains significant, and the interaction remains not significant in all three cases.