I am a novice so my code will not be elegant!
I'm trying to determine an optimized 'recipe' of 6 ingredients with 5 levels of use. Ingredients - (A, B, C, D, E, F) Levels - (0%, 25%, 50%, 75%, 100%)
A full factorial (see code using fac.design from DoE.base) returns 15,625 possibilities with no repeats. After subsetting the result to eliminate all recipes that sums > 100%, I am left with 126 sample recipes.
My question is - Is it possible to apply the conditional require (the factors can only sum to 100%) to an orthogonal array to further reduce the necessary samples without giving up significant statistical power?
Here's my code -
library(DoE.base)
library(openxlsx)
antibodies <- 6 ### how many antibodies?
percent <- 5 ### how many levels or percentages of contribution to the recipe?
FF <- fac.design(nfactors = antibodies, nlevels = percent) ## this creates a full factorial
FF$new <- c(0) ## this adds a new column to FF and fills it with zeros
colnames(FF) <- c("A", "B", "C","D", "E", "F", "Total") ## this renames the columns
FF$A <- as.numeric(FF$A) ## changes char to numeric
FF$B <- as.numeric(FF$B)
FF$C <- as.numeric(FF$C)
FF$D <- as.numeric(FF$D)
FF$E <- as.numeric(FF$E)
FF$F <- as.numeric(FF$F)
FF$Total <- as.numeric(FF$Total)
FF[FF == 1] <- 0.00 ## update if percentages change
FF[FF == 2] <- 0.25 ## use this to replace the char "2" with the numeric 0.25
FF[FF == 3] <- 0.50
FF[FF == 4] <- 0.75
FF[FF == 5] <- 1.00
attach(FF)
i <- 1 ### this replaces the zeroes with the summation of each antibodies' contribution
for (i in 1:15625) {
FF$Total <- c(A+B+C+D+E+F)
i <- (i+1)
}
ff1 <- subset(FF, select = A:Total, subset = (Total == 1)) ## this subsets only the recipes that total 100%
write.xlsx(ff1, file = 'Padakonn Full Factorial Antibody Sampling Plan.xlsx')
The problem describes a mixture design that involves sampling on a simplex. A couple packages described below may be of interest.
From the
mixexppackage, theSLDfunction will create a simplex lattice design:If the mixture proportions can be varied continuously independent of ingredient, a normalized maximum projection design may give better coverage. Using the
MaxProLHDfrom theMaxPropackage (which has the advantage of being able to specify the number of recipes):Notice that the maximum projection design is less aggressive at sampling the edges and corners of the simplex.
Lastly, this paper describes an approach using a normalized fractional factorial design.