# Anovadoe

Jump to navigation
Jump to search

## Contents

### Purpose

Function to perform ANOVA for 2^k factorial model X, Y data.

### Synopsis

- out = anovadoe(x, y)
- out = anovadoe(x, y, column_ID, options)
- out = anovadoe(x, y, options)

### Description

Performs ANOVA for the model described by the submitted X data relative to the Y data. Each column of X is design in a specific way to allow the calculation of an effect due to the specific main effect or interaction used to design each specific column. The main output is a statistical test of the significance of each term (eg., column) of the X matrix, a test of the overall model, and a test for lack-of-fit. There are additional statistical values supplied that support the above test metrics that might be used to construct a typical ANOVA table if desired.

#### Inputs

**x**= matrix describing the settings of each X variable (cols) for each sample (row). Typically this would be a 2^k DOE design matrix. The origin/identity of each column is described in the 'column_ID' var.**y**= the experimental Y value determined for each experiment/row of X.

#### Optional Inputs

**column_ID**= a cell array of numerical values which describes the multiplicative origin of each column of X. If x is a DOE dataset object, this input can be omitted (the information will be included in the dataset object). If omitted, each column of X is assumed to be a unique (non-interaction) factor.

- NOTE: The number of columns in x must = number of cells in column_ID.
- NOTE: If an intercept is to be explicitly included as a column of 'ones' in the x matrix (as in a regression), then that column must be represented as a '0' in column_ID. A DOE design does not typically have an explicit intercept.
- NOTE: Further, the numbers in column_ID must be in increasing order by single digits, 2 digits, 3 digits, etc. (and obviously must match the x matrix).
- Examples:
column_ID = {[1] [2] [1 2]};

- Indicates how columns were derived. Multiple numbers indicate interaction and which original columns were used to calculate design vars. Here, 1 and 2 are independent columns, but column 3 is a dependent column derived from the product of 1 and 2. Column 3 will be used to calculate the interaction of factors 1 and 2. The term [1 2] must appear after the term [1]. Further, a term [1 2 3] must appear after a term [1 2], which must likewise appear after a term [1].
column_ID = {[1] [2] [1 2] [1 3] [2 3] [1 2 3]};

- If you include an interaction term e.g. [1 2 3] in a model, all subterms encompassed by the highest order term must also be included. So subterms [1] [2] [1 2] [1 3] [2 3] all be included.

#### Outputs

**out**= a structure containing the sum of squares, mean square values, F-test values, F-critical values, and p-values for each column/treatment, for the model as a whole, for overall residual error, and for lack-of-fit and pure error (if replication was present).

### Options

options = a structure array with the following fields:

**plots**: [ {'none'} | 'final' ] governs plotting of results.