1. Home
2. TREATMENTSTRUCTURE directive

TREATMENTSTRUCTURE directive

Specifies the treatment terms to be fitted by subsequent `ANOVA` statements.

Parameter

    formula Treatment formula, specifies the treatment model terms to be fitted by subsequent `ANOVA`s

Description

The `TREATMENTSTRUCTURE` directive defines the treatment formula which specifies treatment, or systematic, terms to be fitted in subsequent `ANOVA` statements. For a simple one-way analysis of variance this has the form

`TREATMENTSTRUCTURE Tfac`

where `Tfac` is a factor which indicates which treatment was received by each unit in the design. Most experiments, however, are devised to study several treatment factors. For these factorial experiments `TREATMENTSTRUCTURE` specifies a model formula to define the model terms to be fitted. Each model term will then have its own line in the analysis-of-variance table and, for example, will have a table of means.

Initially in a job, there is no treatment formula. This situation can be restored by a `TREATMENTSTRUCTURE` directive with a null setting:

`TREATMENTSTRUCTURE`

In its simplest form, a model formula is a list of model terms, linked by the operator “`+`“. For example,

`A + B`

is a formula containing two terms, `A` and `B`, representing the main effects of factors `A` and `B` respectively. Higher-order terms (like interactions) are specified as series of factors separated by dots, but their precise meaning depends on which other terms the formula contains, as we explain below. The other operators provide ways of specifying a formula more succinctly, and of representing its structure more clearly.

The crossing operator `*` is used to specify factorial structures. For example, the treatment formula

`TREATMENTSTRUCTURE Nitrogen * Sulphur`

is expanded automatically by Genstat to become the formula

`Nitrogen + Sulphur + Nitrogen.Sulphur`

which has three terms: `Nitrogen` for the nitrogen main effect, `Sulphur` for the main effect of sulphur, and `Nitrogen.Sulphur` for the nitrogen by sulphur interaction. Higher-order terms like `Nitrogen.Sulphur` represent all the joint effects of the factors `Nitrogen` and `Sulphur` that have not been removed by earlier terms in the formula. Thus here it represents the interaction between nitrogen and sulphur as both main effects have been removed.

The other most-commonly used operator is the nesting operator (`/`). This occurs most often in block models (specified by the `BLOCKSTRUCTURE` directive). For example, the formula

`Litter / Rat`

is expanded to become the formula

`Litter + Litter.Rat`

This could define the block model for a design in which there are several litters of rats. As the formula contains no “main effect” for `rat`, the term `Litter.Rat` represents rat-within-litter effects (that is the differences between individual rats after removing any overall similarity between rats that belong to the same litter).

A formula can contain more than one of these operators. The three-factor factorial model

`A * B * C`

becomes

`A + B + C + A.B + A.C + B.C + A.B.C`

and the nested structure

`Block / Wplot / Subplot`

which specifies the block model of a split-plot design becomes

`Block + Block.Wplot + Block.Wplot.Subplot`

The operators can also be mixed in the same formula. In general, if `l` and `m` are two model formulae:

`l * m = l + m + l.m`

`l / m = l + fac(l).m`

(where `l.m` is the sum of all pairwise dot products of a term in `l` and a term in `m`, and `fac(l)` is the dot product of all factors in `l`). For example:

`(A + B) * (C + D) = (A + B) + (C + D) + (A + B).(C + D)`

`                  = A + B + C + D + A.C + A.D + B.C + B.D`

`(A + B)/C = A + B + fac(A + B).C = A + B + A.B.C`

The other important operator for `ANOVA` is the pseudo-factorial operator `//`. This allows you to partition an unbalanced treatment term into pseudo-terms, which are each balanced.

Contrasts can be fitted by putting a function of a factor into the treatment formula, instead of the factor itself. Polynomial contrasts can be specified using the `POL` or `POLND` functions. Other, user-defined regression models can be defined using the `REG` or `REGND` functions. `COMPARISON`, the other function relevant to `ANOVA` allows comparisons to be calculated between levels of the factor.

Options: none.

Parameter: unnamed.

Directives: `ANOVA`, `BLOCKSTRUCTURE`, `COVARIATE`, `ADISPLAY`, `AKEEP`.

Procedures: `AFCOVARIATES`, `ASTATUS`, `AUNBALANCED`.

Functions: `COMPARISON`, `POL`, `POLND`, `REG`, `REGND`.

Commands for: Analysis of variance.

Example

```" Example ANOV-1: one-way analysis of variance"

" This experiment studied the effect of different additives on the octane
level of gasoline. There were 5 additives and 4 observations on each
(P.W.M. John, Statistical Design and Analysis of Experiments, page 46).

Define number of units in the experiment (5 types x 4 observations)."
UNITS [NVALUES=20]
" Define a factor to indicate the type of gasoline for each observation."
FACTOR [LABELS=!T(A,B,C,D,E)] Gasoline
" Define variate to store the octane level recorded at each observation."
VARIATE Octane
" Read the data, representing Gasoline by its labels."
A  91.7   A  91.2   A  90.9   A  90.6
B  91.7   B  91.9   B  90.9   B  90.9
C  92.4   C  91.2   C  91.6   C  91.0
D  91.8   D  92.2   D  92.0   D  91.4
E  93.1   E  92.9   E  92.4   E  92.4 :
" Define the treatments to be fitted in the analysis."
TREATMENTS Gasoline
" Analyse the variate Octane, printing just the AOV table."
ANOVA [PRINT=aov] Octane
" Further output can be displayed without repeating the analysis:
here we print tables of means."

" Example ANOV-1a: linear and quadratic contrasts"

" Suppose that gasolines A-E contain 0,1,2,3,4 cc/gallon of additive,
respectively (but are otherwise identical). Plot the means against