-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path06-fractions.Rmd
583 lines (442 loc) · 27.4 KB
/
06-fractions.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# Fractional factorial designs {#fractional-factorial}
The factorial designs we studied in Chapters \@ref(factorial) and \@ref(block-factorial) can involve a large number of treatments, for even a moderate number of factors (Table \@ref(tab:size-of-factorial)).
```{r size-of-factorial}
size <- data.frame(1:15, 2^(1:15))
knitr::kable(size, col.names = c("No. factors", "No. of trts"), caption = "Number of treatments in a $2^f$ factorial designs for different numbers, $f$, of factors.")
```
For larger numbers of factors, resource constraints may mean it is not possible to run an experiment using all $2^f$ treatments. Also, many degrees of freedom in these experiments are used to estimate high-order interactions. For example, in a $2^5$ experiment, 16 degrees of freedom are used to estimate three-factor and higher interactions, half the size of the experiment. The principles of effect hierarchy and sparsity (Section \@ref(fact-principles)) suggest this is probably wasteful.
We can select smaller experiments by using a subset, or **fraction** of the treatments of size $2^{f-q}$:
a. divide the treatments in subsets by confounding $q$ factorial effects (and their products), as in blocking;
b. only use **one** of the subsets in the experiment.
::: {.example #spring-experiment}
Spring experiment [@WH2009, ch. 5]
Consider an industrial experiment to investigate the effect of $f=5$ factors on the unloaded height of a spring produced using a heat treatment. The five factors are described in Table \@ref(tab:spring-factors).
```{r spring-factors}
factor.name <- c("Quench temperature (F)", "Heat temperature (F)", "Heating time (s)",
"Transfer time (s)", "Hold-down time (s)")
low.level <- c("130-150", 1840, 23, 10, 2)
high.level <- c("150-170", 1880, 25, 12, 3)
spring.factors <- data.frame(factor = factor.name, low = low.level, high = high.level)
row.names(spring.factors) <- LETTERS[1:5]
knitr::kable(spring.factors, col.names = c("Factor", "Low level", "High level"),
align = c("l", "r", "r"), caption = "Spring experiment: factors and levels")
```
Enough experimental units were available to perform $n=16$ runs, which is one-half of the total number of treatments. We refer to this type of design as a **one-half fractional replicate** of the full factorial design, or a **$2^{5-1}$ fractional factorial design**^[If we only run one-half of the treatments from a $2^5$ design, the design contains $\frac{2^5}{2} = 2^{5-1}$ treatments].
The design was constructed by confounding $q=1$ factorial effects with blocks, the interaction $BCDE$ was chosen, and running just one of the two resulting subsets, see Table \@ref(tab:spring-data) where `FrF2` is used to generate the design.
```{r spring-data, message = F}
spring <- FrF2::FrF2(nruns = 16, nfactors = 5, generators = "BCD", randomize = F)
spring$height <- c(7.54, 7.20, 7.69, 7.63, 7.94, 7.40, 7.95, 7.62, 7.52, 7.52,
7.63, 7.65, 7.79, 7.29, 8.07, 7.73)
knitr::kable(spring, caption = "Spring experiment: 16 run design.", align = rep("r", 6))
```
Clearly, using a subset of the treatments, we will no longer be able to estimate all the factorial effects (we have insufficient degrees of freedom). We have confounded the interaction $BCDE$, and hence clearly the contrast coefficients for this effect will be constant in our design. We say the interaction $BCDE$ is **aliased** with the mean, and we write this as $I = BCDE$. This expression is called the **defining relation**, as knowledge of which factorial effects are aliased with the mean completely define the fractional factorial.
```{r spring-def-rel}
fac_to_numeric <- function(x) as.numeric(as.character(x))
BCDE <- fac_to_numeric(spring$B) * fac_to_numeric(spring$C) *
fac_to_numeric(spring$D) * fac_to_numeric(spring$E)
BCDE
```
This removes one factorial effect from consideration, but we are still short on degrees of freedom. What are the other consequences of using a fractional factorial design?
As the contrast coefficients for the interaction $BCDE$ are constant, the contrast coefficients for any pairs of factorial effects whose (hadamard) product form $BCDE$ will be equal. For example, the contrast coefficient vectors for interactions $BC$ and $DE$ will be equal, as will the vectors for the main effect $B$ and the interaction $CDE$, and so on.
```{r spring-alias1, results = 'hold'}
BC <- fac_to_numeric(spring$B) * fac_to_numeric(spring$C)
DE <- fac_to_numeric(spring$D) * fac_to_numeric(spring$E)
BC
DE
all.equal(BC, DE)
```
```{r spring-alias2, results = 'hold'}
B <- fac_to_numeric(spring$B)
CDE <- fac_to_numeric(spring$C) * fac_to_numeric(spring$D) * fac_to_numeric(spring$E)
B
CDE
all.equal(B, CDE)
```
We say these factorial effects are **aliased**. From the defining relation, we can derive the complete **aliasing scheme** for a fractional factorial design. For the example,
\begin{align}
I & = BCDE \\
A & = ABCDE \\
B & = CDE \\
C & = BDE \\
D & = BCE \\
E & = BCD \\
AB & = ACDE \\
AC & = ABDE \\
AD & = ABCE \\
AE & = ABCD \\
BC & = DE \\
BD & = CE \\
BE & = CD \\
ABC & = ADE \\
ABD & = ACE \\
ABE & = ACD \\
\end{align}
The aliasing scheme contains $2^{f-q} = 2^{5-1} = 16$ "strings", each one containing $2^q = 2^1 = 2$ "words". The design is not capable to distinguishing between factorial effects in the same alias string.
We can also generate this information using the `aliases` function from `FrF2`.
```{r frfr-aliases}
spring.lm <- lm(height ~ (.)^5, data = spring)
FrF2::aliases(spring.lm)
```
:::
::: {.definition #regular-fraction}
A **regular $2^{f-q}$fractional factorial design** is constructed by aliasing $2^q-1$ factorial effects with the mean; $q$ of these effects can be chosen independently, the others are formed via the hadamard product of the contrast coefficients for the $q$ effects,
:::
How do we chose the factorial effects to alias with the mean? As with blocking, we tend to choose higher-order effects, taking care when $q>1$ not to inadvertently alias together lower-order effects (see later examples).
For Example \@ref(exm:spring-experiment), a slightly unusual defining relation was chosen. It would be more common to use $I = ABCDE$, leading to the aliasing scheme:
\begin{align}
I & = ABCDE \\
A & = BCDE \\
B & = ACDE \\
C & = ABDE \\
D & = ABCE \\
E & = ABCD \\
AB & = CDE \\
AC & = BDE \\
AD & = BCE \\
AE & = BCD \\
BC & = ADE \\
BD & = ACE \\
BE & = ACD \\
CD & = ABE \\
CE & = ABD \\
DE & = ABC \\
\end{align}
This defining relation results in main effects being aliased with four-factor interactions and, perhaps more importantly, no pairs of two-factor interactions aliased together. The original design from Example \@ref(exm:spring-experiment) might be used if factor $A$ and its interactions were a priori thought likely to be important (two-factor interactions involving factor $A$ are aliased with four-factor interactions).
## Estimability and aliasing {#est-alias}
Any factorial effect in an alias string is only estimable **if all other effects in that string are assumed zero**^[Except for the defining relation, where no effects are estimable]. Wd can study this further by introducing the **alias matrix**.
::: {.definition #alias-matrix}
Assume a linear data generating model
$$
\bY = X_1\boldsymbol{\beta}_1 + X_2\boldsymbol{\beta}_2 + \boldsymbol{\varepsilon}\,,
$$
where $\bY$ is an $n$-vector of responses, $X_1$ and $X_2$ are $n\times p_1$ and $n\times p_2$ model matrices, respectively, with $\boldsymbol{\beta}_1$ and $\boldsymbol{\beta}_2$ corresponding $p_1$- and $p_2$-vectors of parameters and random errors $\varepsilon ~ N(\boldsymbol{0}, I_n\sigma^2)$.
If the submodel
$$
\bY = X_1\boldsymbol{\beta}_1 + \boldsymbol{\varepsilon}\,,
$$
is fitted to the response data, then $\hat{\boldsymbol{\beta}}_1 = (X_1^{\mathrm{T}}X_1)^{-1}X_1^{\mathrm{T}}\bY$, and
\begin{align*}
E(\hat{\boldsymbol{\beta}}_1) & = \boldsymbol{\beta}_1 + (X_1^{\mathrm{T}}X_1)^{-1}X_1^{\mathrm{T}}X_2\boldsymbol{\beta}_2 \\
& = \boldsymbol{\beta}_1 + A\boldsymbol{\beta}_2\,,
\end{align*}
where $A = (X_1^{\mathrm{T}}X_1)^{-1}X_1^{\mathrm{T}}X_2$ is the **alias** matrix.
:::
We also introduce an alternative definition of estimability.
::: {.definition #alt-estimability}
A linear combination of parameters $\boldsymbol{c}^{\mathrm{T}}\boldsymbol{\theta}$ is estimable if and only if there exists a linear combination of the responses $\boldsymbol{a}^{\mathrm{T}}\bY$ such that
$$
E(\boldsymbol{a}^{\mathrm{T}}\bY) = c^{\mathrm{T}}\boldsymbol{\theta}\,.
$$
:::
Now assume that using a two-level fractional factorial design, we will estimate one factorial effect (equivalently, the corresponding regression coefficient) from each alias string. Then the $A$ matrix will have entries 0, -1 or +1, depending on the defining relation of the fraction. Each regression parameter will be biased by the parameters corresponding to other factorial effects in the alias string. Hence, by Definition \@ref(def:alt-estimability), each factorial effect is only estimable under the assumption that all other factorial effects in the alias string are zero.
For Example \@ref(exm:spring-experiment) we can generate the alias matrix using the `alias` function.
```{r spring-alias}
t(alias(spring.lm)$Complete)
```
## General method for choosing a fractional factorial design
To select a $2^{f-q}$ fractional factorial design:
- choose $q$ independent factorial contrasts for the **generators**, or **defining words**, $\nu_1,\ldots,\nu_q$. Typically, we choose higher-order interactions (due to effect hierarchy):
$$
\nu_{1}=\boldsymbol{c}_{1},\ldots,\nu_{q} = \boldsymbol{c}_{q}\,.
$$
- all the hadamard products of $\boldsymbol{c}_{1},\dots,\boldsymbol{c}_{q}$ are also aliased with the mean, and together give the **defining relation**:
$$
I = \nu_1 = \ldots = \nu_q = \nu_1\nu_q = \ldots = \nu_1\cdots\nu_q\,.
$$
- the **aliasing scheme** is a list of the $2^{f-q}$ **alias strings**. Every effect in one string is estimated by the same contrast in the observations:
$$
\begin{array}{ccccccccccccc}
I & = & \nu_1 & = & \ldots & = & \nu_q & = & \nu_1\nu_q
& = & \ldots & = & \nu_1\cdots\nu_q \\
A & = & A\nu_1 & = & \ldots & = & A\nu_q & = & A\nu_1\nu_q
& = & \ldots & = & A\nu_1\cdots\nu_q \\
B & = & B\nu_1 & = & B\ldots & = & B\nu_q & = & B\nu_1\nu_q
& = & \ldots & = & B\nu_1\cdots\nu_q \\
\vdots \\
CD & = & CD\nu_1 & = & CD\ldots & = & CD\nu_q & = & CD\nu_1\nu_q
& = & CD\ldots & = & CD\nu_1\cdots\nu_q \\
\vdots
\end{array}
$$
All the effects within a single alias string are aliased, and cannot be simultaneously aliased. In fact, the estimation of any effect within an alias string can only proceed if all other effects in the string are assumed zero; otherwise, we can estimate the sum of the effects (see Section \@ref(est-alias)).
To find the treatments in a particular fraction, we simply need to solve a set of equations of the form
$$
\nu_1 = \pm 1, \quad \nu_2 + \pm 1, \quad \ldots \quad \nu_q = \pm 1\,,
$$
with $2^{f-q}$ treatments satisfying the $2^q$ equations corresponding to each choice of $\pm 1$ for each generator.
::: {.example #frac-illustrative}
Consider a $2^{6-2}$ design, with $q=2$ generators $ABCE$ and $BCDF$. The defining relation is given by
$$
I = ABCE = BCDF = ADEF\,.
$$
The aliasing scheme has $2^{6-2} = 16$ strings, each of which contains $2^2 = 4$ effects or words.
$$
\begin{array}{ccccccc}
I & = & ABCE & = & BCDF & = & ADEF \\
A & = & BCE & = & ABCDF & = & DEF \\
B & = & ACE & = & CDF & = & ABDEF \\
C & = & ABE & = & BDF & = & ACDEF \\
D & = & ABCDE & = & BCF & = & AEF \\
E & = & ABC & = & BCDEF & = & ADF \\
F & = & ABCEF & = & BCD & = & ADE \\
AB & = & CE & = & ACDF & = & BDEF \\
AC & = & BE & = & ABDF & = & CDEF \\
AD & = & BCDE & = & ABCF & = & EF \\
AE & = & BC & = & ABCDEF & = & DF \\
AF & = & BCEF & = & ABCD & = & DE \\
BD & = & ACDE & = & CF & = & ABEF \\
BF & = & ACEF & = & CD & = & ABDE \\
ABD & = & CDE & = & ACF & = & BEF \\
ABF & = & CEF & = & ACD & = & BDE \\
\end{array}
$$
This aliasing scheme can result from any one of the four possible fractions defined by
$$
ABCE = \pm 1\,,\quad BCDF = \pm 1\,.
$$
Each fraction has (essentially) the same statistical properties, except the sign of the biasing coefficients from the alias matrix may be reversed (-1, rather than +1).
For example, the treatments in the fraction may be those $2^{f-q} = 2^{6-2} = 16$ treatments that all have $ABCE = +1$ and $BCDF = +1$.
:::
We can also use `FrF2` to find two-level fractional factorial designs, as we already saw in Example \@ref(exm:spring-experiment). The `generators` argument can be used to specify which factorial effects to use as generators. These are specified using what `FrF2` refers to as the $f-q$ **base factors**. The $q$ generators must specify with which factorial effects in the base factors the $q$ additional factors are aliased.
For Example \@ref(exm:frac-illustrative), a $2^{6-2}$ design, the base factors are $A, B, C, D$ and from our defining relation we have $E = ABC$ and $F = BCD$.
```{r FrF2-example}
ff.2.6.2 <- FrF2::FrF2(nruns = 16, nfactors = 6, generators = c("ABC", "BCD"),
randomize = F, alias.info = 3)
```
Once `FrF2` has generated the design, we can interrogate the aliasing (up to three-factor interactions) using `design.info` (and using the `aliases` function, see Example \@ref(exm:spring-experiment)).
```{r FrFr-example-di, message = F}
library(FrF2)
design.info(ff.2.6.2)$aliased
```
By default, `FrF2` chooses the fraction defined by each generator being equal to +1.
```{r FrF2-example-design}
knitr::kable(ff.2.6.2, align = "r",
caption = "Treatments from a $2^{6-2}$ fractional factorial design.")
```
## Resolution and aberration
Clearly, the numbers of factors involved in the effects in the defining relation play an important role in the properties of the design.
::: {.definition #length}
Each factorial effect is commonly referred to as a **word**, and the number of factors involved in a factorial effect is its **length**.
:::
For example, word $ABCD$ has length 4; word $BDE$ has length 3.
::: {.definition #resolution}
The **resolution** of a $2^{f-q}$ design is the length of the shortest word in the defining relation.
A design having resolution $R$ implies that no effect involving $x$ factors is aliased with effects involving less than $R-x$ factors.
Designs of the following resolution are particularly common.
- *Resolution III*: shortest word of length 3. No main effect is aliased with any other main effect; at least one main effect of aliased with a two-factor interaction.
- *Resolution IV*: shortest word of length 4. No main effect is aliased with any other main effect or any two-factor interaction; at least one pair of two-factor interactions are aliased together.
- *Resolution V*: shortest word of length 5. No main effect or two-factor interaction is aliased with any other main effect or two-factor interaction.
:::
For example,
- $2^{6-2}$, $I = ABCD = CDEF = ABEF$: resolution IV.
- $2^{3-1}$, $I = ABC$: resolution III.
::: {.definition #wlp}
The *word length pattern* of a $2^{f-q}$ design is given by
$$
W = (w_3, w_4, \ldots, w_f)\,,
$$
where $w_i$ is the number of words of length $i$ in the defining relation.
:::
For example,
- $d_1$: $2^{7-2}$, $I = ABCF = ADEG = BCDEFG$
- $d_2$: $2^{7-2}$, $I = DEFG = ABCDF = ABCEG$
are both resolution IV designs, but have different word length patterns
- $W(d_1) = (0, 2, 0, 1, 0)$
- $W(d_2) = (0, 1, 2, 0, 0)$.
::: {.definition #minab}
For two $2^{f-q}$ designs, say $d^\star$ and $d^\dagger$, let $r$ be the smallest integer such that $w_r(d^\star) \ne w_r(d^\dagger)$. Then design $d^\star$ is said to have less **aberration** than design $d^\dagger$ if
$$
w_r(d^\star) < w_r(d^\dagger)\,.
$$
If no design has less aberration than $d^\star$, then $d^\star$ has **minimum aberration**.
:::
Consider again designs $d_1$ and $d_2$ from above ($2^{7-2}$ fractions). Here,
$$
\begin{array}{ccccccc}
w_3(d_1) & = & 0 & = & w_3(d_2) & = & 0 \\
w_4(d_1) & = & 2 & > & w_4(d_2) & = & 1 \,, \\
\end{array}
$$
and hence $d_2$ has less aberration than $d_1$. In fact, $d_2$ has minimum aberration.
We can use `FrF2` to find designs of a specific resolution using the `resolution` argument (and leaving `nruns` and `generators` unspecified). The resulting design will have the minimum number of runs required to obtain the requested resolution.
```{r FrF2-res}
ff.2.6.2.r <- FrF2::FrF2(nfactors = 6, resolution = 4,
randomize = F, alias.info = 3)
design.info(ff.2.6.2.r)$aliased
```
When `generators` and `resolution` are not specified, `FrF2` function selects designs from catalogues of good designs, most of which have minimum aberration.
```{r FrF2-alone}
ff.2.6.2.a <- FrF2::FrF2(nfactors = 6, nruns = 16,
randomize = F, alias.info = 3)
design.info(ff.2.6.2.a)$aliased
```
## Analysis of fractional factorial designs {#frac-anal}
The analysis can proceed as for full factorial designs (Chapter \@ref(factorial)). Assuming only one factorial effect in each alias string is non-zero, we can estimate $2^{f-q}-1$ factorial effects (one from each string) either by fitting the unit-treatment model or the corresponding regression model.
For Example \@ref(exm:spring-experiment), we can use the unit-treatment model and contrasts to estimate all main effects and selected two-factor interactions, assuming all other factorial effects are zero.
```{r spring-contrast}
spring$treatment <- factor(1:16)
spring.ut <- lm(height ~ treatment, data = spring)
fac.contrasts.emmc <- function(nlevs, ...) {
spring.num <- apply(spring[, c("A", "B", "C", "D", "E")], 2, fac_to_numeric)
data.frame(model.matrix(~ . + A:B + A:C + A:D + A:E + B:C
+ B:D + B:E, data.frame(spring.num))[, -1] / 8)
}
spring.emm <- emmeans::emmeans(spring.ut, ~ treatment)
emmeans::contrast(spring.emm, 'fac.contrasts')
```
When looking at this output, we must remember the aliasing scheme and recognise that we can only estimate these effects if all of their alaises are zero. Otherwise, each of these factorial effects is biased and not estimable (we are actually estimating the linear combination of all the aliased effects).
Alternatively, we can fit the regression model directly in the contrasts; `lm` automatically recognises which pairs of effects are aliased, and chooses the lexicographically first effect to include in the model.
```{r spring-reg}
spring.lm <- lm(height ~ (A + B + C + D + E) ^ 5, data = spring)
c(na.omit(2 * coef(spring.lm)[-1]))
```
In this experiment, there are three alias string that only include three-factor interactions. We may wish to use these three degrees of freedom to estimate $\sigma^2$, under the assumption that all six interactions involved in these three strings are zero.
```{r spring-sigma2}
spring.lm <- lm(height ~ (A + B + C + D + E) ^ 2, data = spring)
anova(spring.lm)
```
## Blocking fractional fractorial designs
We block fractional factorial designs using the same approach as Chapter \@ref(block-factorial). To block a $2^{f-q}$ design into $b = 2^m$ blocks, we choose $m$ factorial effects to confound with blocks, also confounding all products of these $m$ effects. However, we of course also confound the $2^q-1$ aliases of each of these $2^m-1$ effects. Hence, we actually choose to confound $2^m-1$ *strings of factorial effects* with blocks.
We must pay particular attention to make sure we do not accidentically confound a lower-order effect through the aliasing scheme. We can also use `FrF2` to find blocked factorial designs.
::: {.example #block-fractional}
Consider a $2^{6-2}$ design with defining relation
$$
I = ABCE = ABDF = CDEF\,.
$$
To split this design into $b=2^2 = 4$ blocks of size $k=4$, we choose $m=2$ defining blocks, and also confound their product.
$$
\begin{array}{ccc}
\mathrm{Block}_1 & = & ACD \\
\mathrm{Block}_2 & = & BCD \\
\mathrm{Block}_1\mathrm{Block}_2 & = & AB\,.
\end{array}
$$
We also confound all aliases of these effects:
$$
\begin{array}{ccccccccc}
\mathrm{Block}_1 & = & ACD & = & BDE & = & BCF & = & ADEF \\
\mathrm{Block}_2 & = & BCD & = & ADE & = & ACF & = & BEF \\
\mathrm{Block}_1\mathrm{Block}_2 & = & AB & = & CE & = & DF & = & ABCDEF \,.
\end{array}
$$
We can also find this design using `FrF2`, combining the arguments `generators` and `blocks`.
```{r frac-block}
ff.2.6.2.b.4 <- FrF2::FrF2(nruns = 16, nfactors = 6, generators = c("ABC", "ABD"), blocks = c("ACD", "BCD"),
randomize = F, alias.block.2fis = T, alias.info = 3)
design.info(ff.2.6.2.b.4)$aliased
design.info(ff.2.6.2.b.4)$aliased.with.blocks
```
One block of this design can be found by finding all the treatment combinations that satisfy, for example,
$$
ABCE = +1, ABDF = +1, ACD = -1, BCD = -1\,.
$$
Fixing values for $ABCE$ and $ABDF$, the other blocks are formed from the other 3 combinations of each of $ACD$ and $BCD$ being equal to $\pm 1$. We can also use `FrF2`.
```{r frac-block-design}
block12 <- ff.2.6.2.b.4[1:8, ]
block34 <- ff.2.6.2.b.4[9:16, ]
knitr::kable(cbind(block12, block34),
caption = "Fractional factorial
$2^{6-2}$ design in $b=4$ blocks of size $k=4$.",
align = "r")
```
:::
Analysis proceeds as before, except no factorial effect can be estimated that is within an alias string that is confounded with blocks. For Example, split the spring experiment from Example \@ref(exm:spring-experiment) into $b=2$ blocks of size $k=8$ using confounding the alias string $ABE = ACD$ with blocks.
```{r spring-blocks, warning = F}
spring.blocks <- spring
spring.blocks$blocks <- with(data.frame(spring), fac_to_numeric(A) * fac_to_numeric(B) * fac_to_numeric(C))
springb.lm <- lm(height ~ blocks + (A + B + C + D + E) ^ 3, data = spring.blocks)
anova(springb.lm)
```
## Exercises
1. A $2^{5-2}$ design has generators $ACD$ and $BCE$.
a. Write down the full defining relation. What resolution is this design?
b. After analysis, factor $E$ turns out to be unimportant. By assuming that all effects involving factor $E$ and all three-factor and higher-order interactions are negligible, determine which two-factor interactions can be estimated together with the four main effects of factors $A$, $B$, $C$ and $D$.
<details><summary><b>Solution</b></summary>
a. The full defining relation is
$$
I = ACD = BCE = ABDE\,.
$$
The shortest word in the defining relation has length three, and therefore the design has resolution III.
b. Consider the full aliasing scheme:
$$
\begin{array}{ccccccc}
A & = & CD & = & ABCE & = & BDE \\
B & = & ABCD & = & CE & = & ADE \\
C & = & AD & = & BE & = & ABCDE \\
D & = & AC & = & BCDE & = & ABE \\
E & = & ACDE & = & BC & = & ABD \\
AB & = & BCD & = & ACE & = & DE \\
AE & = & CDE & = & ABC & = & BD \\
\end{array}
$$
If all the factorial effects involving factor $E$ and all three-factor and higher-order interactions are negligible, we can estimate the two-factor interactions $AB$, $BC$ and $BD$ in addition to the main effects of the first four factors.
</details>
2. Consider the following two fractional factorial designs.
i. A $2^{6-2}$ design with generators $ABCDE$ and $ABDF$.
ii. A $2^{6-2}$ design with generators $ABCE$ and $ABDF$.
a. What is the resolution of each design?
b. Which design would be preferred under the criterion of minimum aberration?
c. For design ii., if we know that any two-factor interaction involving factor $F$ is negligible, which other two-factor interactions can be estimated under the assumption that three-factor and higher-order interactions are also negligible?
<details><summary><b>Solution</b></summary>
a. Design i. has full defining relation $I = ABCDE = ABDF = CEF$, and hence is resolution III. Design ii. has full defining relation $I = ABCE = ABDF = CDEF$, and hence is resolution IV.
b. Design ii. would be preferred under the citerion of minimum aberration, as it is of higher resolution.
c. The alias strings from design ii. including two-factor interactions are as below:
$$
\begin{array}{ccccccc}
AB & = & CE & = & DF & = & ABCDEF \\
AC & = & BE & = & BCDF & = & ADEF \\
AD & = & BCDE & = & BF & = & ACEF \\
AE & = & BC & = & BDEF & = & ACDF \\
AF & = & BCEF & = & BD & = & ACDE \\
CD & = & ABDE & = & ABCF & = & EF \\
CF & = & ABEF & = & ABCD & = & DE \\
\end{array}
$$
It follows that if all two-factor interactions that involve factor $F$ are neglible, along with all three-factor and higher-order interactions, then we can estimate two-factor interactions $AD$, $BD$, $CD$ and $DE$. The pairs of interactions $AB = CE$, $AC = BE$ and $AE = BC$ are still aliased together.
</details>
3.
a. Design an experiment with $n=8$ runs to study the effect of the following five factors on yield:
- $A$: temperature (160°F or 180°F)
- $B$: concentration (30% or 40%)
- $C$: catalyst (1 or 2)
- $D$: stirring rate (60 or 100 rpm)
- $E$: pH (low or high).
It is known that the combinations temperature 180°F, concentration 40%, stirring rate 100 rpm and temperature 180°F, catalyst 2, pH high may lead to disastrous results and should be avoided. Write down the design in coded (-1, +1) units.
b. For the five factors in part (a), find a design with $n=8$ runs such that the temperature-by-catalyst interaction ($AC$) and the concentration-by-catalyst ($BC$) interactions are neither aliased with main effects or with each other.
<details><summary><b>Solution</b></summary>
a. We require a $2^{5-2}$ fractional factorial design. We could choose to alias the $q=2$ interactions $ABD$ and $ACE$ wth the mean, along with their product $BCDE$.
We want to avoid fractions with $A = +1$, $B = +1$ and $D = +1$, and $A = +1$, $C = +1$ and $E = +1$. These lead to $ABD = +1$ and $ACE = +1$. Hence we just need to choose the fraction that sets both $ABD = -1$ and $ACE = -1$:
| Run | A | B | C | D | E |
| :-: | -: | -: | -: | -: | -: |
| 1 | -1 | -1 | -1 | -1 | -1 |
| 2 | -1 | +1 | +1 | +1 | +1 |
| 3 | -1 | -1 | +1 | -1 | +1 |
| 4 | -1 | +1 | -1 | +1 | -1 |
| 5 | +1 | -1 | +1 | +1 | -1 |
| 6 | +1 | +1 | -1 | -1 | +1 |
| 7 | +1 | -1 | -1 | +1 | +1 |
| 8 | +1 | +1 | +1 | -1 | -1 |
b. We need a $2^{5-2}$ fractional factorial design such that $AC$ and $BC$ are not alised with main effects or each other. Therefore, our defining relation cannot contain any three letter words contain $AC$ or $BC$. A design with defining relation
$$
I = ABDE = ABCE = CD
$$
has this property, as $AC = BCDE = BE = AD$ and $BC = ACDE = AE = BD$. There are also other choices that have this property.
[To find this design, I started with the alias strings I wanted for $AC$ and $BC$ and then worked backwards.]
</details>
4. An experimenter who wishes to use a $2^{8-2}$ design can only do 16 runs per day, and would like to include "day" as a blocking factor. What design would you recommend and why? Give the defining relation of the fraction you choose, and the defining generators for the blocks. Which two-factor interactions can be clearly estimated?
<details><summary><b>Solution</b></summary>
The minimum aberration resolution V design has defining relation $I = ABCDG = ABEFGH = CDEFH$ (there are other similar possibilities).
There are 64 alias strings (including the defining relation) and we need to choose two to define our blocks (remembering the product will also be confounded). Two good choices are
$$
ACE = BDEG = BCFGH = ADFH
$$
and
$$
BDF = ACFG = ADEGH = BCEH\,,
$$
with product
$$
ABCDEF = EFG = CDGH = ABH\,.
$$
This choice leads to no two-factor interactions being confounded with blocks and hence, as the fraction is resolution V, all two-factor interactions are clear of main effects and other two-factor interactions.
</details>