# Introduction

Orthogonal arrays, optimal designs and conference designs are important tools for the design of experiments [EN95] [HSS99] [WH09]. The Orthogonal Array package contains functionality to generate and analyse these types of designs. To generate the arrays and designs, the package uses the exhaustive enumeration algorithm of [SEN10] and the optimization algorithm of [ES17]. To analyze the arrays and designs, the package includes a wide variety of relevant statistical and combinatorial criteria. A large collection of orthogonal arrays, optimal designs and conference designs generated with the package are available in the Orthogonal Array package website [Een18].

## Example usage

The Orthogonal Array package can be used to generate and manipulate arrays and designs. Additionally, it can calculate some of their statistical properties. The following example shows how to generate an orthogonal array with 8 runs and 2 factors, and calculate three relevant statistical properties:

Calculate D-efficiency

```>>> import oapackage
>>> array=oapackage.exampleArray(0) # define an orthogonal array
>>> array.showarray()
array:
0   0
0   0
0   1
0   1
1   0
1   0
1   1
1   1
>>> D = array.Defficiency() # calculate the D-efficiency for estimating the interaction effects model
>>> array_rank = array.rank() # calculate the rank of the design
>>> print('D-efficiency %f, rank %d' % (D, array_rank) )
D-efficiency 1.000000, rank 2
>>> gwlp = array.GWLP() # calculate the generalized word length pattern
>>> print('Generalized wordlength pattern: %s' % (gwlp,) )
Generalized wordlength pattern: (1.0, 0.0, 0.0)
```

The statistical properties of the arrays and designs are introduced in Properties of designs.

## Interfaces

The Orthogonal Array package has interfaces in C++ and Python for generating, manipulating and analyzing all the types of arrays and designs. In this documentation, you will find references to both the Python and the C++ interface. The package also includes several command line tools.

For the generation of optimal designs [ES17], the Orthogonal Array package has also a Matlab interface; see the documentation README.Matlab.md.

The code is available under a BSD style license; see the file LICENSE for details. If you use this code or any of the results, please cite this program as follows:

## Acknowledgements

The code and ideas for this package have been contributed by Eric Schoen, Ruben Snepvangers, Vincent Brouerius van Nidek, Alan Roberto Vazquez and Pieter Thijs Eendebak.

## Installation

The packge is continously tested on Linux and Windows. The Python interface is available from the Python Package Index. The package can be installed from the command line using pip:

```\$ pip install OApackage
```

The source code for the package is available on https://github.com/eendebakpt/oapackage. The command line tools use a cmake build system. From the command line, type the following:

```\$ mkdir -p build
\$ cd build
\$ cmake ..
\$ make
\$ make install
```

This creates the command line utilities and a C++ library.

To compile the Python interface use

```\$ python setup.py build
\$ python setup.py install --user
```

The Python interface requires Numpy , Matplotlib [Hun07] and Swig. The code has been tested with Python 3.6, 3.7 and 3.8.

The R interface to the optimal design functionality of the package is available from CRAN. For the Matlab and Octave interface to the optimal design functionality see the file README.Matlab.md.