Copies information from an `A2WAY`

analysis into Genstat data structures (R.W. Payne).

### Options

`FACTORIAL` = scalar |
Sets a limit on the number of factors in the terms formed from the `TERMS` formula; default 2 |
---|---|

`RESIDUALS` = variate |
Saves the residuals |

`FITTEDVALUES` = variate |
Saves the fitted values |

`COMBINATIONS` = string token |
Factor combinations for which to form predicted means (`present` , `estimable` ); default `esti` |

`ADJUSTMENT` = string token |
Type of adjustment to be made when predicting means (`marginal` , `equal` , `observed` ); default `marg` |

`LSDLEVEL` = scalar |
Significance level (%) for least significant differences; default 5 |

`AOVTABLE` = pointer |
To save the analysis-of-variance table as a pointer with a variate or text for each column (source, d.f., s.s., m.s. etc) |

`RMETHOD` = string token |
Type of residuals to form if the `RESIDUALS` option is set (`simple` , `standardized` ); default `simp` |

`EXIT` = scalar |
Saves an exit code indicating the properties of the design |

`SAVE` = pointer |
Save structure (from `A2WAY` ) for the analysis; if omitted, output is from the most recent `A2WAY` analysis |

### Parameters

`TERMS` = formula |
Specifies the treatment terms whose means &c are to be saved |
---|---|

`MEANS ` = table or pointer to tables |
Saves tables of means for the terms or pointer to tables |

`SEMEANS` = table or pointer to tables |
Saves approximate effective standard errors of means |

`SEDMEANS` = table or pointer to tables |
Saves standard errors of differences between means |

`LSD` = table or pointer to tables |
Saves least significant differences |

### Description

The procedure `A2WAY`

provides specialized facilities for analysis of variance with either one or two treatment factors. There can also be a blocking factor. It automatically determines the type of design and uses the appropriate method: the `ANOVA`

directive if the design is balanced, or the regression directives (`FIT`

, `ADD`

and so on) if it is unbalanced.

Procedure `A2KEEP`

allows you to copy information from the analysis into Genstat data structures. By default the information is from the most recent analysis performed by `A2WAY`

. Alternatively, you can set the `SAVE`

option to a save structure (saved using the `SAVE`

parameter of `A2WAY`

) to save information from an earlier analysis.

You can use the parameters of `A2KEEP`

to save means, standard errors and least significant differences for the treatment main effects and interactions. The `TERMS`

parameter should be set to a model formula to define the main effects and interactions whose means &c you want to save. The `MEANS`

parameter can then save tables of means. The `SEMEANS`

parameter saves their standard errors (also in a table). The `SEDMEANS`

parameter saves standard errors for differences between the means (in a symmetric matrix), and the `LSD`

parameter saves least significant differences (also in a symmetric matrix). The significance level for the least significant differences can be change from the default of 5% using the `LSDLEVEL`

option. If you have a single term, you can supply a table or symmetric matrix for each of these parameters, as appropriate. However, if you have several terms, you must supply a pointer which will then be set up to contain as many tables or symmetric matrices as there are terms. The `LSDLEVEL`

option sets the significance level (as a percentage) for the least significant differences.

The `FACTORIAL`

option sets a limit in the number of factors in the terms generated from the `TERMS`

model formula. So

`A2KEEP [FACTORIAL=1] A*B; MEANS=MA,MB`

would save only the main effects of `A`

and `B`

. The option is provided for compatibility with the `AKEEP`

directive. However, an alternative (and simpler) way of saving means only for the main effects would be to put

`A2KEEP [FACTORIAL=1] A+B; MEANS=MA,MB`

The default for `FACTORIAL`

is 2.

For unbalanced designs (analysed by `A2WAY`

using Genstat regression) the means are produced using the `PREDICT`

directive. The first step (A) of the calculation forms the full table of predictions, classified by all the treatment and blocking factors. The second step (B) averages the full table over the factors that do not occur in the table of means. The `COMBINATIONS`

