# The Orthogonal Array Package

The Orthogonal Array package (OApackage) is a software package to generate and analyse orthogonal arrays, optimal designs and conference designs. On this website we present results generated with the package. Documentation for the package itself can be found at oapackage.readthedocs.io.

# Example usage

The package can be used from Python or as a C++ library. There is also a command line, Matlab and R interface to part of the functionality. An example Python session:

```
>>> import oapackage
>>> al=oapackage.exampleArray(0)
>>> al.showarray()
array:
0 0
0 0
0 1
0 1
1 0
1 0
1 1
1 1
>>> print('D-efficiency %f, rank %d' % (al.Defficiency(), al.rank()) )
D-efficiency 1.000000, rank 2
>>> print('Generalized wordlength pattern: %s' % str(al.GWLP()))
Generalized wordlength pattern: (1.0, 0.0, 0.0)
```

# Features

### Enumeration of orthogonal arrays

The software can be used to generate complete series of mixed-level orthogonal arrays. For results of the generation also see the page complete series.

The code is based on the article Complete Enumeration of Pure-Level and Mixed-Level Orthogonal Arrays, Journal of Combinatorial Designs, Volume 18, Issue 2, pages 123-140, 2010. For more information please contact the authors.

### Reduction of arrays to normal form

Both lexicographic minimal form and delete-one-factor normal form are supported.

```
>>> al=oapackage.exampleArray(2,verbose=1).randomperm()
exampleArray: array 6 in OA(16, 2, 2^6)
>>> al.showarray()
array:
0 1 1 0 1 0
0 0 1 1 0 1
1 1 1 0 1 1
0 0 1 0 1 0
1 1 0 0 1 1
1 1 1 1 0 0
0 1 0 1 0 1
0 0 1 1 1 1
1 0 0 1 1 0
1 0 1 0 0 1
1 0 0 1 1 0
1 1 1 1 0 0
0 0 0 0 0 0
1 0 0 0 0 1
0 1 0 0 0 0
0 1 0 1 1 1
>>> al.reduceLMC().showarray()
array:
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 1 1 1
0 0 0 1 1 1
0 1 1 0 0 1
0 1 1 0 1 0
0 1 1 1 0 1
0 1 1 1 1 0
1 0 1 0 0 1
1 0 1 0 1 1
1 0 1 1 0 0
1 0 1 1 1 0
1 1 0 0 1 0
1 1 0 0 1 1
1 1 0 1 0 0
1 1 0 1 0 1
```

### Calculation of optimal arrays using compound criterea

The package can generate designs with good efficiencies using compound optimalization functions. For example to optimize designs for the criterium \(D + 2 D_s \), we can use:```
>>> N=24; ncols=8
>>> arrayclass=oapackage.arraydata_t(2, N, 0, ncols)
>>> results=oapackage.Doptimize(arrayclass, nrestarts=10, optimfunc=[1,2,0], nout=1)
Doptim: optimization class 24.2-2-2-2-2-2-2-2
Doptimize: iteration 0/10
Doptimize: iteration 9/10
Doptim: done (1 arrays, 0.3 [s])
>>> A=results[2][0]
>>> print('best design: D-efficiency %.3f' % A.Defficiency() )
best design: D-efficiency 0.000
>>> print('best design: PEC sequence %s' % (oapackage.PECsequence(A), ) )
best design: PEC sequence (1.0, 1.0, 1.0, 0.9857142857142858, 0.875, 0.17857142857142858, 0.0, 0.0)
>>>
```

### Statistical properties of arrays

The software can calculate several statistics of arrays. These include various types of efficiencies for model estimation, generalized wordlength pattern and J-characteristics. Below we give the definitions since in the literature the same statistics are used for sometimes different normalizations.

Let A be a two-level \(N \times k\) dimensional orthogonal array (the elements of A have values \(\pm\) 1). N is the number of runs, k is the number of factors. Let X be the N × m matrix \(X = [1\ A\ A_2]\) with intercept, A and 2-factor interactions \(A_2\). Here \(m = 1 + k + k(k-1)/2\). The information matrix is equal to \( X^TX \). The optimality values are defined as

**D-optimality**The value is defined as \( (\det X^T X)^{(1/m)}/N \).**Average VIF, A-efficiency**The average variance inflation factor is defined as \( N \mathrm{tr} (X^T X)^{-1}/m \). The A-efficiency is equal to the reciprocal \( 1 / ( N \mathrm{tr} (X^T X)^{-1}/m ) \).**E-optimality**Equal to the value of the minimal eigenvalue of the information matrix \(X^T X \).**Projective Estimation Capacity sequence**The PEC sequence as introduced inTheory of J-characteristics for fractional factorial designs and projection justification of minimum G2-aberration , Tang, Boxin.

### Command line tools for manipulation of arrays

Tools included in the package:

**oainfo**Show information about contains of an file with designs**oasplit, oajoin**Join or split array files**oafilter**Make a selection of arrays**oaanalyse**Calculate D-efficiency, A-efficiency, E-efficiency, centered L2-discrepancy, GWLP and J-characteristics of arrays**oacheck**Reduce arrays to canonical form**oaextendsingle**Calculate all non-isomorphic arrays in a certain class