#install.packages("FrF2")
library(FrF2)
## Warning: package 'FrF2' was built under R version 4.1.2
## Loading required package: DoE.base
## Loading required package: grid
## Loading required package: conf.design
## Registered S3 method overwritten by 'DoE.base':
## method from
## factorize.factor conf.design
##
## Attaching package: 'DoE.base'
## The following objects are masked from 'package:stats':
##
## aov, lm
## The following object is masked from 'package:graphics':
##
## plot.design
## The following object is masked from 'package:base':
##
## lengths
# Question 8.2
# From Problem 6.15, only a one-half fraction of the 2^4 design of
# 1 replicant
des.R4 <- FrF2(nfactors=4, resolution=4,randomize=FALSE)
observations<-c(7.037,16.867,13.876,17.273,11.846,4.368,9.360,15.653)
des.response <- add.response(des.R4,observations)
DanielPlot(des.response,half=TRUE)
MEPlot(des.response,show.alias=TRUE)
# From the half Normal plot for observations it shows that there are nothing
# significant in the plot
# From ME PLOT B and D has only little deviation from mean compared to other main effects A,C .
# Question 8.24
# It is a 2^5-1 design.
des.R5 <- FrF2(nfactors=5,blocks=2,nruns=16,randomize=FALSE)
aliasprint(des.R5)
## $legend
## [1] A=A B=B C=C D=D E=E
##
## $main
## character(0)
##
## $fi2
## [1] AB=CE AC=BE AE=BC
summary(des.R5)
## Call:
## FrF2(nfactors = 5, blocks = 2, nruns = 16, randomize = FALSE)
##
## Experimental design of type FrF2.blocked
## 16 runs
## blocked design with 2 blocks of size 8
##
## Factor settings (scale ends):
## A B C D E
## 1 -1 -1 -1 -1 -1
## 2 1 1 1 1 1
##
## Design generating information:
## $legend
## [1] A=A B=B C=C D=D E=E
##
## $`generators for design itself`
## [1] E=ABC
##
## $`block generators`
## [1] ABD
##
##
## Alias structure:
## $fi2
## [1] AB=CE AC=BE AE=BC
##
## Aliased with block main effects:
## [1] none
##
## The design itself:
## run.no run.no.std.rp Blocks A B C D E
## 1 1 1.1.1 1 -1 -1 -1 -1 -1
## 2 2 3.1.2 1 -1 -1 1 -1 1
## 3 3 6.1.3 1 -1 1 -1 1 1
## 4 4 8.1.4 1 -1 1 1 1 -1
## 5 5 10.1.5 1 1 -1 -1 1 1
## 6 6 12.1.6 1 1 -1 1 1 -1
## 7 7 13.1.7 1 1 1 -1 -1 -1
## 8 8 15.1.8 1 1 1 1 -1 1
## run.no run.no.std.rp Blocks A B C D E
## 9 9 2.2.1 2 -1 -1 -1 1 -1
## 10 10 4.2.2 2 -1 -1 1 1 1
## 11 11 5.2.3 2 -1 1 -1 -1 1
## 12 12 7.2.4 2 -1 1 1 -1 -1
## 13 13 9.2.5 2 1 -1 -1 -1 1
## 14 14 11.2.6 2 1 -1 1 -1 -1
## 15 15 14.2.7 2 1 1 -1 1 -1
## 16 16 16.2.8 2 1 1 1 1 1
## class=design, type= FrF2.blocked
## NOTE: columns run.no and run.no.std.rp are annotation,
## not part of the data frame
# From the result , Interactions NONE of them are confounded with the blocks
# block is confuded only with ABD
# Question 8.25
# It is a 2^7-2 design.
des.R5 <- FrF2(nfactors=7,
blocks=4,nruns=32,randomize=FALSE)
summary(des.R5)
## Call:
## FrF2(nfactors = 7, blocks = 4, nruns = 32, randomize = FALSE)
##
## Experimental design of type FrF2.blocked
## 32 runs
## blocked design with 4 blocks of size 8
##
## Factor settings (scale ends):
## A B C D E F G
## 1 -1 -1 -1 -1 -1 -1 -1
## 2 1 1 1 1 1 1 1
##
## Design generating information:
## $legend
## [1] A=A B=B C=C D=D E=E F=F G=G
##
## $`generators for design itself`
## [1] F=ABC G=ABD
##
## $`block generators`
## [1] ACD ABE
##
##
## Alias structure:
## $fi2
## [1] AB=CF=DG AC=BF AD=BG AF=BC AG=BD CD=FG CG=DF
##
## Aliased with block main effects:
## [1] none
##
## The design itself:
## run.no run.no.std.rp Blocks A B C D E F G
## 1 1 1.1.1 1 -1 -1 -1 -1 -1 -1 -1
## 2 2 7.1.2 1 -1 -1 1 1 -1 1 1
## 3 3 10.1.3 1 -1 1 -1 -1 1 1 1
## 4 4 16.1.4 1 -1 1 1 1 1 -1 -1
## 5 5 20.1.5 1 1 -1 -1 1 1 1 -1
## 6 6 22.1.6 1 1 -1 1 -1 1 -1 1
## 7 7 27.1.7 1 1 1 -1 1 -1 -1 1
## 8 8 29.1.8 1 1 1 1 -1 -1 1 -1
## run.no run.no.std.rp Blocks A B C D E F G
## 9 9 2.2.1 2 -1 -1 -1 -1 1 -1 -1
## 10 10 8.2.2 2 -1 -1 1 1 1 1 1
## 11 11 9.2.3 2 -1 1 -1 -1 -1 1 1
## 12 12 15.2.4 2 -1 1 1 1 -1 -1 -1
## 13 13 19.2.5 2 1 -1 -1 1 -1 1 -1
## 14 14 21.2.6 2 1 -1 1 -1 -1 -1 1
## 15 15 28.2.7 2 1 1 -1 1 1 -1 1
## 16 16 30.2.8 2 1 1 1 -1 1 1 -1
## run.no run.no.std.rp Blocks A B C D E F G
## 17 17 3.3.1 3 -1 -1 -1 1 -1 -1 1
## 18 18 5.3.2 3 -1 -1 1 -1 -1 1 -1
## 19 19 12.3.3 3 -1 1 -1 1 1 1 -1
## 20 20 14.3.4 3 -1 1 1 -1 1 -1 1
## 21 21 18.3.5 3 1 -1 -1 -1 1 1 1
## 22 22 24.3.6 3 1 -1 1 1 1 -1 -1
## 23 23 25.3.7 3 1 1 -1 -1 -1 -1 -1
## 24 24 31.3.8 3 1 1 1 1 -1 1 1
## run.no run.no.std.rp Blocks A B C D E F G
## 25 25 4.4.1 4 -1 -1 -1 1 1 -1 1
## 26 26 6.4.2 4 -1 -1 1 -1 1 1 -1
## 27 27 11.4.3 4 -1 1 -1 1 -1 1 -1
## 28 28 13.4.4 4 -1 1 1 -1 -1 -1 1
## 29 29 17.4.5 4 1 -1 -1 -1 -1 1 1
## 30 30 23.4.6 4 1 -1 1 1 -1 -1 -1
## 31 31 26.4.7 4 1 1 -1 -1 1 -1 -1
## 32 32 32.4.8 4 1 1 1 1 1 1 1
## class=design, type= FrF2.blocked
## NOTE: columns run.no and run.no.std.rp are annotation,
## not part of the data frame
# From the Result, none of them are confounded with the blocks
# Blocks are confounded with ACD and ABE
# Question 8.28
des.R6 <- FrF2(nfactors = 6,nruns = 16,generators = c("ABC","ACD"), randomize = FALSE)
des.R6
## A B C D E F
## 1 -1 -1 -1 -1 -1 -1
## 2 1 -1 -1 -1 1 1
## 3 -1 1 -1 -1 1 -1
## 4 1 1 -1 -1 -1 1
## 5 -1 -1 1 -1 1 1
## 6 1 -1 1 -1 -1 -1
## 7 -1 1 1 -1 -1 1
## 8 1 1 1 -1 1 -1
## 9 -1 -1 -1 1 -1 1
## 10 1 -1 -1 1 1 -1
## 11 -1 1 -1 1 1 1
## 12 1 1 -1 1 -1 -1
## 13 -1 -1 1 1 1 -1
## 14 1 -1 1 1 -1 1
## 15 -1 1 1 1 -1 -1
## 16 1 1 1 1 1 1
## class=design, type= FrF2.generators
summary(des.R6)
## Call:
## FrF2(nfactors = 6, nruns = 16, generators = c("ABC", "ACD"),
## randomize = FALSE)
##
## Experimental design of type FrF2.generators
## 16 runs
##
## Factor settings (scale ends):
## A B C D E F
## 1 -1 -1 -1 -1 -1 -1
## 2 1 1 1 1 1 1
##
## Design generating information:
## $legend
## [1] A=A B=B C=C D=D E=E F=F
##
## $generators
## [1] E=ABC F=ACD
##
##
## Alias structure:
## $fi2
## [1] AB=CE AC=BE=DF AD=CF AE=BC AF=CD BD=EF BF=DE
##
##
## The design itself:
## A B C D E F
## 1 -1 -1 -1 -1 -1 -1
## 2 1 -1 -1 -1 1 1
## 3 -1 1 -1 -1 1 -1
## 4 1 1 -1 -1 -1 1
## 5 -1 -1 1 -1 1 1
## 6 1 -1 1 -1 -1 -1
## 7 -1 1 1 -1 -1 1
## 8 1 1 1 -1 1 -1
## 9 -1 -1 -1 1 -1 1
## 10 1 -1 -1 1 1 -1
## 11 -1 1 -1 1 1 1
## 12 1 1 -1 1 -1 -1
## 13 -1 -1 1 1 1 -1
## 14 1 -1 1 1 -1 1
## 15 -1 1 1 1 -1 -1
## 16 1 1 1 1 1 1
## class=design, type= FrF2.generators
# a. Quater fraction of 2^6 design is used, in which there are 2^4 equals to 16 runs are present.
# b.
aliasprint(des.R6)
## $legend
## [1] A=A B=B C=C D=D E=E F=F
##
## $main
## character(0)
##
## $fi2
## [1] AB=CE AC=BE=DF AD=CF AE=BC AF=CD BD=EF BF=DE
# c.
observations <- c(0.0167,0.0062,0.0041,0.0073,0.0047,0.0219,0.0121,0.0255,0.0032,0.0078,0.0043,0.0186,0.0110,0.0065,0.0155,0.0093,
0.0128,0.0066,0.0043,0.0081,0.0047,0.0258,0.0090,0.0250,0.0023,0.0158,0.0027,0.0137,0.0086,0.0109,0.0158,0.0124,
0.0149,0.0044,0.0042,0.0039,0.0040,0.0147,0.0092,0.0226,0.0077,0.0060,0.0028,0.0158,0.0101,0.0126,0.0145,0.0110,
0.0185,0.0020,0.0050,0.0030,0.0089,0.0296,0.0086,0.0169,0.0069,0.0045,0.0028,0.0159,0.0158,0.0071,0.0145,0.0133)
A <- rep(des.R6$A,4)
B <- rep(des.R6$B,4)
C <- rep(des.R6$C,4)
D <- rep(des.R6$D,4)
E <- rep(des.R6$E,4)
F <- rep(des.R6$F,4)
model <- aov(observations~A*B*C*D*E*F)
summary(model)
## Df Sum Sq Mean Sq F value Pr(>F)
## A 1 0.0002422 0.0002422 27.793 3.17e-06 ***
## B 1 0.0000053 0.0000053 0.614 0.43725
## C 1 0.0005023 0.0005023 57.644 9.14e-10 ***
## D 1 0.0000323 0.0000323 3.712 0.05995 .
## E 1 0.0001901 0.0001901 21.815 2.45e-05 ***
## F 1 0.0009602 0.0009602 110.192 5.05e-14 ***
## A:B 1 0.0000587 0.0000587 6.738 0.01249 *
## A:C 1 0.0000803 0.0000803 9.218 0.00387 **
## B:C 1 0.0000527 0.0000527 6.053 0.01754 *
## A:D 1 0.0000239 0.0000239 2.741 0.10431
## B:D 1 0.0000849 0.0000849 9.739 0.00305 **
## C:D 1 0.0000622 0.0000622 7.139 0.01027 *
## D:E 1 0.0000088 0.0000088 1.007 0.32062
## A:B:D 1 0.0000000 0.0000000 0.005 0.94291
## B:C:D 1 0.0000481 0.0000481 5.523 0.02293 *
## Residuals 48 0.0004183 0.0000087
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### Process Variables A,C,E,F affect the average camber for replicate
# d)
sd <- c(24.418,20.976,4.083,25.025,22.410,63.639,16.029,39.42,26.725,50.341,7.681,20.083,31.12,29.51,6.75,17.45)
model1 <- aov(sd~A*B*C*D*E*F ,data = des.R6)
halfnormal(model1,ME.partial = TRUE)
##
## The following effects are completely aliased:
## [1] A:E B:E C:E A:F B:F C:F
## [7] D:F E:F A:B:C A:C:D A:B:E A:C:E
## [13] B:C:E A:D:E B:D:E C:D:E A:B:F A:C:F
## [19] B:C:F A:D:F B:D:F C:D:F A:E:F B:E:F
## [25] C:E:F D:E:F A:B:C:D A:B:C:E A:B:D:E A:C:D:E
## [31] B:C:D:E A:B:C:F A:B:D:F A:C:D:F B:C:D:F A:B:E:F
## [37] A:C:E:F B:C:E:F A:D:E:F B:D:E:F C:D:E:F A:B:C:D:E
## [43] A:B:C:D:F A:B:C:E:F A:B:D:E:F A:C:D:E:F B:C:D:E:F A:B:C:D:E:F
##
## Significant effects (alpha=0.05, Lenth method):
## [1] B1 A1
# process variables A1 and B1 affect the variability in camber measurements.
# e.
A<-aov(observations~A*B*C*D*E*F,)
MEPlot(A,show.alias=TRUE)
# question 8.40
# a. This problem has 4 factors
# b. This is a resolution 4 design because no main effects are aliased with another main effect or with a two-factor interaction, but two-factor interactions are aliased with each other.
# c.
des.R <- FrF2(nfactors=4, resolution=4,randomize=FALSE)
observations1<-c(8,10,12,7,13,6,5,11)
des.R <- add.response(des.R,observations1)
summary(des.R)
## Call:
## FrF2(nfactors = 4, resolution = 4, randomize = FALSE)
##
## Experimental design of type FrF2
## 8 runs
##
## Factor settings (scale ends):
## A B C D
## 1 -1 -1 -1 -1
## 2 1 1 1 1
##
## Responses:
## [1] observations1
##
## Design generating information:
## $legend
## [1] A=A B=B C=C D=D
##
## $generators
## [1] D=ABC
##
##
## Alias structure:
## $fi2
## [1] AB=CD AC=BD AD=BC
##
##
## The design itself:
## A B C D observations1
## 1 -1 -1 -1 -1 8
## 2 1 -1 -1 1 10
## 3 -1 1 -1 1 12
## 4 1 1 -1 -1 7
## 5 -1 -1 1 1 13
## 6 1 -1 1 -1 6
## 7 -1 1 1 -1 5
## 8 1 1 1 1 11
## class=design, type= FrF2
# C.
A <- rep(c(-1,1),4)
B <- rep(c(rep(-1,2),rep(1,2)),2)
C <- c(rep(-1,4),rep(1,4))
D <- A*B*C
model2 <- aov(observations1~A*B*C*D)
coef(model2)
## (Intercept) A B C D A:B
## 9.00 -0.50 -0.25 -0.25 2.50 0.75
## A:C B:C
## 0.25 -0.50
# d.
# The complete defining relationship for this design is I = ABCD.
# Question 8.48
des.R4 <- FrF2(nfactors=5,nruns=8,generators=c("-ABC","BC"),randomize=FALSE)
des.R4
## 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
## class=design, type= FrF2.generators
# a. The generator for column D is -ABC
# b. The generator for column E is BC
# c. The design becomes a resolution 4, folding adds 1 to the resolution. As the original design was a 3 resolution.
# QUESTION 8.60
# This is partial fold over 2^7-4 3 Resolution for the design.
des.R3 <- FrF2(nfactors=7, resolution=3,randomize=FALSE)
model3 <- fold.design(des.R3,column=1)
summary(model3)
## Multi-step-call:
## [[1]]
## FrF2(nfactors = 7, resolution = 3, randomize = FALSE)
##
## $fold
## [1] 1
##
##
## Experimental design of type FrF2.folded
## 16 runs
##
## Factor settings (scale ends):
## A B C fold D E F G
## 1 -1 -1 -1 original -1 -1 -1 -1
## 2 1 1 1 mirror 1 1 1 1
##
## Design generating information:
## $legend
## [1] A=A B=B C=C D=fold E=D F=E G=F H=G
##
##
## Alias structure:
## $main
## [1] B=CG=FH C=BG=EH E=CH=FG F=BH=EG G=BC=EF H=BF=CE
##
## $fi2
## [1] AB=-DE AC=-DF AD=-BE=-CF=-GH AE=-BD AF=-CD
## [6] AG=-DH AH=-DG
##
##
## The design itself:
## A B C fold D E F G
## 1 -1 -1 -1 original 1 1 1 -1
## 2 1 -1 -1 original -1 -1 1 1
## 3 -1 1 -1 original -1 1 -1 1
## 4 1 1 -1 original 1 -1 -1 -1
## 5 -1 -1 1 original 1 -1 -1 1
## 6 1 -1 1 original -1 1 -1 -1
## 7 -1 1 1 original -1 -1 1 -1
## 8 1 1 1 original 1 1 1 1
## 9 1 -1 -1 mirror 1 1 1 -1
## 10 -1 -1 -1 mirror -1 -1 1 1
## 11 1 1 -1 mirror -1 1 -1 1
## 12 -1 1 -1 mirror 1 -1 -1 -1
## 13 1 -1 1 mirror 1 -1 -1 1
## 14 -1 -1 1 mirror -1 1 -1 -1
## 15 1 1 1 mirror -1 -1 1 -1
## 16 -1 1 1 mirror 1 1 1 1
## class=design, type= FrF2.folded
```