1. Home
2. APOLYNOMIAL procedure

# APOLYNOMIAL procedure

Forms equations for single-factor polynomial contrasts fitted by `ANOVA` (R.W. Payne).

### Options

`PRINT` = string token Whether to print the equation of the polynomial (`equation`); default `equa` Save structure (from `ANOVA`) to provide details of the analysis from which the equations are to be formed; default uses the save structure from the most recent `ANOVA`

### Parameters

`TERMS` = formula Model terms whose polynomial equations are required Saves the coefficients of each polynomial

### Description

The `ANOVA` directive fits polynomial contrasts of the effects of a factor by forming orthogonal polynomials (see Section 4.5 of the Guide to the Genstat Command Language, Part 2 Statistics). This allows the sums of squares for the factor to be partitioned into the amount that can be explained by a linear relationship, then the extra amount that can be explained if the relationship is quadratic, then the extra amount given by a cubic relationship, and so on. As a result, though, the estimates that are produced by `ANOVA` are the regression coefficients of the orthogonal polynomials, not the coefficients of the polynomial equation. `ANOVA` can also estimate interactions between the (orthogonal) polynomial contrasts and other factors.

The polynomial coefficients can, however, be obtained using procedure `APOLYNOMIAL`. The `TERMS` parameter specifies the treatment terms whose equations are required. Each term must contain no more than one factor with a polynomial function (`POL` or `POLND`), and no factors with regression or comparison functions (`REG`, `REGND` or `COMPARISON`); otherwise it is ignored. If `TERMS` is not set, `APOLYNOMIAL` takes the full treatment model (see `TREATMENTSTRUCTURE`).

`APOLYNOMIAL` usually prints the equation, but you can set option `PRINT=*` to suppress this. The `COEFFICIENTS` parameter can supply a pointer to save the coefficients of the equations. The pointer will contain a pointer for each term. These are given suffixes 0 upwards, corresponding to the powers of the factor in each polynomial.

By default, the equation is formed for the contrasts estimated in the most recent analysis performed by `ANOVA`, but the `SAVE` option can be used to supply the save structure from an earlier analysis to use instead.

Option: `PRINT`.

Parameters: `FACTOR`, `LEVELS`, `GROUPS`, `COEFFICIENTS`, `SAVE`.

### Method

`APOLYNOMIAL` first needs to duplicate the process of forming the orthogonal polynomials, regressing each power of the factor levels on the lower powers. Suppose, for example, a fourth-order polynomial was fitted, and the orthogonal polynomials were given by

p1 = y

p2 = y2b21 × y

p3 = y3b31 × yb32 × y2

p4 = y4b41 × yb42 × y2b41 × y3

and that the estimated coefficients of the orthogonal polynomials were e1, e2, e3 and e4. The coefficients of the polynomial equation are then calculated as

c1 = e1b21 × e2b31 × e3b41 × e4

c2 = e2b32 × e3b42 × e4

c3 = e3b43 × e4

c4 = e4

Directives: `ANOVA`, `TREATMENTSTRUCTURE`.

Procedure: `ADPOLYNOMIAL`.

Functions: `POL`, `POLND`.

Commands for: Analysis of variance.

### Example

```CAPTION     'APOLYNOMIAL example'; STYLE=meta
FACTOR      [NVALUES=72; LEVELS=6] Blocks
&           [LEVELS=3] Wplots
&           [LEVELS=4] Subplots
GENERATE    Blocks,Wplots,Subplots
FACTOR      [LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen
&           [LABELS=!T(Victory,'Golden rain',Marvellous)] Variety
VARIATE     Yield; DECIMALS=2; EXTRA=' of oats in cwt. per acre'
4 3 2 1 1 2 4 3 1 2 3 4 3 1 2 4 4 1 2 3 2 1 3 4
2 3 4 1 4 2 3 1 1 4 2 3 3 4 1 2 1 3 4 2 2 3 4 1
4 1 3 2 3 4 1 2 3 4 2 1 3 1 4 2 4 3 1 2 1 2 3 4 :
3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 1 1 1 1 2 2 2 2
2 2 2 2 3 3 3 3 1 1 1 1 3 3 3 3 2 2 2 2 1 1 1 1
2 2 2 2 1 1 1 1 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 :
156 118 140 105 111 130 174 157 117 114 161 141
104  70  89 117 122  74  89  81 103  64 132 133
108 126 149  70 144 124 121  96  61 100  91  97
109  99  63  70  80  94 126  82  90 100 116  62
96  60  89 102 112  86  68  64 132 124 129  89
118  53 113  74 104  86  89  82  97  99 119 121 :
" Convert yields to cwt per acre."
CALCULATE   Yield=(Yield*80)/(112*4)
" Define the treatment structure: factorial effects of V and N."
TREATMENTS  Variety*Nitrogen
" Subplots nested within whole-plots nested within blocks."
BLOCK       Blocks/Wplots/Subplots
VARIATE     [VALUES=0,0.2,0.4,0.6] Nitlev
" Polynomial effects of nitrogen to order 2 (lin. and quad.)."
TREATMENTS  POL(Nitrogen;2;Nitlev) * Variety
" Analysis printing contrasts to order 4 and the aov table."
ANOVA       [PRINT=aov,contrasts,effects] Yield
APOLYNOMIAL Nitrogen + Variety.Nitrogen

```
Updated on March 8, 2019