if (!requireNamespace("GAD", quietly = TRUE)) {
install.packages("GAD")
}
library(GAD)
data <- data.frame(
Machine = factor(rep(1:4, each = 6)),
Operator = factor(rep(rep(1:3, each = 2), times = 4)),
Response = c(109, 110, 112, 114, 115, 118, 121, 123, 125, 127, 129, 130,
135, 137, 140, 142, 144, 145, 150, 152, 154, 157, 159, 160)
)
head(data)
## Machine Operator Response
## 1 1 1 109
## 2 1 1 110
## 3 1 2 112
## 4 1 2 114
## 5 1 3 115
## 6 1 3 118
data$Machine <- as.fixed(data$Machine)
data$Operator <- as.fixed(data$Operator)
fixed_model <- aov(Response ~ Machine * Operator, data = data)
gad_fixed <- gad(fixed_model)
summary(gad_fixed)
## Length Class Mode
## anova 5 anova list
data$Operator <- as.random(data$Operator)
mixed_model <- aov(Response ~ Machine * Operator, data = data)
gad_mixed <- gad(mixed_model)
summary(gad_mixed)
## Length Class Mode
## anova 5 anova list
data$Machine <- as.random(data$Machine)
random_model <- aov(Response ~ Machine * Operator, data = data)
gad_random <- gad(random_model)
summary(gad_random)
## Length Class Mode
## anova 5 anova list
interaction.plot(data$Machine, data$Operator, data$Response,
col = rainbow(4), legend = TRUE, lwd = 2,
main = "Interaction Plot: Machine vs Operator")