Non-Parametric-Two-Sample-T-Test

Load Necessary Libraries
if (!requireNamespace("GAD", quietly = TRUE)) {
  install.packages("GAD")
}

library(GAD)

Input Experimental Data

Example: Four machines and three operators, with breaking strength as the response variable.
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

Fixed Effects Model

All levels of Machine and Operator are treated as fixed effects
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

Mixed Effects Model

Machine is a fixed effect, Operator is a random effect
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

Random Effects Model

Both Machine and Operator are random effects
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

Visualize Results

Create interaction plots to visualize the factorial design
interaction.plot(data$Machine, data$Operator, data$Response,
                 col = rainbow(4), legend = TRUE, lwd = 2,
                 main = "Interaction Plot: Machine vs Operator")