ocheck and ocheck3 evaluate pairwise or 3-orthogonality of columns, count_npairs evaluates the number of level pairs in 2D projections, count_nallpairs calculates corresponding total numbers of pairs.

ocheck(D, verbose = FALSE)

ocheck3(D, verbose = FALSE)

count_npairs(D, minn = 1)

count_nallpairs(ns)

Arguments

D

a matrix with factor levels or an object of class SOA;
factor levels can start with 0 or with 1, and need to be consecutively numbered

verbose

logical; if TRUE, additional information is printed (table of correlations)

minn

small integer number; the function counts pairs that are covered at least minn times

ns

vector of numbers of levels for each column

Value

Functions ocheck and ocheck3 return a logical.

Functions count_npairs returns a vector of counts for level combinations covered in factor pairs (in the order of the columns of DoE.base:::nchoosek(ncol(D),2)) for the array in D,

function count_nallpairs provides the total number of level combinations for designs with numbers of levels given in ns (and thus can be used to obtain a denominator for count_npairs).

Author

Ulrike Groemping

Examples

#' ## Shi and Tang strength 3+ construction in 7 8-level factors for 32 runs
D <- SOAs_8level(32, optimize=FALSE)
## is an OSOA
ocheck(D)
#> [1] TRUE

## an OSOA of strength 3 with 3-orthogonality
## 4 columns in 27 levels each
## second order model matrix

D_o <- OSOAs_LiuLiu(DoE.base::L81.3.10, optimize=FALSE)
ocheck3(D_o)
#> [1] TRUE

## benefit of 3-orthogonality for second order linear models
colnames(D_o) <- paste0("X", 1:4)
y <- stats::rnorm(81)
mylm <- stats::lm(y~(X1+X2+X3+X4)^2 + I(X1^2)+I(X2^2)+I(X3^2)+I(X4^2),
                   data=as.data.frame(scale(D_o, scale=FALSE)))
crossprod(stats::model.matrix(mylm))
#>             (Intercept)   X1   X2   X3   X4 I(X1^2) I(X2^2) I(X3^2) I(X4^2)
#> (Intercept)          81    0    0    0    0    4914    4914    4914    4914
#> X1                    0 4914    0    0    0       0       0       0       0
#> X2                    0    0 4914    0    0       0       0       0       0
#> X3                    0    0    0 4914    0       0       0       0       0
#> X4                    0    0    0    0 4914       0       0       0       0
#> I(X1^2)            4914    0    0    0    0  535626  289368  315612  289368
#> I(X2^2)            4914    0    0    0    0  289368  535626  298116  289368
#> I(X3^2)            4914    0    0    0    0  315612  298116  535626  289368
#> I(X4^2)            4914    0    0    0    0  289368  289368  289368  535626
#> X1:X2                 0    0    0    0    0   38880  -38880       0   39852
#> X1:X3                 0    0    0    0    0    8748   74844    2916   -1458
#> X1:X4                 0    0    0    0    0       0   -4266   13014       0
#> X2:X3                 0    0    0    0    0   34668  -26244   26244    4212
#> X2:X4                 0    0    0    0    0    -486    2916   79218   -4374
#> X3:X4                 0    0    0    0    0   78246    -972   38880  -38880
#>              X1:X2  X1:X3  X1:X4  X2:X3  X2:X4  X3:X4
#> (Intercept)      0      0      0      0      0      0
#> X1               0      0      0      0      0      0
#> X2               0      0      0      0      0      0
#> X3               0      0      0      0      0      0
#> X4               0      0      0      0      0      0
#> I(X1^2)      38880   8748      0  34668   -486  78246
#> I(X2^2)     -38880  74844  -4266 -26244   2916   -972
#> I(X3^2)          0   2916  13014  26244  79218  38880
#> I(X4^2)      39852  -1458      0   4212  -4374 -38880
#> X1:X2       289368  34668   -486  74844  -4266   4401
#> X1:X3        34668 315612  78246      0   4401  13014
#> X1:X4         -486  78246 289368   4401  39852  -1458
#> X2:X3        74844      0   4401 298116   -972  79218
#> X2:X4        -4266   4401  39852   -972 289368   4212
#> X3:X4         4401  13014  -1458  79218   4212 289368