## maximin design from package lhs
plan <- lhs.design(20,7,"maximin",digits=2)
plan
plot(plan)
cor(plan)
y <- rnorm(20)
r.plan <- add.response(plan, y)
## augmenting the design with 10 additional points, default method
plan2 <- lhs.augment(plan, m=10)
plot(plan2)
cor(plan2)
## purely random design (usually not ideal)
plan3 <- lhs.design(20,4,"random",
factor.names=list(c(15,25), c(10,90), c(0,120), c(12,24)), digits=2)
plot(plan3)
cor(plan3)
## optimum design from package lhs (default)
plan4 <- lhs.design(20,4,"optimum",
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2)
plot(plan4)
cor(plan4)
## dmax design from package DiceDesign
## arguments range and niter_max are required
## ?dmaxDesign for more info
plan5 <- lhs.design(20,4,"dmax",
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2,
range=0.2, niter_max=500)
plot(plan5)
cor(plan5)
## Strauss design from package DiceDesign
## argument RND is required
## ?straussDesign for more info
plan6 <- lhs.design(20,4,"strauss",
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2,
RND = 0.2)
plot(plan6)
cor(plan6)
## full factorial design from package DiceDesign
## mini try-out version
plan7 <- lhs.design(3,4,"fact",
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2)
plot(plan7)
cor(plan7)
if (FALSE) {
## full factorial design from package DiceDesign
## not as many different levels as runs, but only a fixed set of levels
## caution: too many levels can easily bring down the computer
## above design with 7 distinct levels for each factor,
## implying 2401 runs
plan7 <- lhs.design(7,4,"fact",
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2)
plot(plan7)
cor(plan7)
## equivalent call
plan7 <- lhs.design(,4,"fact",nlevels=7,
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2)
## different number of levels for each factor
plan8 <- lhs.design(,4,"fact",nlevels=c(5,6,5,7),
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2)
plot(plan8)
cor(plan8)
## equivalent call (specifying nruns, not necessary but a good check)
plan8 <- lhs.design(1050,4,"fact",nlevels=c(5,6,5,7),
factor.names=list(torque=c(10,14),friction=c(25,35),
temperature=c(-5,35),pressure=c(20,50)),digits=2)
}
Run the code above in your browser using DataLab