## Range c(0,-1) returns the design produced by runif.faure()
plan1 <- runif.faure(n = 24, dimension = 5)$design ; plan1
plan2 <- faureprimeDesign(dimension = 5, range = c(0,-1))$design ; plan2
all.equal(plan1, plan2, tolerance = 1e-15)
## Range c(0,0) returns the original sequence of integers.
## The first (p-1) lines are on the first diagonal.
## The remaining lines are LHSs grouped in p-1 blocks of p rows.
d <- p <- 5
plan <- faureprimeDesign(dimension = d, range = c(0,0))$design ; plan
apply(plan, 2, sort)
## A regular grid (p-1)x(p+1) rotated by a small angle
pairs(plan)
plot(plan[,1], plan[,2], las = 1)
points(plan[1:(p-1),1], plan[1:(p-1),2], pch = 17, cex = 1.6)
abline(v = plan[1:(p-1),1], col = 4)
## Designs of dimensions 24x5 in various ranges
lstrg <- list(p0p0 = c(0,0), p1p1 = c(1,1), p0p1 = c(0,1),
p0m1 = c(0,-1), m1m1 = c(-1,-1), m1p1 = c(-1,1))
lst <- lapply(lstrg, function(rg) faureprimeDesign(
dimension = 5, u = 2, range = rg)$design)
lapply(lst, tail)
sapply(lst, range)
## The odd designs (p1m1, m1m1, m1p1) are orthogonal and have resolution 4.
library(lattice)
mat <- lst$m1m1 ; colnames(mat) <- LETTERS[1:5]
fml <- ~ (A+B+C+D+E)^2+I(A^2)+I(B^2)+I(C^2)+I(D^2)+I(E^2)
mmm <- model.matrix(fml, data = as.data.frame(mat))[,-1] ; tail(mmm)
cmm <- round(cov2cor(crossprod(mmm)), 3) ; cmm
lattice::levelplot(cmm[, ncol(cmm):1], at = seq(-1, 1, length.out = 10),
col.regions = rev(grDevices::hcl.colors(9, "PuOr")))
Run the code above in your browser using DataLab