option specifies which cells of the full table are to be formed in Step A. The default setting, `estimable`

, fills in all the cells other than those that involve parameters that cannot be estimated. Alternatively, setting `COMBINATIONS=present`

excludes the cells for factor combinations that do not occur in the data. The `ADJUSTMENT`

option then defines how the averaging is done in Step B. The default setting, `marginal`

, forms a table of marginal weights for each factor, containing the proportion of observations with each of its levels; the full table of weights is then formed from the product of the marginal tables. The setting `equal`

weights all the combinations equally. Finally, the setting `observed`

uses the `WEIGHTS`

option of `PREDICT`

to weight each factor combination according to its own individual replication in the data.

The `RESIDUALS`

option can save the residuals from the analysis, and the `FITTEDVALUES`

option can save the fitted values. The `RMETHOD`

option controls whether simple or standardized residuals are saved; by default `RMETHOD=simple`

. The `AOVTABLE`

option saves the analysis-of-variance table, as a pointer with a variate or a text for each column of the table. The pointer elements are labelled with the column labels of the table, and the variates contain missing values where the table has blanks. These can be printed as blanks by setting option `MISSING=' '`

in the `PRINT`

directive.

The `EXIT`

option can save an exit code indicating how the analysis was done. For the exact meanings of the values see the `ANOVA`

directive. Essentially, it has the values 0 or 1 if the analysis has been done using `ANOVA`

(0 if design orthogonal and 1 if it is balanced). Other values indicate that it has been done using the regression directives.

Options: `FACTORIAL`

, `RESIDUALS`

, `FITTEDVALUES`

, `COMBINATIONS`

, `ADJUSTMENT`

, `LSDLEVEL`

, `AOVTABLE`

, `RMETHOD`

, `EXIT`

, `SAVE`

.

Parameters: `TERMS`

, `MEANS`

, `SEMEANS`

, `SEDMEANS`

, `LSD`

.

### Method

### Action with `RESTRICT`

If the `Y`

variate in `A2WAY`

was restricted, only the units not excluded by the restriction will have been analysed.

### See also

Commands for: Analysis of variance.

### Example

CAPTION 'A2KEEP example',\ !t('Data from Snedecor & Cochran (1980), Statistical Methods',\ '(7th edition), page 216 and also see page 252.');\ STYLE=meta,plain FACTOR [LEVELS=4; VALUES=(1...4)6] Fat VARIATE [VALUES=64,78,75,55, 72,91,93,66, 68,97,78,49,\ 77,82,71,64, 56,85,63,70, 95,77,76,68] Absorbed A2WAY [PRINT=aovtable,means; TREATMENTS=Fat; FPROBABILITY=yes;\ PLOT=*] Absorbed A2KEEP Fat; MEANS=FatMeans; SED=FatSED PRINT FatMeans,FatSED CAPTION !t('Data from Snedecor & Cochran (1980), Statistical Methods',\ '(7th edition), page 305.') FACTOR [LABELS=!T(Beef,Cereal,Pork); VALUES=(1...3)20] Source FACTOR [LABELS=!T(High,Low); VALUES=3(1,2)10] Amount VARIATE [NVALUES=60] Gain READ Gain 73 98 94 90 107 49 102 74 79 76 95 82 118 56 96 90 97 73 104 111 98 64 80 86 81 95 102 86 98 81 107 88 102 51 74 97 100 82 108 72 74 106 87 77 91 90 67 70 117 86 120 95 89 61 111 92 105 78 58 82 : A2WAY [PRINT=aovtable,means; TREATMENTS=Source,Amount; FPROBABILITY=yes;\ PLOT=*] Gain A2KEEP Source*Amount; MEANS=!p(Sm,Am,SAm); SED=!p(Ssed,Ased,SAsed) PRINT [RLPRINT=integers,labels,identifiers; CLPRINT=integers,identifiers]\ Sm,Ssed,Am,Ased,SAm,SAsed