Some questions about AlgDesign for Fractional Factorial Design in R I have a few Design of Experiment type questions about the AlgDesign package in R that I can't find answered online:


*

*Will using the center=TRUE option in the gen.factorial function always provide one run with the base level (of -1's) across all factors?  For example, fractional3 does not have a run with the base level across all while fractional4 does:
all_possible3 <- gen.factorial(levels=2,nVars=4,varNames=c("A","B","C","D"))    
fractional3 <- optFederov(~.,all_possible3,nTrials=8)
all_possible4 <- gen.factorial(levels=2,nVars=4,center=TRUE,varNames=c("A","B","C","D"))
fractional4 <- optFederov(~.,all_possible4,nTrials=8,nRepeats=50)


*What do the coefficients in the confounding matrix represent?  I would love a brief interpretation for what the confounding matrix in eval2 would represent and how such results would impact estimating the parameters, standard errors and significance using glm():
all_possible2 <- gen.factorial(levels=3,nVars=3,center=TRUE,varNames=c("A","B","C"))
fractional2 <- optFederov(~.,all_possible2,nTrials=9,nRepeats=50)    
eval2 <- eval.design(~.^2,fractional2$design,confounding=TRUE)


*Why can't a confounding matrix be calculated for eval4 in the following code?  It throws an error message about a singular design. Is there another way to understand confounding or aliasing?
all_possible4 <-   gen.factorial(levels=2,nVars=4,center=TRUE,varNames=c("A","B","C","D"))
fractional4 <- optFederov(~.,all_possible4,nTrials=8,nRepeats=50)
eval4 <- eval.design(~.^2, fractional4$design,confounding=TRUE)

 A: 1)  Looking at the code, it looks like optFederov() doesn't guarantee any particular choice of runs.  The gen.factorial() function just works out the full design matrix, so there's nothing to see there.
In the documentation for optFederov(), it does say that it starts with points either chosen at random or from the null space of X.  You can specify rows that the design needs to include:
# Generate a list of all possible combinations of factor levels.
all4 <- gen.factorial(levels=2, nVars=4, varNames=c("A","B","C","D"))

# Search for an optimal design with 8 runs that must include
# the first row.
set.seed(126)
f3 <- optFederov(~., all4, nTrials=8, rows=c(1), augment=TRUE)
f3

Note that the design is not as optimal as it could be in this case.  Changing nRepeat or maxIteration seems to have no effect.
2)  Per the documentation the columns in the confounding matrix $C$ are the regression coefficients of each independent variable up on each other independent variable.
You can get the expanded model matrix $Z$ that goes with the generated design using:
Z <- model.matrix(~ .^2, fractional2$design)

If you then regress each column in the model matrix on the other columns (with no intercept), you will see the same results as the confounding matrix (within rounding and keeping in mind the coefficient of -1 to represent the column term itself).  For example:
lm(Z[,1] ~ 0 + Z[, 2:7])

The documentation notes that $-ZC$ gives the matrix of the residuals regressed on the other variables.  Those should be the unique part of each variable having accounted for the other variables.
3)  The problem here is that you have four factors with all two-way interactions specified in your formula.  That means four main effects, six two-way interactions, and one intercept.  The design has 8 degrees of freedom and you need to estimate 11 parameters.
