This document provides an example of factorial design analysis. The analysis covers hypothesis testing, interaction effects, and ANOVA table creation.
We analyze the strength of plastic forks, varying two factors:
1. Type of Plastic: PVC and ABX
2. Thickness: 1mm, 1.5mm, 2mm
Each factor level combination is observed multiple times to examine the interaction effects.
The model is represented as:
\[ y_{ijk} = \mu + \alpha_i + \beta_j + (\alpha \beta)_{ij} + \epsilon_{ijk} \]
Where: - \(\alpha_i\): Effect of Plastic Type (A) - \(\beta_j\): Effect of Thickness (B) - \((\alpha \beta)_{ij}\): Interaction effect - \(\epsilon_{ijk}\): Error term
The hypotheses for the factorial design are as follows:
Effect of Plastic Type (Factor A): \[ H_0: \alpha_i = 0 \quad \text{for all } i \] \[ H_a: \alpha_i \neq 0 \quad \text{for some } i \]
Effect of Thickness (Factor B): \[ H_0: \beta_j = 0 \quad \text{for all } j \] \[ H_a: \beta_j \neq 0 \quad \text{for some } j \]
Interaction Effect of Plastic and Thickness (Factor A and B): \[ H_0: (\alpha \beta)_{ij} = 0 \quad \text{for all } i, j \] \[ H_a: (\alpha \beta)_{ij} \neq 0 \quad \text{for some } i, j \]
# Simulate data for factorial design
set.seed(123)
plastic <- factor(rep(c("PVC", "ABX"), each = 9))
thickness <- factor(rep(rep(c("1mm", "1.5mm", "2mm"), each = 3), 2))
response <- rnorm(18, mean = 100, sd = 5) # Example strength values
data <- data.frame(plastic, thickness, response)
head(data)
## plastic thickness response
## 1 PVC 1mm 97.19762
## 2 PVC 1mm 98.84911
## 3 PVC 1mm 107.79354
## 4 PVC 1.5mm 100.35254
## 5 PVC 1.5mm 100.64644
## 6 PVC 1.5mm 108.57532
# Fit the factorial model
model <- aov(response ~ plastic * thickness, data = data)
summary(model)
## Df Sum Sq Mean Sq F value Pr(>F)
## plastic 1 0.1 0.067 0.002 0.964
## thickness 2 26.0 13.017 0.416 0.669
## plastic:thickness 2 30.1 15.068 0.481 0.630
## Residuals 12 375.9 31.323
# Visualize interaction effects
library(ggplot2)
interaction.plot(data$thickness, data$plastic, data$response, col = c("blue", "red"), type = "b", main = "Interaction Plot", xlab = "Thickness", ylab = "Response")
# Display ANOVA table
anova_table <- summary(model)
anova_table
## Df Sum Sq Mean Sq F value Pr(>F)
## plastic 1 0.1 0.067 0.002 0.964
## thickness 2 26.0 13.017 0.416 0.669
## plastic:thickness 2 30.1 15.068 0.481 0.630
## Residuals 12 375.9 31.323
The mathematical model for a three-factor factorial design is as follows:
\[ 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: - \(Y_{ijkl}\): Response variable for the \(i\)-th level of Factor A, \(j\)-th level of Factor B, \(k\)-th level of Factor C, and \(l\)-th replication. - \(\mu\): Overall mean. - \(\alpha_i\): Effect of the \(i\)-th level of Factor A. - \(\beta_j\): Effect of the \(j\)-th level of Factor B. - \(\gamma_k\): Effect of the \(k\)-th level of Factor C. - \((\alpha \beta)_{ij}\): Interaction effect between Factor A and Factor B. - \((\alpha \gamma)_{ik}\): Interaction effect between Factor A and Factor C. - \((\beta \gamma)_{jk}\): Interaction effect between Factor B and Factor C. - \((\alpha \beta \gamma)_{ijk}\): Three-way interaction effect among Factor A, B, and C. - \(\epsilon_{ijkl}\): Random error, assumed to follow \(N(0, \sigma^2)\).
This document demonstrates the factorial design analysis using R. The ANOVA results and interaction plot reveal how plastic type and thickness influence the fork strength, and whether their effects are additive or interactive.