## smallest available array for 6 factors with 3 levels each
oa.design(nfactors=6,nlevels=3)
## level combination for which only a full factorial is (currently) found
oa.design(nlevels=c(4,3,3,2))
## array requested via factor.names
oa.design(factor.names=list(one=c("a","b","c"), two=c(125,275), three=c("old","new"), four=c(-1,1), five=c("min","medium","max")))
## array requested via character factor.names and nlevels (with a little German lesson for one two three four five)
oa.design(factor.names=c("eins","zwei","drei","vier","fuenf"),nlevels=c(2,2,2,3,7))
## array requested via explicit name, Taguchi L18
oa.design(ID=L18)
## array requested via explicit name, with column selection
oa.design(ID=L18.3.6.6.1,columns=c(2,3,7))
## array requested with nruns, not very reasonable
oa.design(nruns=12, nfactors=3, nlevels=2)
## array requested with min.residual.df
oa.design(nfactors=3, nlevels=2, min.residual.df=12)
## The last example:
## generate an orthogonal array equivalent to Taguchi's L54.2.1.3.25 array
## (which is not currently included) up to swaps of levels within a factor
## for some of the factors J to a (i.e. factors 9 to 26)
## by combining L54.3.18.18.1 with L18.2.1.3.7
## look at catalogued designs for checking possibilities first
## assign class such that design is usable in function oa.design
## assign attributes for documentation purpose
oacat[oacat$nruns==54,]$name
##L54.3.18.18.1 looks most promising
oacat[oacat$nruns==18,]$name
##L18.2.1.3.7 will deliver one 2-level and 25 3-level factors
##(it can itself be generated from L18.3.6.6.1 by nesting L6.2.1.3.1)
parent.des <- oa.design(ID=L54.3.18.18.1, nlevels=c(rep(3,18),18),factor.names=c(Letters[9:26],"comb"))
nest.des <- oa.design(ID=L18.2.1.3.7)
L54.2.1.3.25 <- cbind(nest.des[parent.des$comb,], parent.des)[-27]
rownames(L54.2.1.3.25) <- rownames(parent.des)
L54.2.1.3.25[ord(L54.2.1.3.25),] ## look at sorted array
## prepare for using it with function oa.design
## (ordering it is not necessary, just **tidy**)
L54.2.1.3.25 <- as.matrix(L54.2.1.3.25[ord(L54.2.1.3.25),])
class(L54.2.1.3.25) <- c("oa", "matrix")
attr(L54.2.1.3.25, "origin") <- "L54.3.18.18.1, 18.1 -> L18.2.1.3.7"
attr(L54.2.1.3.25, "comment") <- comment(L18.2.1.3.7)
## can now be used in oa.design, like the built-in arrays
oa.design(ID=L54.2.1.3.25,nfactors=22,nlevels=3)
Run the code above in your browser using DataLab