Defines covariates from a model formula for `ANOVA`

(R.W. Payne).

### Options

`COVARIATES` = pointer |
Saves the covariates |
---|---|

`COVGROUPS` = pointer |
Saves the pointers defined to contain the covariates formed for each term in `TERMS` |

`FACTORIAL` = scalar |
Limit on number of factors in the model terms formed from `TERMS` ; default 3 |

### Parameters

`TERMS` = formula |
Model terms from which to define covariates |
---|

### Description

Analysis of covariance is performed in Genstat using the `ANOVA`

directive. The treatment model must be specified first, using the `TREATMENTSTRUCTURE`

directive, and the underlying structure of the design (or, equivalently, the error terms for the analysis) is specified using the `BLOCKSTRUCTURE`

directive as in ordinary analysis of variance. The extra step for analysis of covariance is to specify the covariates for the analysis using the `COVARIATE`

directive. The covariates must be continuous variables, and so `COVARIATE`

requires a list of variates. Alternatively, a refinement introduced in Release 12 allows you to put some of the covariates into pointers. The covariates in each pointer will then be pooled into a single line in the analysis of variance table.

However, `COVARIATE`

does not allow for more complicated situations. For example you might want to fit a different covariate regression coefficient within each block of a randomized-block experiment, or to use the covariate to fit the effects of terms in an unbalanced design.

The `AFCOVARIATES`

procedure has therefore been provided as an alternative to the `COVARIATE`

directive, to allow you to specify a model formulae to define the terms to be fitted as covariates in the analysis. The model formula is specified by the `TERMS`

parameter, using the same conventions as for example in the Genstat regression commands. The dummy variables that are generated to represent the model terms in the formula use the same parameterization as the regression commands; see Section 3.3.2 of the *Guide to the Genstat Command Language, Part 2 Statistics* for details.

So, for example, you can fit a different regression coefficient for the variate `X`

within each block defined by the factor `Blocks`

, by specifying

`AFCOVARIATES Blocks.X`

The `COVARIATES`

option allows you to supply a pointer to store the covariates that are calculated (otherwise they will be unnamed, and thus usable only by later `ANOVA`

commands). The covariates are grouped into a pointer for each model term specified by `TERMS`

. The `COVGROUPS`

option allows you to supply a pointer to store these pointers (otherwise they too will be unnamed, and thus usable only by later `ANOVA`

commands). Each covariate is each defined with an extra text, using the `EXTRA`

parameter of the `VARIATE`

directive, to indicate the parameter that it represents. Also the `IPRINT`

option of `VARIATE`

is set to `extra`

, so that this extra text will be used in output instead of the identifier of the covariate itself. Similarly, the `COVGROUPS`

pointers are given extra texts indicating the model term that each one represents.

The `FACTORIAL`

option sets a limit on the number of factors or variates in each of the terms formed from the `TERMS`

formula. Any term containing more than that limit is deleted.

Options: `COVARIATES`

, `COVGROUPS`

, `FACTORIAL`

.

Parameter: `TERMS`

.

### Method

`AFCOVARIATES`

defines the covariates from a design matrix constructed using the `TERMS`

directive.

### Action with `RESTRICT`

`AFCOVARIATES`

takes account of any restrictions on the factors or variates in the `TERMS`

formula.

### See also

Commands for: Analysis of variance.

### Example

CAPTION 'AFCOVARIATES example',!t(\ 'Completely randomized experiment with covariate',\ 'Snedecor & Cochran, p.377'); STYLE=meta,plain FACTOR [NVALUES=30; LABELS=!T(A,B,C)] Drug VARIATE [NVALUES=30] X,Y READ Drug,X,Y; FREPRESENTATION=labels A 11 6 B 6 0 C 16 13 A 8 0 B 6 2 C 13 10 A 5 2 B 7 3 C 11 18 A 14 8 B 8 1 C 9 5 A 19 11 B 18 18 C 21 23 A 6 4 B 8 4 C 16 12 A 10 13 B 19 14 C 12 5 A 6 1 B 8 9 C 12 16 A 11 8 B 5 1 C 7 1 A 3 0 B 15 9 C 12 20 : " common covariate regression coefficient over drugs " TREATMENTS Drug COVARIATE X ANOVA [PRINT=aov,covariates; FPROBABILITY=yes] Y " try different a different covariate regression coefficient for each drug (analysis will show that X.Drug B and X.Drug C are non significant, so only a common coefficient is needed) " AFCOVARIATES X/Drug ANOVA [PRINT=aov,covariates; FPROBABILITY=yes] Y