Randomization of data using labels

My question: Is there any way to randomize this data using the factor labels with two reps rather than using just the numbers?

Here is my R-code using the SixSigma package for Experimental Design:

My data:
ExperimentDesign <- expand.grid(Flame = gl(2, 1, labels = c("Low", "High")),
Pan = gl(2, 1, labels = c("Small", "Large")),
Cover = gl(2, 1, labels = c("None", "Glass")),
Salt = gl(2, 1, labels = c("Yes", "No")))

My Sample:
ExperimentDesign$ord <- sample(1:16,16)

ExperimentDesign[order(ExperimentDesign$ord), ]

Replications:
ss.data.doe1 <- data.frame(repl = rep(1:2, each = 16),
rbind(ExperimentDesign))
ss.data.doe1

Hi @TJ37043,
Since your "treatment" consists of (all) the fixed combinations of Flame/Pan/Cover/Salt it doesn't make sense to randomize them separately. The use of "treatment" numbers is OK; however, your code produces the same randomization sequence in each replicate which is a bad idea, especially if these "pizzas" are going to be made in a time sequence where autocorrelation may occur. Sample each replicate independently (unless you know that you want a "completely randomized" design):

new_ss.data.doe1$better_repl <- c(sample(1:16), sample(1:16))
1 Like

Thank you so much for your assistance!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.