### for examples on design generation, cf. functions pb and FrF2
### Injection Molding Experiment. Box et al. 1978.
## data(BM93.e3.data, package="BsMD") #from BsMD
## iMdat <- BM93.e3.data[1:16,2:10] #only original experiment
## re-create here
y=c(14, 16.8, 15, 15.4, 27.6, 24, 27.4, 22.6,
22.3, 17.1, 21.5, 17.5, 15.9, 21.9, 16.7, 20.3)
iMdat <- FrF2(8,7,randomize=FALSE)
iMdat <- desnum(iMdat)
iMdat <- rbind(cbind(iMdat,H=1),cbind(-iMdat,H=-1))
iMdat <- cbind(as.data.frame(iMdat), y=y)
# make data more user-friendly
colnames(iMdat) <- c("MoldTemp","Moisture","HoldPress","CavityThick","BoostPress",
"CycleTime","GateSize","ScrewSpeed", "y")
# linear model with all main effects and 2-factor interactions
iM.lm <- lm(y ~ (.)^2, data = iMdat)
# determine aliases
aliases(iM.lm)
# coded version
aliases(iM.lm, code=TRUE)
# normal plot of effects, default is autolabel with alpha=0.05
DanielPlot(iM.lm)
DanielPlot(iM.lm,code=TRUE)
DanielPlot(iM.lm,code=TRUE,alpha=0.5)
# half normal plot of effects
DanielPlot(iM.lm,code=TRUE,alpha=0.5,half=TRUE)
# main effects plots
MEPlot(iM.lm, las=1)
# interaction plots
IAPlot(iM.lm, las=1)
# interaction plots with attention drawn to aliases
aus <- IAPlot(iM.lm, show.alias=TRUE)
# alias groups corresponding to interaction plots
aliases(iM.lm)$aliases[9:15]
# returned object
aus
# cube plot of three factors
# (not very useful for this model, for demonstration only)
## per default, modeled means are shown
## this does not make a difference here, since the main effect of
## ScrewSpeed is confounded with the MoldTemp:HoldPress:BoostPress
## interaction, so that the three-factor-interaction is indirectly included
## in the modeled means
cubePlot(iM.lm, "MoldTemp", "HoldPress", "BoostPress")
## modeled means without a three-factor interaction
cubePlot(lm(y ~ (MoldTemp+HoldPress+BoostPress)^2, data = iMdat),
"MoldTemp", "HoldPress", "BoostPress")
## modeled=FALSE reverts to showing the apparent three-factor interaction
cubePlot(lm(y ~ (MoldTemp+HoldPress+BoostPress)^2, data = iMdat),
"MoldTemp", "HoldPress", "BoostPress", modeled=FALSE)
## cubePlot also works on raw data
cubePlot(iMdat$y, iMdat$MoldTemp, iMdat$HoldPress, iMdat$BoostPress)
## plotting functions also work directly on designs,
## if these have been generated from functions FrF2 or pb:
plan <- FrF2(16, 7)
plan <- add.response(plan, rnorm(16))
MEPlot(plan)
IAPlot(plan)
DanielPlot(plan)
Run the code above in your browser using DataLab