# Inspect generators and defining relations of a fractional factorial design

Is there a way to give (in R or Minitab or Statgraphics) a fractional factorial design like that and inspect the generators and the complete defining relation ($2^4 - 1$ relations)?

A   B   C   D   E   F   G   H
-1  1   1   1   -1  -1  1   -1
-1  -1  -1  1   1   1   1   -1
-1  1   1   -1  1   1   -1  -1
-1  -1  -1  -1  -1  -1  -1  -1
-1  1   -1  -1  1   -1  1   1
-1  -1  1   -1  -1  1   1   1
-1  1   -1  1   -1  1   -1  1
-1  -1  1   1   1   -1  -1  1
1   1   -1  -1  -1  1   1   -1
1   -1  1   -1  1   -1  1   -1
1   1   -1  1   1   -1  -1  -1
1   -1  1   1   -1  1   -1  -1
1   1   1   1   1   1   1   1
1   -1  -1  1   -1  -1  1   1
1   1   1   -1  -1  -1  -1  1
1   -1  -1  -1  1   1   -1  1


EDIT

(This is not an answer. It's just a workaround)

df<- read.table(textConnection("
A B C D E F G H
-1  1   1   1   -1  -1  1   -1
-1  -1  -1  1   1   1   1   -1
-1  1   1   -1  1   1   -1  -1
-1  -1  -1  -1  -1  -1  -1  -1
-1  1   -1  -1  1   -1  1   1
-1  -1  1   -1  -1  1   1   1
-1  1   -1  1   -1  1   -1  1
-1  -1  1   1   1   -1  -1  1
1   1   -1  -1  -1  1   1   -1
1   -1  1   -1  1   -1  1   -1
1   1   -1  1   1   -1  -1  -1
1   -1  1   1   -1  1   -1  -1
1   1   1   1   1   1   1   1
1   -1  -1  1   -1  -1  1   1
1   1   1   -1  -1  -1  -1  1
1   -1  -1  -1  1   1   -1  1
close(con)


ABCDEFGH gives a column of ones, so I=ABCDEFGH. We need the 14 remaining defining relations.

# start with four way interactions
four.way <- combn(c("A","B","C","D","E","F","G","H"),4)

res <- apply(four.way,2,function(x) {
apply(df[,x],1,prod)})
colnames(res) <- apply(four.way,2,paste,collapse="")


The res matrix has 70 columns of the products of the 4-combinations. Get the column names with a colSum of either 16 or -16 (they are defining relations)

def <- colnames(res[,colSums(res) == 16 | colSums(res) == -16])
[1] "ABCH" "ABDE" "ABFG" "ACDF" "ACEG" "ADGH" "AEFH" "BCDG" "BCEF" "BDFH" "BEGH" "CDEH" "CFGH" "DEFG"


So I got another 14 defining relations (including the generalized interactions). No need to look for other "words" since I already got 15.

The resolution is IV (min word length). It's easy to observe that the BGHA columns form the typical $2^4$ design (with opposite signs for B and G). Using the above defining relations you can get the generators: C=ABH, D=AGH, E=BGH and F=ABG.

To get the alias structure I did the following (I applied it only for the main effects and 2-way interactions, but you can get whatever you ask for)

# two way interactions
two.way <- apply(combn(c("A","B","C","D","E","F","G","H"),2),2,paste,collapse="")

test <- c("A","B","C","D","E","F","G","H",two.way)
gen <- c(def,"ABCDEFGH")

mat <- character(length(test)*(length(gen)+1))
dim(mat) <- c(length(test),length(gen)+1)
colnames(mat) <- c("Effect",paste("I=",gen,sep=""))
for (j in 1:length(test)){
mat[j,1] <- test[j]
for (i in 1:length(gen)) {
res <- paste(sort(c(unlist(strsplit(gen[i],"")),unlist(strsplit(test[j],"")))),collapse="")
le <- rle(unlist(strsplit(res,"")))$lengths va <- rle(unlist(strsplit(res,"")))$values
mat[j,i+1] <- paste(sort(va[le %% 2 == 1]),collapse="")
}}
noquote(mat)


And here is the result

      Effect I=ABCH I=ABDE I=ABFG I=ACDF I=ACEG I=ADGH I=AEFH I=BCDG I=BCEF I=BDFH I=BEGH I=CDEH I=CFGH I=DEFG I=ABCDEFGH
[1,] A      BCH    BDE    BFG    CDF    CEG    DGH    EFH    ABCDG  ABCEF  ABDFH  ABEGH  ACDEH  ACFGH  ADEFG  BCDEFGH
[2,] B      ACH    ADE    AFG    ABCDF  ABCEG  ABDGH  ABEFH  CDG    CEF    DFH    EGH    BCDEH  BCFGH  BDEFG  ACDEFGH
[3,] C      ABH    ABCDE  ABCFG  ADF    AEG    ACDGH  ACEFH  BDG    BEF    BCDFH  BCEGH  DEH    FGH    CDEFG  ABDEFGH
[4,] D      ABCDH  ABE    ABDFG  ACF    ACDEG  AGH    ADEFH  BCG    BCDEF  BFH    BDEGH  CEH    CDFGH  EFG    ABCEFGH
[5,] E      ABCEH  ABD    ABEFG  ACDEF  ACG    ADEGH  AFH    BCDEG  BCF    BDEFH  BGH    CDH    CEFGH  DFG    ABCDFGH
[6,] F      ABCFH  ABDEF  ABG    ACD    ACEFG  ADFGH  AEH    BCDFG  BCE    BDH    BEFGH  CDEFH  CGH    DEG    ABCDEGH
[7,] G      ABCGH  ABDEG  ABF    ACDFG  ACE    ADH    AEFGH  BCD    BCEFG  BDFGH  BEH    CDEGH  CFH    DEF    ABCDEFH
[8,] H      ABC    ABDEH  ABFGH  ACDFH  ACEGH  ADG    AEF    BCDGH  BCEFH  BDF    BEG    CDE    CFG    DEFGH  ABCDEFG
[9,] AB     CH     DE     FG     BCDF   BCEG   BDGH   BEFH   ACDG   ACEF   ADFH   AEGH   ABCDEH ABCFGH ABDEFG CDEFGH
[10,] AC     BH     BCDE   BCFG   DF     EG     CDGH   CEFH   ABDG   ABEF   ABCDFH ABCEGH ADEH   AFGH   ACDEFG BDEFGH
[11,] AD     BCDH   BE     BDFG   CF     CDEG   GH     DEFH   ABCG   ABCDEF ABFH   ABDEGH ACEH   ACDFGH AEFG   BCEFGH
[12,] AE     BCEH   BD     BEFG   CDEF   CG     DEGH   FH     ABCDEG ABCF   ABDEFH ABGH   ACDH   ACEFGH ADFG   BCDFGH
[13,] AF     BCFH   BDEF   BG     CD     CEFG   DFGH   EH     ABCDFG ABCE   ABDH   ABEFGH ACDEFH ACGH   ADEG   BCDEGH
[14,] AG     BCGH   BDEG   BF     CDFG   CE     DH     EFGH   ABCD   ABCEFG ABDFGH ABEH   ACDEGH ACFH   ADEF   BCDEFH
[15,] AH     BC     BDEH   BFGH   CDFH   CEGH   DG     EF     ABCDGH ABCEFH ABDF   ABEG   ACDE   ACFG   ADEFGH BCDEFG
[16,] BC     AH     ACDE   ACFG   ABDF   ABEG   ABCDGH ABCEFH DG     EF     CDFH   CEGH   BDEH   BFGH   BCDEFG ADEFGH
[17,] BD     ACDH   AE     ADFG   ABCF   ABCDEG ABGH   ABDEFH CG     CDEF   FH     DEGH   BCEH   BCDFGH BEFG   ACEFGH
[18,] BE     ACEH   AD     AEFG   ABCDEF ABCG   ABDEGH ABFH   CDEG   CF     DEFH   GH     BCDH   BCEFGH BDFG   ACDFGH
[19,] BF     ACFH   ADEF   AG     ABCD   ABCEFG ABDFGH ABEH   CDFG   CE     DH     EFGH   BCDEFH BCGH   BDEG   ACDEGH
[20,] BG     ACGH   ADEG   AF     ABCDFG ABCE   ABDH   ABEFGH CD     CEFG   DFGH   EH     BCDEGH BCFH   BDEF   ACDEFH
[21,] BH     AC     ADEH   AFGH   ABCDFH ABCEGH ABDG   ABEF   CDGH   CEFH   DF     EG     BCDE   BCFG   BDEFGH ACDEFG
[22,] CD     ABDH   ABCE   ABCDFG AF     ADEG   ACGH   ACDEFH BG     BDEF   BCFH   BCDEGH EH     DFGH   CEFG   ABEFGH
[23,] CE     ABEH   ABCD   ABCEFG ADEF   AG     ACDEGH ACFH   BDEG   BF     BCDEFH BCGH   DH     EFGH   CDFG   ABDFGH
[24,] CF     ABFH   ABCDEF ABCG   AD     AEFG   ACDFGH ACEH   BDFG   BE     BCDH   BCEFGH DEFH   GH     CDEG   ABDEGH
[25,] CG     ABGH   ABCDEG ABCF   ADFG   AE     ACDH   ACEFGH BD     BEFG   BCDFGH BCEH   DEGH   FH     CDEF   ABDEFH
[26,] CH     AB     ABCDEH ABCFGH ADFH   AEGH   ACDG   ACEF   BDGH   BEFH   BCDF   BCEG   DE     FG     CDEFGH ABDEFG
[27,] DE     ABCDEH AB     ABDEFG ACEF   ACDG   AEGH   ADFH   BCEG   BCDF   BEFH   BDGH   CH     CDEFGH FG     ABCFGH
[28,] DF     ABCDFH ABEF   ABDG   AC     ACDEFG AFGH   ADEH   BCFG   BCDE   BH     BDEFGH CEFH   CDGH   EG     ABCEGH
[29,] DG     ABCDGH ABEG   ABDF   ACFG   ACDE   AH     ADEFGH BC     BCDEFG BFGH   BDEH   CEGH   CDFH   EF     ABCEFH
[30,] DH     ABCD   ABEH   ABDFGH ACFH   ACDEGH AG     ADEF   BCGH   BCDEFH BF     BDEG   CE     CDFG   EFGH   ABCEFG
[31,] EF     ABCEFH ABDF   ABEG   ACDE   ACFG   ADEFGH AH     BCDEFG BC     BDEH   BFGH   CDFH   CEGH   DG     ABCDGH
[32,] EG     ABCEGH ABDG   ABEF   ACDEFG AC     ADEH   AFGH   BCDE   BCFG   BDEFGH BH     CDGH   CEFH   DF     ABCDFH
[33,] EH     ABCE   ABDH   ABEFGH ACDEFH ACGH   ADEG   AF     BCDEGH BCFH   BDEF   BG     CD     CEFG   DFGH   ABCDFG
[34,] FG     ABCFGH ABDEFG AB     ACDG   ACEF   ADFH   AEGH   BCDF   BCEG   BDGH   BEFH   CDEFGH CH     DE     ABCDEH
[35,] FH     ABCF   ABDEFH ABGH   ACDH   ACEFGH ADFG   AE     BCDFGH BCEH   BD     BEFG   CDEF   CG     DEGH   ABCDEG
[36,] GH     ABCG   ABDEGH ABFH   ACDFGH ACEH   AD     AEFG   BCDH   BCEFGH BDFG   BE     CDEG   CF     DEFH   ABCDEF

• You seem to have 8 factors, not 4.
– chl
Commented May 29, 2011 at 12:23
• @chl This is a 2^(8-4) design so p=4 and, as far as I know, the defining relation consists of the p generators and their 2^p - p - 1 generalized interactions. So there should be 2^p - 1 defining relations in total. Commented May 29, 2011 at 12:33
• You should rather put your edit as an answer (so that we can vote it) and you can even accept it, IMO.
– chl
Commented May 30, 2011 at 11:50
• @chl It would be very disappointing if this workaround was the best we could do for such a simple question. In Rcmdr DOE plugin there's an "Inspect Design" submenu under "Design". Seems relevant, but I have no idea how it works. Commented May 30, 2011 at 13:44
• Yes, I see it too (and we can see all Type III/IV/V resolution design), but the "Inspect Design" seems just a collection of wrapper functions to summarize the design structure (desnum, design.info, etc.). Rcmdr is becoming very nice, I should try it at some point.
– chl
Commented May 30, 2011 at 14:54

Disclaimer: Not really a positive answer...

Take a look at the FrF2 package, for example:

des.24 <- FrF2(16,8)
design.info(des.24)$aliased # look at the alias structure  create a randomized fractional design with 8 factors, 16 runs. To print all designs, print(catlg, nfactor=8, nruns=16)  For example, we have design 8-4.1 for a$2_{IV}^{8-4}$design, whose generators are$E=ABC$,$F=ABD$,$G=ACD$, and$H=BCD\$ (with defining relations in e.g., Montgomery 5ed Appendix X p. 629):

summary(FrF2(design="8-4.1"))
FrF2:::generators.from.design(FrF2(design="8-4.1"))


Yet I found no way to update the design matrix. It seems we can update a response vector (there's an example of use with design()/undesign()), but AFAIK there's no function that would import a matrix of contrasts and allow to match it in the catalog or find the generators.

P.S. Apart from Minitab and StatGraphics, DOE++ seems to offer many facilities to work with two-level fractional designs, but I cannot test it unfortunately.

• I've seen FrF2. The point is that the design that produces is not the same with mine. For example it gives the alias AB=CE which is not true in my case. I was looking for a way to analyze a predefined design. Commented May 29, 2011 at 12:55
• @gd047 Yes, I understood it afterwards. Will think of it.
– chl
Commented May 29, 2011 at 12:58
• @gd047 Well, now that I've read the question, I can say that I didn't find my way with this in R.
– chl
Commented May 30, 2011 at 7:47