recursiveBoseHartman: function to increase numbers of columns for strength 2 CA in...

View source: R/recursiveBoseHartman.R

recursiveBoseHartmanR Documentation

function to increase numbers of columns for strength 2 CA in q levels (q prime power) from k to kq+1

Description

applies construction principle of Hartman (2005) Thm 7.1 and Corollary 7.2

Usage

recursiveBoseHartman(q, A=NULL, d=NULL, ...)

N_k_recursiveBoseHartman_A(q, A, ...)

N_k_recursiveBoseHartman_d(q, d=2, ...)

N_d_recursiveBoseHartman(q, k, ...)

Arguments

q

a prime or prime power number of levels

A

NULL, or a uniform CA of strength 2 in N rows and k columns with integer-valued levels (0 to q-1 or 1 to q). A takes precedence over d.

d

NULL, or a small positive integer; 1 returns the Bose OA (q^2 x (q+1)), d>1 the processed Bose OA in d*(q^2) - (d-1)*q runs and q^d+q^(d-1)+...+q+1 columns.
For recursiveBose, if A is specified, d is ignored.
For k_recursiveBose, the default is d=2 for N=2q^2 - q; it can be increased, if k is too small; each increase by 1 will increase N by q^2 - q

...

currently not used

k

the number of columns requested

Value

recursiveBoseHartman returns a uniform strength 2 CA with q level columns.
If neither A nor d are specified, the result has 2q^2 - q rows and q^2 + q + 1 columns, levels are coded from 0 to q - 1.
If A is specified, the result has N + q^2 - q rows and q*k + q + 1 columns, in the same coding as A.
If d is specified and A=NULL, the result has d*q^2 - (d-1)*q rows and sum_i=0^d q^i columns, coded from 0 to q-1.
N_k_recursiveBoseHartman_A returns a named vector with the run size N and the number of columns k for given q and A.
k_recursiveBoseHartman returns the number of columns k for given q and d.
N_d_recursiveBoseHartman returns a named vector with the run size N, the d for its creation for the requested number of columns k, and the maximum possible number of columns kmax for that construction.

Details

The function uses a method presented by Hartman (2005) (Theorem 7.1 and Corollary 7.2). For A=NULL, the function uses lhs::createBose(q, q+1, bRandom=FALSE) for creating A The user can specify any uniform strength 2 CA for A; the extension to more columns and runs will always use the Bose OA without the first q rows, and thus always add q^2-q rows.

Examples

dim(D <- recursiveBoseHartman(3))
eCAN(2,13,3)  ## optimal
dim(recursiveBoseHartman(3, d=2))
dim(D2 <- recursiveBoseHartman(3, D))
eCAN(2,40,3)  ## reasonably close to optimal
dim(recursiveBoseHartman(3, d=3))
dim(D3 <- recursiveBoseHartman(3, D2))
eCAN(2,121,3)  ## still reasonably close to optimal
dim(recursiveBoseHartman(3,d=4))

## constructions with A=NULL are optimal
for (q in c(4,5,7,9,11,13,16)){
  D <- recursiveBoseHartman(q)
  cat(paste0("q=", q, "\n"))
  cat(paste0("constructed: ",
     paste(paste0(c("N=","ncolumns="),dim(D)), collapse=", "), "\n"))
  Nopt <- eCAN(2,ncol(D),q)[1]   ## optimal
  cat(paste0("optimal for ", ncol(D), " columns: ", Nopt, " runs\n"))
}

#' ## constructions of first recursion are optimal or reasonably close
for (q in c(4,5,7,9,11,13,16)){
  D <- recursiveBoseHartman(q)
  D <- recursiveBoseHartman(q, D)
  cat(paste0("q=", q, "\n"))
  cat(paste0("constructed: ",
     paste(paste0(c("N=","ncolumns="),dim(D)), collapse=", "), "\n"))
  Nopt <- eCAN(2,ncol(D),q)[1]   ## optimal
  cat(paste0("optimal for ", ncol(D), " columns: ", Nopt, " runs\n"))
}

## a general A, an OA in 11 5-level columns at strength 2
## coded starting with 1
A <- matrix(as.numeric(as.matrix(
     DoE.base::oa.design(nlevels=rep(5,11), randomize=FALSE))),
   nrow=50)
head(A)
## number of columns increased from 11 to 56
## number of rows increased by 5^2 - 5 = 20
## still strength 2
dim(D <- recursiveBoseHartman(5, A))
coverage(D, 2, start0=FALSE)
## 25% more runs than the best CA
eCAN(2,56,5)

## recursive with d=1
recursiveBose(3,d=1)

## query functions
N_k_recursiveBoseHartman_A(4, lhs::createBose(4, 5))
N_k_recursiveBoseHartman_d(4,4)
N_d_recursiveBoseHartman(4, 12)


CAs documentation built on Nov. 29, 2026, 1:06 a.m.