Problem 1. Silver Powder Density (Quality Progress, May 2011)
Factors (all fixed): Ammonium (2 levels), Stir (2), Temp (2)
Replicated 2 times (2 reps per cell) => 2x2x2x2 = 16 runs
Response: Density (g/cm^2)
Full factorial fixed-effects model
library(GAD)
Ammonium <- c(2,2,30,30, 2,2,30,30, 2,2,30,30, 2,2,30,30)
Stir <- c(100,100,100,100, 150,150,150,150, 100,100,100,100, 150,150,150,150)
Temp <- 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
)
data <- data.frame(Ammonium, Stir, Temp, Density)
# --- Convert factors
Ammonium <- as.fixed(Ammonium)
Stir <- as.fixed(Stir)
Temp <- as.fixed(Temp)
# --- Model
model <- aov(Density ~ Ammonium*Stir*Temp)
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 *
## Stir 1 70.686 70.686 17.8037 0.002918 **
## Temp 1 0.328 0.328 0.0826 0.781170
## Ammonium:Stir 1 28.117 28.117 7.0817 0.028754 *
## Ammonium:Temp 1 0.022 0.022 0.0055 0.942808
## Stir:Temp 1 10.128 10.128 2.5510 0.148890
## Ammonium:Stir:Temp 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
Interpretation
p-values in output:
Significant (α = 0.05): Ammonium, Stir, and Ammonium:Stir
Not significant: Temp, Ammonium:Temp, Stir:Temp, Ammonium:Stir:Temp
Temperature (800, 825, 850) × Position (1, 2), 3 replicates
library(GAD)
# Build the data frame
df <- expand.grid(
Temp = c(800, 825, 850),
Pos = c(1, 2),
Rep = 1:3
)
df$Density <- c(
570,1063,565, 528,988,526,
565,1080,510, 547,1026,538,
583,1043,590, 521,1004,532
)
# (a) Both Temperature and Position fixed
Temp <- as.fixed(df$Temp)
Pos <- as.fixed(df$Pos)
model.a <- aov(df$Density ~ Temp * Pos)
gad(model.a)
## $anova
## Analysis of Variance Table
##
## Response: df$Density
## Df Sum Sq Mean Sq F value Pr(>F)
## Temp 2 945342 472671 1056.117 3.25e-14 ***
## Pos 1 7160 7160 15.998 0.001762 **
## Temp:Pos 2 818 409 0.914 0.427110
## Residuals 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Both Temperature and Position have significant effects on baked density, but there is no significant interaction between them.
# (b) Both Temperature and Position random
Temp <- as.random(df$Temp)
Pos <- as.random(df$Pos)
model.b <- aov(df$Density ~ Temp * Pos)
gad(model.b)
## $anova
## Analysis of Variance Table
##
## Response: df$Density
## Df Sum Sq Mean Sq F value Pr(>F)
## Temp 2 945342 472671 1155.518 0.0008647 ***
## Pos 1 7160 7160 17.504 0.0526583 .
## Temp:Pos 2 818 409 0.914 0.4271101
## Residuals 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# When both factors are random, Temperature remains highly significant.
#Position becomes only marginally significant (p ~ 0.05), and the interaction remains not significant.
# (c) Temperature random, Position fixed (mixed)
Temp <- as.random(df$Temp)
Pos <- as.fixed(df$Pos)
model.c <- aov(df$Density ~ Temp * Pos)
gad(model.c)
## $anova
## Analysis of Variance Table
##
## Response: df$Density
## Df Sum Sq Mean Sq F value Pr(>F)
## Temp 2 945342 472671 1056.117 3.25e-14 ***
## Pos 1 7160 7160 17.504 0.05266 .
## Temp:Pos 2 818 409 0.914 0.42711
## Residuals 12 5371 448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# The results are very similar to the random–random model.
#Temperature again shows a strong effect, while Position is borderline and the interaction is insignificant.
In every model, Temperature strongly affects baked density.
The Position effect depends on how you treat the factors — significant if fixed, borderline if random/mixed
The interaction (Temp × Pos) is never significant, meaning the effect of Temperature on density does not depend on Position.