# NOT RUN {
# The Response Variable as provided in the given design layout.
y = c(90,74,81,83,77,81,88,73,
93,78,85,80,78,80,82,70,
98,85,88,84,82,85,88,79,
98,72,87,85,99,79,87,80,
95,76,83,86,90,75,84,80,
100,82,91,86,98,81,86,85)
# Number of Replicates or Blocks, whichever applicable in the considered Factorial
# Experiment.
r = 3
# Total number of factors in the 2^n Factorial Experiment under consideration.
n = 4
# The Treatment Allocation as mentioned in a factor type character vector.
trt = as.factor(c(rep(1:8,each=1,times=3),rep(9:16,each=1,times=3)))
# The Relevant Treatment Combinations in the 2^n Factorial Experiment in the order as mentioned.
trt.combo = as.factor(c('1','a','b','ab','c','ac','bc','abc',
'd','ad','bd','abd','cd','acd','bcd','abcd'))
# The Treatment Totals using the aggregate() function.
trt.total = aggregate(y,by = list(trt),sum)$x
# Finally calling the function run.yates.algo() to get the desired SS'.
SS.factorial.effects = run.yates.algo(trt.combo,trt.total,n,r)
# }
Run the code above in your browser using DataLab